AIFunctionFactory Class
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Provides factory methods for creating commonly-used implementations of AIFunction.
public ref class AIFunctionFactory abstract sealed
public static class AIFunctionFactory
type AIFunctionFactory = class
Public Class AIFunctionFactory
- Inheritance
-
AIFunctionFactory
Remarks
The AIFunctionFactory class creates AIFunction instances that wrap .NET methods (specified as Delegate or MethodInfo). As part of this process, JSON schemas are automatically derived for both the function's input parameters (exposed via JsonSchema) and, by default, the function's return type (exposed via ReturnJsonSchema). These schemas are produced using the SerializerOptions and JsonSchemaCreateOptions, and enable AI services to understand and interact with the function. Return value serialization and schema derivation behavior can be customized via MarshalResult and ExcludeResultSchema, respectively.
Methods
| Name | Description |
|---|---|
| Create(Delegate, AIFunctionFactoryOptions) |
Creates an AIFunction instance for a method, specified via a delegate. |
| Create(Delegate, String, String, JsonSerializerOptions) |
Creates an AIFunction instance for a method, specified via a delegate. |
| Create(MethodInfo, Func<AIFunctionArguments,Object>, AIFunctionFactoryOptions) |
Creates an AIFunction instance for a method, specified via a MethodInfo for an instance method and a Func<T,TResult> for constructing an instance of the receiver object each time the AIFunction is invoked. |
| Create(MethodInfo, Object, AIFunctionFactoryOptions) |
Creates an AIFunction instance for a method, specified via an MethodInfo instance and an optional target object if the method is an instance method. |
| Create(MethodInfo, Object, String, String, JsonSerializerOptions) |
Creates an AIFunction instance for a method, specified via an MethodInfo instance and an optional target object if the method is an instance method. |
| CreateDeclaration(String, String, JsonElement, Nullable<JsonElement>) |
Creates an AIFunctionDeclaration using the specified parameters as the implementation of its corresponding properties. |