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

Unable to create json schema assistants in async #1869

Open
1 task done
Tracked by #1890
jmesich opened this issue Nov 15, 2024 · 2 comments
Open
1 task done
Tracked by #1890

Unable to create json schema assistants in async #1869

jmesich opened this issue Nov 15, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@jmesich
Copy link

jmesich commented Nov 15, 2024

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

When I try to create a json schema assistant, I get this error
"error": "Error code: 400 - {'error': {'message': \"Missing required parameter: 'response_format.json_schema.schema'. You provided 'schema_', did you mean to provide 'schema'?\", 'type': 'invalid_request_error', 'param': 'response_format.json_schema.schema', 'code': 'missing_required_parameter'}}"

When I go into the response_format_json_schema.py file and update JSONSchema.schema_ to JSONSchema.schema, the problem disappears.

To Reproduce

Call openai.AsyncOpenAI().beta.assistants.create with a response_format parameter

Code snippets

await openai.AsyncOpenAI().beta.assistants.create(
            model=assistant.model,
            description=assistant.description,
            instructions=assistant.instructions,
            name=assistant.name,
            response_format=assistant.response_format,
            temperature=assistant.temperature,
            tool_resources=assistant.tool_resources,
            tools=assistant.tools,
            top_p=assistant.top_p,
)

OS

MacOS Sonoma 14.6.1

Python version

Python v3.12.2

Library version

openai v1.54.4

@jmesich jmesich added the bug Something isn't working label Nov 15, 2024
@jmesich jmesich changed the title Unable to create Unable to create json schema assistants in async Nov 15, 2024
@Dhruv-net
Copy link

To address this issue, you can modify the library's source code to ensure that schema_ is correctly serialized as schema in the API request. This involves updating the serialization logic within the response_format_json_schema.py file. By changing the attribute from schema_ to schema, the API will recognize the parameter, resolving the error.

@Balles9 Balles9 mentioned this issue Nov 24, 2024
1 task
@jmesich
Copy link
Author

jmesich commented Nov 25, 2024

Hi @Dhruv-net, thank you for your response but I have already mentioned that fix in my description above and I do not wish to fork the repo for my deployments!

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