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

feat: Add converter to support outbound calls to OpenAI servers that want tool not function #619

Closed
wants to merge 4 commits into from

Conversation

cpacker
Copy link
Collaborator

@cpacker cpacker commented Dec 15, 2023

Please describe the purpose of this pull request.

The function naming (function / function_call / function role) is deprecated in OpenAI API and partially (?) deprecated in Azure OpenAI. OpenAI and Azure both still support the old naming methodology, but newer "OpenAI API-compatible" services that also allow function calling (eg Anyscale) don't support the old naming scheme and want tool only.

This PR adds a converter function that goes from the old format to the new one. This is done on-the-fly, ie we still store messages in the functions style but we modify it on the way out to the OpenAI API server.

@sarahwooders eventually we probably want to migrate the internal representations to the tool_call format, but I'm not sure how important it is for now, since unless we want to have parallel function calling support nothing really changes and these light patches work fine (AFAIK).

How to test

Try using MemGPT with a non-OpenAI OpenAI-compatible endpoint that has function calling, but only the tool version of function calling (eg Anyscale).

Have you tested this PR?

Yes, seems to work OK with Anyscale.

@cpacker cpacker requested a review from sarahwooders December 15, 2023 03:37
@cpacker cpacker changed the title Add converter to support outbound calls to OpenAI servers that want tool not function feat: Add converter to support outbound calls to OpenAI servers that want tool not function Dec 16, 2023
@cpacker cpacker force-pushed the enable-tool-naming-on-openai-apis branch from 69495d3 to 8e11cad Compare January 5, 2024 22:55
@cpacker
Copy link
Collaborator Author

cpacker commented Jan 5, 2024

Force push rebased on 0.2.11

@cpacker cpacker mentioned this pull request Jan 5, 2024
2 tasks
@cpacker
Copy link
Collaborator Author

cpacker commented Feb 8, 2024

Deprecated by 0.3.0

@cpacker cpacker closed this Feb 8, 2024
@sarahwooders sarahwooders deleted the enable-tool-naming-on-openai-apis branch February 12, 2024 22:27
mattzh72 pushed a commit that referenced this pull request Jan 16, 2025
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.

1 participant