Skip to content

Conversation

@stephentoub
Copy link
Member

@stephentoub stephentoub commented Nov 21, 2025

To enable dynamically providing parameter descriptions.

Microsoft Reviewers: Open in CodeFlow

To enable dynamically providing parameter descriptions.
@stephentoub stephentoub requested a review from a team as a code owner November 21, 2025 02:41
Copilot AI review requested due to automatic review settings November 21, 2025 02:41
@github-actions github-actions bot added the area-ai Microsoft.Extensions.AI libraries label Nov 21, 2025
Copy link
Contributor

Copilot AI left a 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>? ParameterDescriptions property to AIJsonSchemaCreateOptions class
  • Updated CreateFunctionJsonSchema implementation to check ParameterDescriptions dictionary before falling back to DescriptionAttribute
  • 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

@stephentoub stephentoub enabled auto-merge (squash) November 21, 2025 15:10
@stephentoub stephentoub merged commit dda277d into dotnet:main Nov 21, 2025
6 checks passed
This was referenced Dec 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-ai Microsoft.Extensions.AI libraries

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants