Skip to content
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

"Unknown parameter: 'tool_resources.file_search.file_ids'." #1983

Open
1 task done
zhoumengbo opened this issue Jan 3, 2025 · 2 comments
Open
1 task done

"Unknown parameter: 'tool_resources.file_search.file_ids'." #1983

zhoumengbo opened this issue Jan 3, 2025 · 2 comments
Labels
bug Something isn't working

Comments

@zhoumengbo
Copy link

zhoumengbo commented Jan 3, 2025

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?

I referred to the following link: https://platform.openai.com/docs/assistants/migration/agents#accessing-v1-data-in-v2

   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

@zhoumengbo zhoumengbo added the bug Something isn't working label Jan 3, 2025
@ltanase77
Copy link

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."

@zhoumengbo
Copy link
Author

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."

Thanks for your reply, I found some examples in https://platform.openai.com/docs/assistants/tools/file-search?context=streaming#ensure-readiness-before-creating-runs, which may be useful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants