Skip to content

.Net: add 'RetainArgumentTypes' to agent arguments for ModelContextProtocolPlugin demo #11488

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

Merged
merged 1 commit into from
Apr 15, 2025

Conversation

pjirsa
Copy link
Contributor

@pjirsa pjirsa commented Apr 10, 2025

Motivation and Context

Extremely high token consumption when running this demo: https://github.com/microsoft/semantic-kernel/tree/main/dotnet/samples/Demos/ModelContextProtocolPlugin

When calling the ChatCompletionAgent with the default 'false' value for RetainArgumentTypes, all arguments are converted to string values which causes some of the tool calls to fail. The agent then iterates through other tools, searching for a successful response. This results in 80-85k tokens being consumed where only 11-12k should be consumed.

Description

This PR will update the ModelContextProtocolPlugin demo to re-use the configured PromptExecutionSettings object that includes the correct value for RetainArgumentTypes.

@pjirsa pjirsa requested a review from a team as a code owner April 10, 2025 15:04
@markwallace-microsoft markwallace-microsoft added the .NET Issue or Pull requests regarding .NET code label Apr 10, 2025
@markwallace-microsoft markwallace-microsoft added this pull request to the merge queue Apr 15, 2025
github-merge-queue bot pushed a commit that referenced this pull request Apr 15, 2025
…otocolPlugin demo (#11488)

### Motivation and Context

Extremely high token consumption when running this demo:
[https://github.com/microsoft/semantic-kernel/tree/main/dotnet/samples/Demos/ModelContextProtocolPlugin](https://github.com/microsoft/semantic-kernel/tree/main/dotnet/samples/Demos/ModelContextProtocolPlugin)

When calling the ChatCompletionAgent with the default 'false' value for
RetainArgumentTypes, all arguments are converted to string values which
causes some of the tool calls to fail. The agent then iterates through
other tools, searching for a successful response. This results in 80-85k
tokens being consumed where only 11-12k should be consumed.

### Description

This PR will update the ModelContextProtocolPlugin demo to re-use the
configured PromptExecutionSettings object that includes the correct
value for `RetainArgumentTypes`.
Merged via the queue into microsoft:main with commit c06890c Apr 15, 2025
22 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
.NET Issue or Pull requests regarding .NET code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants