Add AIJsonSchemaCreateOptions.ParameterDescriptions#7068
Merged
stephentoub merged 3 commits intodotnet:mainfrom Nov 21, 2025
Merged
Add AIJsonSchemaCreateOptions.ParameterDescriptions#7068stephentoub merged 3 commits intodotnet:mainfrom
stephentoub merged 3 commits intodotnet:mainfrom
Conversation
To enable dynamically providing parameter descriptions.
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR adds a new ParameterDescriptions property to AIJsonSchemaCreateOptions to enable dynamically providing parameter descriptions for function schemas. This allows callers to override or supplement the descriptions that would normally be derived from DescriptionAttribute annotations on method parameters.
Key Changes
- Added
IReadOnlyDictionary<string, string>? ParameterDescriptionsproperty toAIJsonSchemaCreateOptionsclass - Updated
CreateFunctionJsonSchemaimplementation to checkParameterDescriptionsdictionary before falling back toDescriptionAttribute - Added comprehensive test coverage for the new functionality including override, addition, null handling, and edge cases
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
src/Libraries/Microsoft.Extensions.AI.Abstractions/Utilities/AIJsonSchemaCreateOptions.cs |
Added new ParameterDescriptions property with XML documentation explaining override behavior |
src/Libraries/Microsoft.Extensions.AI.Abstractions/Utilities/AIJsonUtilities.Schema.Create.cs |
Implemented parameter description resolution logic that prioritizes dictionary values over attributes |
test/Libraries/Microsoft.Extensions.AI.Abstractions.Tests/Utilities/AIJsonUtilitiesTests.cs |
Added structural equality test case and six new test methods covering various scenarios including overrides, null/empty dictionaries, and non-existent parameters |
src/Libraries/Microsoft.Extensions.AI.Abstractions/Microsoft.Extensions.AI.Abstractions.json |
Updated API baseline manifest to include the new public property |
src/Libraries/Microsoft.Extensions.AI.Abstractions/Utilities/AIJsonSchemaCreateOptions.cs
Outdated
Show resolved
Hide resolved
eiriktsarpalis
approved these changes
Nov 21, 2025
This was referenced Dec 11, 2025
This was referenced Jan 5, 2026
Closed
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
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
To enable dynamically providing parameter descriptions.
Microsoft Reviewers: Open in CodeFlow