.Net: Honor FunctionChoiceBehavior function list in Gemini connector#1
Closed
giles17 wants to merge 1 commit into
Closed
.Net: Honor FunctionChoiceBehavior function list in Gemini connector#1giles17 wants to merge 1 commit into
giles17 wants to merge 1 commit into
Conversation
The Gemini connector converted a FunctionChoiceBehavior into a GeminiToolCallBehavior by inspecting only the AutoInvoke flag and evaluating the behavior against an empty kernel. As a result the configured function list and choice were ignored: every conversion provided all kernel functions to the model, and an explicit function list produced an incorrect result. Resolve the behavior against the request's kernel and provide exactly the functions it specifies, consistent with the other connectors. An empty function list now correctly disables function calling. The conversion is performed on a clone so shared or frozen settings are not mutated and the result is not cached across different kernels. Also add a kernel-aware FromExecutionSettings overload and update the chat completion client to use it. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: c0e4edcd-4d36-486f-950b-9c0c36fa68e8
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
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.
Motivation and Context
The Gemini connector converts a
FunctionChoiceBehavior(FCB) into the connector-internalGeminiToolCallBehaviorinGeminiPromptExecutionSettings. That conversion only inspected theAutoInvokeflag and evaluated the behavior against an empty kernel, so the configured function list and choice were dropped:FunctionChoiceBehavior.Auto()/Auto([subset])always provided all kernel functions to the model, regardless of the list supplied.FunctionChoiceBehavior.Auto([]), which is documented as equivalent to disabling function calling, still provided all kernel functions.This diverges from the other connectors, which resolve the behavior against the request kernel and provide exactly the functions it specifies.
Description
FunctionChoiceBehavioragainst the request's kernel and provide exactly the functions it declares (all, an explicit subset, or none), matching the shared function-calling semantics used by the other connectors.FromExecutionSettings(settings, kernel)overload and use it fromGeminiChatCompletionClient.Contribution Checklist
Connectors.Google.UnitTests)