Skip to content

Conversation

@stephentoub
Copy link
Member

@stephentoub stephentoub commented Mar 19, 2025

  • Adds a new AIFunctionArguments type.
  • Changes AIFunction.InvokeAsync to accept an AIFunctionArguments instead of an arbitrary enumerable.
  • Changes FunctionInvokingChatClient to accept an IServiceProvider and expose it as a Services property, and to then pass that IServiceProvider into the AIFunction via AIFunctionArguments.Services.
  • Augments FunctionInvocationContext with an AIFunctionArguments property.
  • Changes AIFunctionFactory to special-case parameters of type IServiceProvider and AIFunctionArguments, sourcing from AIFunctionArguments.
  • Makes AIJsonSchemaCreateOptions a record.
Microsoft Reviewers: Open in CodeFlow

@stephentoub
Copy link
Member Author

@SteveSandersonMS, @halter73, as this is a fundamental change, I'd like a second review before merging. Thanks!

Copy link
Member

@SteveSandersonMS SteveSandersonMS left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Posted some minor questions but the overall thing look great.

Copy link
Member

@halter73 halter73 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. I agree that adding an optional IServiceProvider argument to OpenAIRealtimeExtensions.HandleToolCallsAsync would be a good idea, but that could be done as a follow up.

- Adds a new AIFunctionArguments type.
- Changes AIFunction.InvokeAsync to accept an AIFunctionArguments instead of an arbitrary enumerable.
- Changes FunctionInvokingChatClient to accept an IServiceProvider and expose it as a Services property, and to then pass that IServiceProvider into the AIFunction via AIFunctionArguments.Services.
- Augments FunctionInvocationContext with an AIFunctionArguments property.
- Changes AIFunctionFactory to special-case parameters of type IServiceProvider and AIFunctionArguments, sourcing from AIFunctionArguments.
- Makes AIJsonSchemaCreateOptions a record.
@stephentoub stephentoub force-pushed the aifunctionarguments branch from f5e7c7b to fe4453c Compare March 19, 2025 22:39
@stephentoub stephentoub enabled auto-merge (squash) March 19, 2025 22:40
@stephentoub stephentoub merged commit 6694f06 into dotnet:main Mar 19, 2025
6 checks passed
@stephentoub stephentoub deleted the aifunctionarguments branch March 19, 2025 23:18
@github-actions github-actions bot locked and limited conversation to collaborators Apr 19, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

area-ai Microsoft.Extensions.AI libraries

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants