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
Confirm this is an issue with the Python library and not an underlying OpenAI API
This is an issue with the Python library
Describe the bug
I want to use Assistants to upload a document and then ask the model some questions based on the document content. When I specify file_ids, I always get a parameter error. Could you please help me figure out where the problem is?
file = client.files.create(
file=open(file_path, "rb"),
purpose='assistants'
)
response = client.beta.assistants.create(
model="gpt-4o-mini",
name="QA Assistant",
description="An assistant to answer questions based on uploaded documents",
instructions="You are a helpful assistant who answers questions based on the information provided. Be concise and clear.",
tools=[{"type": "file_search"}],
tool_resources={"file_search": {"file_ids": [file.id]}},
# file_ids=[file.id],
temperature=0.0,
top_p=1
)
The above code produces the error:
Traceback (most recent call last):
File "D:\product\auto_test\openai_api\test-pdf-assistants.py", line 85, in
main()
File "D:\product\auto_test\openai_api\test-pdf-assistants.py", line 50, in main
response = client.beta.assistants.create(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\software\Anaconda\Anaconda\envs\textgrad\Lib\site-packages\openai\resources\beta\assistants.py", line 146, in create
return self._post(
^^^^^^^^^^^
File "D:\software\Anaconda\Anaconda\envs\textgrad\Lib\site-packages\openai_base_client.py", line 1280, in post
return cast(ResponseT, self.request(cast_to, opts, stream=stream, stream_cls=stream_cls))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\software\Anaconda\Anaconda\envs\textgrad\Lib\site-packages\openai_base_client.py", line 957, in request
return self._request(
^^^^^^^^^^^^^^
File "D:\software\Anaconda\Anaconda\envs\textgrad\Lib\site-packages\openai_base_client.py", line 1061, in _request
raise self._make_status_error_from_response(err.response) from None
openai.BadRequestError: Error code: 400 - {'error': {'message': "Unknown parameter: 'tool_resources.file_search.file_ids'.", 'type': 'invalid_request_error', 'param': 'tool_resources.file_search.file_ids', 'code': 'unknown_parameter'}}
Process finished with exit code 1
To Reproduce
1. file = client.files.create(
file=open(file_path, "rb"),
purpose='assistants'
)
2. response = client.beta.assistants.create(
model="gpt-4o-mini",
name="QA Assistant",
description="An assistant to answer questions based on uploaded documents",
instructions="You are a helpful assistant who answers questions based on the information provided. Be concise and clear.",
tools=[{"type": "file_search"}],
tool_resources={"file_search": {"file_ids": [file.id]}},
# file_ids=[file.id],
temperature=0.0,
top_p=1
)
Code snippets
No response
OS
Windows
Python version
python v3.11.11
Library version
openai v1.58.1
The text was updated successfully, but these errors were encountered:
I think this piece in the documentation says that you need to pass a vectorstore id.
"Assistants have tools and tool_resources instead of file_ids. The retrieval tool is now the file_search tool. The tool_resource for the file_search tool is a vector_store."
I think this piece in the documentation says that you need to pass a vectorstore id. "Assistants have tools and tool_resources instead of file_ids. The retrieval tool is now the file_search tool. The tool_resource for the file_search tool is a vector_store."
Confirm this is an issue with the Python library and not an underlying OpenAI API
Describe the bug
I want to use Assistants to upload a document and then ask the model some questions based on the document content. When I specify file_ids, I always get a parameter error. Could you please help me figure out where the problem is?
I referred to the following link: https://platform.openai.com/docs/assistants/migration/agents#accessing-v1-data-in-v2
The above code produces the error:
Traceback (most recent call last):
File "D:\product\auto_test\openai_api\test-pdf-assistants.py", line 85, in
main()
File "D:\product\auto_test\openai_api\test-pdf-assistants.py", line 50, in main
response = client.beta.assistants.create(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\software\Anaconda\Anaconda\envs\textgrad\Lib\site-packages\openai\resources\beta\assistants.py", line 146, in create
return self._post(
^^^^^^^^^^^
File "D:\software\Anaconda\Anaconda\envs\textgrad\Lib\site-packages\openai_base_client.py", line 1280, in post
return cast(ResponseT, self.request(cast_to, opts, stream=stream, stream_cls=stream_cls))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\software\Anaconda\Anaconda\envs\textgrad\Lib\site-packages\openai_base_client.py", line 957, in request
return self._request(
^^^^^^^^^^^^^^
File "D:\software\Anaconda\Anaconda\envs\textgrad\Lib\site-packages\openai_base_client.py", line 1061, in _request
raise self._make_status_error_from_response(err.response) from None
openai.BadRequestError: Error code: 400 - {'error': {'message': "Unknown parameter: 'tool_resources.file_search.file_ids'.", 'type': 'invalid_request_error', 'param': 'tool_resources.file_search.file_ids', 'code': 'unknown_parameter'}}
Process finished with exit code 1
To Reproduce
Code snippets
No response
OS
Windows
Python version
python v3.11.11
Library version
openai v1.58.1
The text was updated successfully, but these errors were encountered: