-
Notifications
You must be signed in to change notification settings - Fork 3.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
FileSearchToolCall.file_search has empty results #1966
Comments
Alright, let's dig into this. So, the 400 error from issue #1938 is gone in openai==1.58.1, but now the FileSearch results are empty when using a custom AssistantEventHandler. That's a sneaky bug. Here's the breakdown and how we can tackle this: Understanding the Issue The on_tool_call_done method in your CustomEventHandler is supposed to receive the results of the fileSearch tool call. Bug in openai==1.58.1: There might be a bug in the library that prevents the FileSearch results from being populated when using a custom event handler. Verify Assistant and Vector Store: Double-check that the Assistant is correctly configured to use the fileSearch tool and that the vector store is properly connected and populated with data. Test with the Default Event Handler: Try running the code with the default AssistantEventHandler (or without specifying an event handler) to see if the FileSearch results are populated correctly in that case. This will help isolate whether the issue is specifically with the custom event handler. Inspect the Raw Response: If possible, capture the raw HTTP response from the stream method and examine its contents. This might reveal clues about why the FileSearch results are missing or if there are any error messages in the response. Simplify the Code: Try removing the include parameter or simplifying the custom event handler to see if that affects the results. This can help pinpoint whether the issue is related to the include parameter or the custom event handler's logic. Check for Updates: Ensure you're using the latest version of the openai library. If a newer version is available, try upgrading to see if it resolves the issue. Report to OpenAI: If you're unable to identify the cause of the issue, report it to OpenAI with a detailed description, code snippet, and steps to reproduce. They might be able to provide insights or identify a bug in the library. By systematically investigating these points, we should be able to pinpoint the cause of the missing FileSearch results and get this functionality working as expected. First, they're using an older version of the openai library (1.58.1). Might be worth bumping that up to the latest, see if it makes a difference. Sometimes those sneaky bugs get squashed in newer releases. Second, that include parameter... it's a bit verbose. Maybe there's a simpler way to specify those FileSearch results? Worth checking the docs, see if there's a more concise syntax. And lastly, this whole AssistantEventHandler thing... it's a bit of a black box. We don't know exactly how it's interacting with the stream or processing the results. Might be worth digging into the source code, see if there are any clues there. Overall, feels like a classic case of "it's not you, it's me" (or rather, it's the library). But with a bit of digging and some creative debugging, we should be able to crack this nut. |
It seems it has been chosen not to retrieve (or show) the results as we can see from the comments on this class: class FileSearchToolCall(BaseModel):
id: str
"""The ID of the tool call object."""
file_search: FileSearch
"""For now, this is always going to be an empty object."""
type: Literal["file_search"]
"""The type of tool call.
This is always going to be `file_search` for this type of tool call.
""" |
Confirm this is an issue with the Python library and not an underlying OpenAI API
Describe the bug
Continuing from issue : #1938
The error seems to be fixed with
openai==1.58.1
(it does not return a 400 error anymore). However if we capture the output of the stream with a custom class inheriting fromAssistantEventHandler
the results of the fileSearch tool are not available:Of which the results are:
where following from
openai.types.beta.threads.runs.file_search_tool_call.py
it supposed to show:when creating the
run
as follows:To Reproduce
Code snippets
No response
OS
Windows
Python version
Python 3.11.10
Library version
openai 1.58.1
The text was updated successfully, but these errors were encountered: