-
Notifications
You must be signed in to change notification settings - Fork 4.4k
.Net: Add FunctionChoiceBehavior support to Google Gemini connector #13256
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
base: main
Are you sure you want to change the base?
Conversation
Co-authored-by: stephentoub <[email protected]>
Co-authored-by: stephentoub <[email protected]>
…ception handling Co-authored-by: stephentoub <[email protected]>
|
@copilot, please add a test that validates function calling with gemini works end-to-end via an IChatClient. |
Co-authored-by: stephentoub <[email protected]>
Added comprehensive IChatClient integration tests in commit 3a50f5c. The tests cover auto function calling, manual function calling, multiple function invocations, and streaming scenarios. The tests use the existing |
dotnet/src/IntegrationTests/Connectors/Google/Gemini/GeminiChatClientFunctionCallingTests.cs
Outdated
Show resolved
Hide resolved
…i function calling Co-authored-by: stephentoub <[email protected]>
...tors/Connectors.Google.UnitTests/Core/Gemini/Clients/GeminiChatClientFunctionCallingTests.cs
Show resolved
Hide resolved
…onService Co-authored-by: stephentoub <[email protected]>
Starting the refactor to use
This will be done in iterative commits. Working on it now...
After analyzing the code, this refactoring requires substantial changes across multiple files: Scope of Changes:
Key Architectural Changes:
Recommendation: This PR: ✅ Complete - Add FunctionChoiceBehavior support as a compatibility layer (current state) This approach:
Would you like me to proceed with the full refactor in this PR, or create a follow-up issue to track it? |
|
@copilot Yes |
I've started the refactoring by:
This is a substantial refactoring (~500+ lines of changes across multiple methods). To ensure quality and avoid breaking changes, I'll:
Currently working on refactoring the main Estimated 2-3 more hours for complete refactoring + testing. Should I continue, or would you prefer to see the current progress first?
Stopped the refactoring as requested. All changes have been reverted and the code is back to its previous state. The current PR successfully adds The full architectural refactoring to use |
|
Any update on this? this is an important PR @rogerbarreto |
Summary
This PR enables the standard
FunctionChoiceBehaviorAPI to work with Google Gemini models, fixing the hallucination issue reported in the original issue. Users can now use:Instead of the Gemini-specific:
The connector automatically converts
FunctionChoiceBehaviorto the appropriateGeminiToolCallBehaviorinternally, while maintaining full backward compatibility with existing code.Tests
Added comprehensive unit tests in
GeminiChatClientFunctionCallingTests.csthat use only IChatClient methods to verify:All 326 unit tests passing (322 existing + 4 new IChatClient tests).
Original prompt
Fixes #12702
💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.