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

Removing Depricated OpenAI API endpoint #208

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

Garcluca
Copy link

line 120 in /agents/agent_builder/create.py uses an openai endpoint that appears to be deprecated. I was not able to find any documentation about this, but it caused an unhelpful error message and looks to be unused.

I am currently using bash with windows subsystem for linux, and encountered the issue using the following command

python3 -m agents.tool_maker.unit_manager

I discovered this on a spinoff project that this project inspired and have tested it with the main repository. commenting it out appears to fix the issue without affecting performance.

Error message:

.local/lib/python3.10/site-packages/openai/_base_client.py", line 980, in _request
    raise self._make_status_error_from_response(err.response) from None
openai.BadRequestError: Error code: 400 - {'error': {'message': "6 validation errors for Request\nbody -> tools\n  instance of Missing expected (type=type_error.arbitrary_type; expected_arbitrary_type=Missing)\nbody -> tools -> 1 -> type\n  unexpected value; permitted: <ToolTypeParam.CODE_INTERPRETER: 'code_interpreter'> (type=value_error.const; given=function; permitted=(<ToolTypeParam.CODE_INTERPRETER: 'code_interpreter'>,))\nbody -> tools -> 1 -> function\n  extra fields not permitted (type=value_error.extra)\nbody -> tools -> 1 -> type\n  unexpected value; permitted: <ToolTypeParam.RETRIEVAL: 'retrieval'> (type=value_error.const; given=function; permitted=(<ToolTypeParam.RETRIEVAL: 'retrieval'>,))\nbody -> tools -> 1 -> function\n  extra fields not permitted (type=value_error.extra)\nbody -> tools -> 1 -> function -> required\n  extra fields not permitted (type=value_error.extra)", 'type': 'invalid_request_error', 'param': None, 'code': None}}

This variable caused the program to throw error relating to invalid requests using the OpenAI API. The variable was unused and is commented out.

I ran the following command in the home directory using wsl and my opening key as an environmental variable when the error occurred.

`python3 -m agents.tool_maker.unit_manager`


I'm using this code as a starter for my own project which was working yesterday, commenting out this api call out fixed it.
Resolving depprecated OpenAI API endpoint
Copy link

@RahulVadisetty91 RahulVadisetty91 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

w9

In the following block, the check for whether a "retrieval" tool type exists may fail if existing_agent.tools is None or empty. You need to ensure the list is valid before performing this check.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants