Document JSON schema derivation for return types in AIFunctionFactory#7400
Merged
stephentoub merged 3 commits intomainfrom Mar 17, 2026
Merged
Conversation
…FunctionFactoryOptions - Expand AIFunctionFactory class-level doc to mention JSON schema derivation for both parameters and return types - Add return type JSON schema paragraphs to all five Create* method remarks - Expand AIFunctionDeclaration.JsonSchema doc to mention auto-generation by AIFunctionFactory - Expand AIFunctionDeclaration.ReturnJsonSchema doc with schema derivation details - Fix misleading AIFunctionFactoryOptions.ExcludeResultSchema summary - Clarify AIFunctionFactoryOptions.JsonSchemaCreateOptions applies to both parameter and return type schemas Co-authored-by: stephentoub <[email protected]>
…erty name Co-authored-by: stephentoub <[email protected]>
Copilot created this pull request from a session on behalf of
stephentoub
March 17, 2026 12:17
View session
Contributor
There was a problem hiding this comment.
Pull request overview
This PR improves the XML documentation for AIFunctionFactory-created functions by documenting how JSON schemas are derived not only for parameters but also for return types (ReturnJsonSchema), and by clarifying related option semantics.
Changes:
- Documented return-type JSON schema derivation behavior across
AIFunctionFactoryoverloads andAIFunctionDeclaration.ReturnJsonSchema. - Clarified that
JsonSchemaCreateOptionsapplies to both input-parameter and return-type schemas. - Corrected/clarified
ExcludeResultSchemadocumentation to match its intent (exclude generating a return schema).
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
src/Libraries/Microsoft.Extensions.AI.Abstractions/Functions/AIFunctionFactoryOptions.cs |
Clarifies JsonSchemaCreateOptions scope and updates ExcludeResultSchema docs. |
src/Libraries/Microsoft.Extensions.AI.Abstractions/Functions/AIFunctionFactory.cs |
Adds remarks documenting return schema derivation/unwrapping behavior across factory overloads. |
src/Libraries/Microsoft.Extensions.AI.Abstractions/Functions/AIFunctionDeclaration.cs |
Expands JsonSchema/ReturnJsonSchema remarks to explain factory auto-derivation. |
You can also share your feedback on Copilot code review. Take the survey.
src/Libraries/Microsoft.Extensions.AI.Abstractions/Functions/AIFunctionFactoryOptions.cs
Outdated
Show resolved
Hide resolved
Member
|
@copilot address the feedback |
…that produce no schema Co-authored-by: stephentoub <[email protected]>
Contributor
Author
jeffhandley
approved these changes
Mar 17, 2026
jeffhandley
pushed a commit
to jeffhandley/extensions
that referenced
this pull request
Mar 17, 2026
…dotnet#7400) Co-authored-by: copilot-swe-agent[bot] <[email protected]> Co-authored-by: stephentoub <[email protected]>
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
The XML doc comments for
AIFunctionFactoryand friends thoroughly document JSON schema derivation for function parameters but say nothing about schema derivation for function return types (ReturnJsonSchema). TheExcludeResultSchemasummary also reads backward relative to its property name.Changes
AIFunctionFactoryclass-level doc: Added<remarks>covering that schemas are derived for both parameters and return types, and the knobs that control this (SerializerOptions,JsonSchemaCreateOptions,MarshalResult,ExcludeResultSchema).All 5
Create*overloads: Added a<para>to each method's remarks explaining return type schema derivation —void/Task/ValueTask→null,Task<T>/ValueTask<T>→ unwrapped, and referencingExcludeResultSchema/JsonSchemaCreateOptionson the overloads that acceptAIFunctionFactoryOptions.AIFunctionDeclaration.JsonSchema: Added a<para>noting thatAIFunctionFactoryauto-derives this from method parameters.AIFunctionDeclaration.ReturnJsonSchema: Expanded from a two-line remark to cover derivation mechanics, async unwrapping, and all conditions producingnull.AIFunctionFactoryOptions.ExcludeResultSchema: Fixed misleading summary. Was: "whether a schema should be created" (opposite of property name). Now: "whether to exclude generation of a JSON schema for the function's return type."AIFunctionFactoryOptions.JsonSchemaCreateOptions: Clarified it governs schemas for both input parameters and return type.Microsoft Reviewers: Open in CodeFlow