-
Notifications
You must be signed in to change notification settings - Fork 835
Labels
area-aiMicrosoft.Extensions.AI librariesMicrosoft.Extensions.AI libraries
Description
An outcome from the TM review.
For function calling docs:
- Emphasize that incoming args are untrusted data from the LLM
- The exceptions are the parameter types special-cased by
AIFunctionFactory
:CancellationToken
is special and will receive a token that is chained onto the CT on the original callAIFunctionArgument
is special and describes all the incoming params as well as other context info (IServiceProvider
)IServiceProvider
is special and will receive the SP provided when you set up the middleware chain originally
- Beyond that, developers can also customize parameter binding with their own code using the
AIFunctionFactoryOptions.ConfigureParameterBinding
option. If they do that, it's up to them to know whether the data can be trusted or not based on how they have implemented the binding logic and where it gets its source data from. - Emphasize that in general,
AIFunctions
should be instance methods where possible. Then they can obtain trusted info about context from the instance they are a method on (e.g., to access the user'sClaimsPrincipal
, other context about data being worked on, etc). This is always better than trying to round-trip information through the LLM, since anything that comes out of the LLM may be compromised.
Metadata
Metadata
Assignees
Labels
area-aiMicrosoft.Extensions.AI librariesMicrosoft.Extensions.AI libraries