-
Notifications
You must be signed in to change notification settings - Fork 117
feat:OpenAI responses api & Provider Tools #291
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
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Nice work! Just to clarify, does this only support OpenAI as the name suggests, or can we use this for Gemini and Anthropic as well? I am a little confused 🤔. |
ProviderTool can be used with any provider that support this pattern, so yes, you can attach ProviderTool to the agent also using Gemini, and Anthropic. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
New OpenAI Responses API & Support for Provider Tools
This PR was inspired by #94 and the experimental repository by Andrew Monty.
What does this PR do?
This PR brings the new
OpenAIResponses
provider which uses the OpenAI responses API under the hood instead of the classical completions API. It supports tool call, streaming, and structured output.Since it implements the Neuron
AIProviderInterface
nothing change from external point of view compared to the actualOpenAI
provider.But, since OpenAI responses API supports the provider's native tools like
web_search
and others I was able to introduce theProviderTool
class to make you able to use provider tools for OpenAI, Anthropic, and Gemini.You can add the provider tools in the tools available to the agent but if the model decide to call this tool it will happen on the provider side, so you just wait for the final response.
Not all proivders support this pattern. For now it's just OpenAI, Anthropic, Gemini, and each of them with limitations. For example Gemini doesn't support the declarion of tools and provider tools at the same time. So if you want to use google search you can't declare other tools. That's why classic tools composition like Tavily still the most flexible solution.
Why is this change needed?
OpenAI marked completions API as deprecated and now it's promoting the transition to responses API in order to take advantage of the latest features: https://platform.openai.com/docs/guides/migrate-to-responses
Related Issues
#285
#94
Breaking Changes
No breaking changes in public APIs. Other providers that depend by the OpenAI completions API format (HuggingFace, Mistral, Grok, Deepseek) continue to extend the
OpenAI
provider class. So they continue to work based on their current compatibility.Documentation
You can use the new provider as any other provider. It supports chat, stream, and structured output.
ProviderTool can be added as usual in the tools method: