.Net: Feature converts FunctionChoiceBehavior into ToolCallBehavior gemini mistral#13101
Conversation
…i,Mistral while function call.
| if (executionSettings.FunctionChoiceBehavior != null) | ||
| { | ||
| ConfigureMistralRequestTool(request, kernel); | ||
| } |
There was a problem hiding this comment.
Consider supporting other choices. Same for the other connector:
if (executionSettings.FunctionChoiceBehavior is { } functionChoiceBehavior)
{
var config = functionChoiceBehavior.GetConfiguration(new FunctionChoiceBehaviorConfigurationContext(chatHistory) { Kernel = kernel });
if (config.Choice == FunctionChoice.Auto)
{
executionSettings.ToolCallBehavior ??= MistralAIToolCallBehavior.AutoInvokeKernelFunctions;
}
else if (config.Choice == FunctionChoice.Required && config.Functions is { Count: > 0 } functions)
{
executionSettings.ToolCallBehavior ??= MistralAIToolCallBehavior.RequiredFunctions(functions, config.AutoInvoke);
}
else if (config.Choice == FunctionChoice.None)
{
executionSettings.ToolCallBehavior ??= MistralAIToolCallBehavior.NoKernelFunctions;
}
}There was a problem hiding this comment.
@SergeyMenshykh
This fix is for HandoffActor.cs not sending tool information to LLM as its setting FunctionChoiceBehavior.
AgentInvokeOptions options = new() { Kernel = kernel, KernelArguments = new(new PromptExecutionSettings { FunctionChoiceBehavior = FunctionChoiceBehavior.Auto() }), OnIntermediateMessage = messageHandler, };
this PR is just to send tools list to llm when FunctionChoiceBehavior is not null. When FunctionChoice.Auto / FunctionChoice.Required tools list we will be sending to LLM always.
Now this additional check where we will be needing can you please help me with some details.
this says that we want to migrate from ToolCallBehavior to FunctionChoiceBehavior.
There was a problem hiding this comment.
this says that we want to migrate from ToolCallBehavior to FunctionChoiceBehavior.
This is the ideal scenario instead of adapting the FunctionChoiceBehavior to a ToolCallBehavior, having old ToolCallBehavior implementations updated to the new FunctionChoiceBehavior architecture.
Currently we are appreciating any contributions on this path.
|
This PR looks stale. Closing for now, please reopen if still needed. |
Motivation and Context
Description
Contribution Checklist