-
Notifications
You must be signed in to change notification settings - Fork 849
Add AIJsonSchemaCreateOptions.ParameterDescriptions #7068
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
Conversation
To enable dynamically providing parameter descriptions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 |
To enable dynamically providing parameter descriptions.
Microsoft Reviewers: Open in CodeFlow