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

[Bug] PythonTools fails with OpenAIChat #1972

Open
sigren opened this issue Feb 1, 2025 · 3 comments
Open

[Bug] PythonTools fails with OpenAIChat #1972

sigren opened this issue Feb 1, 2025 · 3 comments
Labels
bug Something isn't working

Comments

@sigren
Copy link

sigren commented Feb 1, 2025

Agent(
        model=llm,
        description=description,
        instructions=instructions,
        tools=[PythonTools(base_dir=Path("sandbox"))],
        show_tool_calls=False,
        tool_call_limit=20,
        response_model=response_model,
        structured_outputs=True,
        debug_mode=False,
    )
ERROR    Error from OpenAI API: Error code: 400 - {'error': {'message': "Invalid schema for function 'save_to_file_and_run': In context=('properties', 'variable_to_return'), schema must have a 'type' key.",
         'type': 'invalid_request_error', 'param': None, 'code': None}}
<class 'TypeError'>
You tried to pass a `BaseModel` class to `chat.completions.create()`; You must use `beta.chat.completions.parse()` instead
@sigren sigren added the bug Something isn't working label Feb 1, 2025
@manthanguptaa
Copy link
Contributor

Hey @sigren! Can the whole code be shared with me?

@Criticalbarny01
Copy link

I have the same issue. It's when the agent gets the structured_ooutputs=true param. The way to have structured_outputs has changed in the openai library. As the error shows it needs to use 'beta.chat.completions.parse()'.

@altunumut24
Copy link

I have the same issue, any work around ?

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

4 participants