-
Notifications
You must be signed in to change notification settings - Fork 32
feat: support OpenAI tools call #6
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR adds comprehensive support for OpenAI tools/function calling by implementing bidirectional conversion between OpenAI and Gemini API formats. The implementation handles tool call requests, tool responses, and ensures compatibility with Gemini's thoughtSignature requirements.
- Converts OpenAI tool_calls and tool role messages to Gemini functionCall/functionResponse format
- Converts Gemini functionCall responses back to OpenAI tool_calls format for both streaming and non-streaming responses
- Adds thoughtSignature placeholder handling to bypass Gemini API validation requirements
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 25 comments.
| File | Description |
|---|---|
| src/core/FormatConverter.js | Implements core translation logic for OpenAI tools ↔ Gemini function calling, including tool definition conversion, message buffering for consecutive tool messages, and bidirectional response translation for both streaming and non-streaming modes |
| src/core/RequestHandler.js | Integrates thoughtSignature validation bypass by calling ensureThoughtSignature for native Google requests with function calls/responses |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 2 out of 2 changed files in this pull request and generated 6 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…tool calls in FormatConverter
…ature in Gemini requests
…uire it for functionCall
…n in FormatConverter
78c3069 to
b7f5432
Compare
54ec982 to
64e542c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 2 out of 2 changed files in this pull request and generated 14 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
3a4f214 to
295b205
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 9 out of 9 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.
thoughtSignatureINFO,可以通过UI和环境变量设为DEBUG相关文档:https://ai.google.dev/gemini-api/docs/thought-signatures?hl=zh-cn