Skip to content

.Net: Bug: Arguments provided in the KernelArguments collection are not visible when prompt is handled #12905

@DmitryLukyanov

Description

@DmitryLukyanov

Describe the bug
Looking at this documentation, specifically in code block here. We may see how to define {{$repository}} argument in the prompt and how to provide a value:

    Arguments =
        new KernelArguments(new AzureOpenAIPromptExecutionSettings() { FunctionChoiceBehavior = FunctionChoiceBehavior.Auto() })
        {
            { "repository", "microsoft/semantic-kernel" }
        }

however when running this example and ask model a question about this argument like:

what repository you can query?

the models output is:

I can query a public repository with the name specified as {{$repository}}. Please provide the repository name so I can assist you further.

I feel like there is a misconception here. Any help would be appreciated.

To Reproduce
Steps to reproduce the behavior:

  1. Go to 'https://learn.microsoft.com/en-us/semantic-kernel/frameworks/agent/examples/example-chat-agent?pivots=programming-language-csharp#final'
  2. Copy the code from the code snipped into an empty console application.
  3. Run the chat bot
  4. Ask him what repository you can query?

Expected behavior
A github repository "microsoft/semantic-kernel".

Screenshots

Image

Platform

  • Language: [C#]
  • Source: [e.g. NuGet package version 0.1.0, pip package version 0.1.0, main branch of repository]
  • AI model: [gpt-4o-mini] gpt-5 gives a similar result
  • IDE: [Visual Studio]
  • OS: [Windows]

Other notes
Same behavior (the KernelArguments are not matched with keys in the prompt) with this code

Metadata

Metadata

Assignees

No one assigned

    Labels

    .NETIssue or Pull requests regarding .NET codebugSomething isn't workingtriage

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions