-
Notifications
You must be signed in to change notification settings - Fork 2.1k
.NET: [BREAKING] Refactor OpenAI Hosting OptionsMapping to disallow passing options by default #6855
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
westey-m
merged 4 commits into
microsoft:main
from
westey-m:openai-hosting-options-mapping-refactor
Jul 1, 2026
Merged
.NET: [BREAKING] Refactor OpenAI Hosting OptionsMapping to disallow passing options by default #6855
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
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
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
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
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
87 changes: 87 additions & 0 deletions
87
dotnet/src/Microsoft.Agents.AI.Hosting.OpenAI/OpenAIChatCompletionRequestInfo.cs
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,87 @@ | ||
| // Copyright (c) Microsoft. All rights reserved. | ||
|
|
||
| using System.Collections.Generic; | ||
| using Microsoft.Extensions.AI; | ||
|
|
||
| namespace Microsoft.Agents.AI.Hosting.OpenAI; | ||
|
|
||
| /// <summary> | ||
| /// Exposes the request-supplied generation and tool settings of an OpenAI ChatCompletions | ||
| /// <c>create chat completion</c> request that a hosting developer may choose to map onto the | ||
| /// <see cref="AgentRunOptions"/> used to run the target <see cref="AIAgent"/>. | ||
| /// </summary> | ||
| /// <remarks> | ||
| /// <para> | ||
| /// This type is passed to <see cref="OpenAIChatCompletionsMapOptions.RunOptionsFactory"/>. By default no | ||
| /// request setting is mapped onto the agent, because an agent is typically self-contained and | ||
| /// allowing callers to override its configuration (for example which tools it may invoke) can cause | ||
| /// it to behave in ways its author did not intend. | ||
| /// </para> | ||
| /// <para> | ||
| /// Tool and response-format settings are surfaced using their <c>Microsoft.Extensions.AI</c> | ||
| /// equivalents so that a hosting developer can map them directly without re-parsing the wire format. | ||
| /// </para> | ||
| /// </remarks> | ||
| public sealed class OpenAIChatCompletionRequestInfo | ||
| { | ||
| /// <summary> | ||
| /// Gets or sets the sampling temperature supplied on the request, if any. | ||
| /// </summary> | ||
| public float? Temperature { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// Gets or sets the nucleus sampling value (<c>top_p</c>) supplied on the request, if any. | ||
| /// </summary> | ||
| public float? TopP { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// Gets or sets the maximum number of completion tokens (<c>max_completion_tokens</c>) supplied on the request, if any. | ||
| /// </summary> | ||
| public int? MaxOutputTokens { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// Gets or sets the frequency penalty supplied on the request, if any. | ||
| /// </summary> | ||
| public float? FrequencyPenalty { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// Gets or sets the presence penalty supplied on the request, if any. | ||
| /// </summary> | ||
| public float? PresencePenalty { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// Gets or sets the deterministic sampling seed supplied on the request, if any. | ||
| /// </summary> | ||
| public long? Seed { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// Gets or sets the stop sequences supplied on the request, if any. | ||
| /// </summary> | ||
| public IReadOnlyList<string>? StopSequences { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// Gets or sets the response format supplied on the request, if any. | ||
| /// </summary> | ||
| public ChatResponseFormat? ResponseFormat { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// Gets or sets the model identifier supplied on the request, if any. | ||
| /// </summary> | ||
| /// <remarks> | ||
| /// This value is informational. It is not applied to local agent execution (the agent runs with | ||
| /// its own <see cref="IChatClient"/>), and the OpenAI ChatCompletions | ||
| /// wire format requires it on every request, so it is intentionally excluded from the default | ||
| /// <see cref="OpenAIChatCompletionsMapOptions.RejectRequestSettings"/> rejection. | ||
| /// </remarks> | ||
| public string? Model { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// Gets or sets the tool selection mode (<c>tool_choice</c>) supplied on the request, if any. | ||
| /// </summary> | ||
| public ChatToolMode? ToolChoice { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// Gets or sets the tools supplied on the request, if any. | ||
| /// </summary> | ||
| public IReadOnlyList<AITool>? Tools { get; set; } | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.