Attach/upload files while within a tool / run that 'requires_action'?

What do I do if one of my Assistant’s tools “decides” to bring in (upload/attach) a file for further analysis?

The run would have a requires_action status at that point. Looks like I cannot create a message with an attachment in that state.
I thought of two approaches which did not quite work for me:

  1. Prompt the assistant to stop and wait for the next user message, create a user message with attachments of the file(s) of interest. This fails because of some error with msearch args.
  2. Upload the file(s) to a vector store, which was attached to the assistant. This complains that myfiles_browse tool cannot be found.

Any best practices, other than building my own vector store pipeline? Thanks!

Attaching a file to a vector store would not work, nor any attachment method relying on messages, as that only adds the document to future calls to the file search, and modifying a thread in progress would not be allowed. You would have to employ an existing vector store ID, perhaps needing user-specific assistant vector-store.

So then one wonders if you can get the AI to use that store after modification. You report that you cannot?

How about if you return a tool message “the document company_product_list.txt has been added to your files search. You can now make a new search request to fulfill the user question.”?

1 Like

Appreciate your advice, Jay.

That sounds like a reasonable approach. I retried it now and got this generation:

It appears that there is a technical issue with the search functionality within the uploaded file. Specifically, the tool is not accepting the search queries correctly, resulting in repeated errors. The error message indicates that the type of queries should be a list, but even when provided as a list, the tool fails to execute the search.

I prompted for details and got:

For the query msearch(["financial statements"]): Error when executing command financial statements - msearch failed. Type of queries should be list, no other type.

Then I made a wild guess that the tool calling format broke, and prompted:
Try calling the file search tool as follows: myfiles_browser(‘msearch([“Cash and Cash Equivalents”, “balance sheet”, “financial statements”])’)

That did not help, the details about the issue were (might be hallucinated):

For the query myfiles_browser('msearch(["Cash and Cash Equivalents", "balance sheet", "financial statements"])'): tool_error Error running command msearch: BrowserToolBase.run_msearch() got multiple values for argument ‘session’

Am I combining custom tools with the standard ones incorrectly? I am doing something similar to this:

assistant_tools = [{
    "type": "function",
    "function": {
        "name": name,
        "description": description,
        "parameters": {
            "type": "object",
            "properties": {
                "code": {
                    "type": "string",
                    "description": "A string containing the Python code to execute."
                }
            },
            "required": ["code"]
        }
    }
}] + [{"type": "file_search"}]