fix: openai raw tool call issue#7397
Conversation
There was a problem hiding this comment.
Pull request overview
This PR fixes an OpenAI raw tool call issue by using the official @ai-sdk/openai SDK instead of the @ai-sdk/openai-compatible adapter. The change creates a dedicated handler for OpenAI models that properly supports tool calls, while keeping other providers using the OpenAI-compatible adapter.
Changes:
- Added
@ai-sdk/openaidependency (v2.0.0) to properly handle OpenAI-specific features - Created dedicated
createOpenAIModelmethod following the same pattern as Anthropic and Google providers - Updated documentation to distinguish between OpenAI and OpenAI-compatible providers
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| web-app/src/lib/model-factory.ts | Added import for @ai-sdk/openai, created createOpenAIModel method, updated switch case to route OpenAI provider separately, and updated comments to distinguish OpenAI from OpenAI-compatible providers |
| web-app/package.json | Added @ai-sdk/openai package dependency at version ^2.0.0 |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
f7a62d4 to
059cead
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| * - google/gemini: Gemini models via Google Generative AI API (@ai-sdk/google v2.0) | ||
| * - OpenAI-compatible: OpenAI, Azure, Groq, Together, Fireworks, DeepSeek, Mistral, Cohere, etc. | ||
| * - openai: OpenAI models via OpenAI API (@ai-sdk/openai) | ||
| * - OpenAI-compatible: Azure, Groq, Together, Fireworks, DeepSeek, Mistral, Cohere, etc. |
There was a problem hiding this comment.
The documentation comment is now incorrect. It states that google/gemini providers use "Google Generative AI API (@ai-sdk/google v2.0)", but the implementation (lines 117-118, 129) now routes these providers through createOpenAICompatibleModel. The comment should be updated to reflect that google/gemini now use the OpenAI-compatible endpoint instead of the native Google AI SDK.
Describe Your Changes
Resolve the OpenAI raw tool call issue caused by the OpenAICompatible model factory. Update the Google provider to use the OpenAI-compatible endpoint to prevent regression.
Fixes Issues
Self Checklist