You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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 from AssistantEventHandler the results of the fileSearch tool are not available:
where following from openai.types.beta.threads.runs.file_search_tool_call.py it supposed to show:
classFileSearch(BaseModel):
ranking_options: Optional[FileSearchRankingOptions] =None"""The ranking options for the file search."""results: Optional[List[FileSearchResult]] =None"""The results of the file search."""
when creating the run as follows:
withclient.beta.threads.runs.stream(
thread_id=thread.id,
assistant_id=ass_id,
event_handler=CustomEventHandler(),
include=["step_details.tool_calls[*].file_search.results[*].content"]
) asstream:
# Wait for the stream to completestream.until_done()
To Reproduce
Run this with the id of an assistant connected to a vector store and the file search enabled (for simplicity do such thing through platform.openai.com)
fromtypingimportoverridefromopenaiimportAssistantEventHandlerfromopenaiimportOpenAIfromopenai.types.beta.threads.runs.tool_callimportToolCallclient=OpenAI()
messages= [
{
"content": <QUESTION_TO_THE_ASSISTANT>,
}
]
# Create a new thread for the assistantthread=client.beta.threads.create()
client.beta.threads.messages.create(
thread_id=thread.id,
role="user",
content=messages[-1]["content"]
)
classCustomEventHandler(AssistantEventHandler):
@overridedefon_tool_call_done(self, tool_call: ToolCall):
print(tool_call)
# Stream the assistant's responsewithclient.beta.threads.runs.stream(
thread_id=thread.id,
assistant_id=<ASSISTANT_ID>,
event_handler=CustomEventHandler(),
include=["step_details.tool_calls[*].file_search.results[*].content"]
) asstream:
# Wait for the stream to completestream.until_done()
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:
It seems it has been chosen not to retrieve (or show) the results as we can see from the comments on this class:
classFileSearchToolCall(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: