Skip to content
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

.Net: Bug: Prompty not using tools_choice and tools field from template configuration #9976

Open
repne opened this issue Dec 14, 2024 · 0 comments
Labels
bug Something isn't working .NET Issue or Pull requests regarding .NET code

Comments

@repne
Copy link

repne commented Dec 14, 2024

Describe the bug
Prompty doesn't use the tools_choice and tools array from the template configuration.

You can see here that the field FunctionChoiceBehavior of PromptExecutionSettings is never set.

Expected behavior
The field tools_choice should default to auto if not set and if tools array has any function in it.

Platform

  • Language: C#
  • Source: Microsoft.SemanticKernel.Prompty 1.32.0-alpha

Workaround
This is how I am loading Prompty files to get function calling to work, this is not the correct behaviour (as it should read the functions from the .prompty file, but it works for me:

var promptTemplateConfig = KernelFunctionPrompty.ToPromptTemplateConfig(promptyTemplate);

promptTemplateConfig
    .DefaultExecutionSettings!
    .FunctionChoiceBehavior = FunctionChoiceBehavior.Auto(sp.GetServices<KernelPlugin>().SelectMany(x => x));

return KernelFunctionFactory.CreateFromPrompt(
    promptTemplateConfig,
    new AggregatorPromptTemplateFactory(new LiquidPromptTemplateFactory(), new HandlebarsPromptTemplateFactory()),
    null);
@repne repne added the bug Something isn't working label Dec 14, 2024
@markwallace-microsoft markwallace-microsoft added .NET Issue or Pull requests regarding .NET code triage labels Dec 14, 2024
@github-actions github-actions bot changed the title Bug: Prompty not using tools_choice and tools field from template configuration .Net: Bug: Prompty not using tools_choice and tools field from template configuration Dec 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working .NET Issue or Pull requests regarding .NET code
Projects
Status: Backlog
Development

No branches or pull requests

2 participants