3 types derived from AIFunctionDeclaration
Microsoft.Extensions.AI.Abstractions (3)
Functions\AIFunction.cs (1)
12public abstract class AIFunction : AIFunctionDeclaration
Functions\AIFunctionFactory.cs (1)
491AIFunctionDeclaration
Functions\DelegatingAIFunctionDeclaration.cs (1)
14internal class DelegatingAIFunctionDeclaration : AIFunctionDeclaration // could be made public in the future if there's demand
69 references to AIFunctionDeclaration
Microsoft.Extensions.AI (3)
ChatCompletion\FunctionInvokingChatClient.cs (1)
37/// If a requested function is an <see cref="AIFunctionDeclaration"/> but not an <see cref="AIFunction"/>, the
ChatCompletion\OpenTelemetryChatClient.cs (2)
399if (options.Tools?.Any(t => t is AIFunctionDeclaration) is true) 403JsonSerializer.Serialize(options.Tools.OfType<AIFunctionDeclaration>().Select(t => new OtelFunction
Microsoft.Extensions.AI.Abstractions (27)
Functions\AIFunction.cs (3)
47/// <summary>Creates a <see cref="AIFunctionDeclaration"/> representation of this <see cref="AIFunction"/> that can't be invoked.</summary> 50/// <see cref="AIFunction"/> derives from <see cref="AIFunctionDeclaration"/>, layering on the ability to invoke the function in addition 53public AIFunctionDeclaration AsDeclarationOnly() => new NonInvocableAIFunction(this);
Functions\AIFunctionDeclaration.cs (3)
11/// <see cref="AIFunctionDeclaration"/> is the base class for <see cref="AIFunction"/>, which 13/// for <see cref="AIFunctionDeclaration"/> to determine whether they can be described as functions, 18/// <summary>Initializes a new instance of the <see cref="AIFunctionDeclaration"/> class.</summary>
Functions\AIFunctionFactory.cs (10)
48/// <see cref="AIFunctionDeclaration.JsonSchema"/>. There are a few exceptions to this: 130/// <see cref="AIFunctionDeclaration.JsonSchema"/>. There are a few exceptions to this: 211/// <see cref="AIFunctionDeclaration.JsonSchema"/>. There are a few exceptions to this: 303/// <see cref="AIFunctionDeclaration.JsonSchema"/>. There are a few exceptions to this: 397/// <see cref="AIFunctionDeclaration.JsonSchema"/>. There are a few exceptions to this: 466/// <summary>Creates an <see cref="AIFunctionDeclaration"/> using the specified parameters as the implementation of its corresponding properties.</summary> 471/// <returns>The created <see cref="AIFunctionDeclaration"/> that describes a function.</returns> 474/// <see cref="CreateDeclaration"/> creates an <see cref="AIFunctionDeclaration"/> that can be used to describe a function 475/// but not invoke it. To create an invocable <see cref="AIFunction"/>, use Create. A non-invocable <see cref="AIFunctionDeclaration"/> 478public static AIFunctionDeclaration CreateDeclaration(
Functions\AIFunctionFactoryOptions.cs (2)
110/// Gets or sets a value indicating whether a schema should be created for the function's result type, if possible, and included as <see cref="AIFunctionDeclaration.ReturnJsonSchema" />. 117/// When set to <see langword="true"/>, results in the produced <see cref="AIFunctionDeclaration.ReturnJsonSchema"/> to always be <see langword="null"/>.
Functions\DelegatingAIFunctionDeclaration.cs (4)
12/// Provides an optional base class for an <see cref="AIFunctionDeclaration"/> that passes through calls to another instance. 21protected DelegatingAIFunctionDeclaration(AIFunctionDeclaration innerFunction) 26/// <summary>Gets the inner <see cref="AIFunctionDeclaration" />.</summary> 27protected AIFunctionDeclaration InnerFunction { get; }
Utilities\AIJsonSchemaTransformCache.cs (5)
26private readonly ConditionalWeakTable<AIFunctionDeclaration, object> _functionSchemaCache = new(); 29private readonly ConditionalWeakTable<AIFunctionDeclaration, object>.CreateValueCallback _functionSchemaCreateValueCallback; 62GetOrCreateTransformedSchema((AIFunctionDeclaration)function); 65/// Gets or creates a transformed JSON schema for the specified <see cref="AIFunctionDeclaration"/> instance. 69public JsonElement GetOrCreateTransformedSchema(AIFunctionDeclaration function)
Microsoft.Extensions.AI.AzureAIInference (2)
AzureAIInferenceChatClient.cs (2)
338if (tool is AIFunctionDeclaration af) 405private static ChatCompletionsToolDefinition ToAzureAIChatTool(AIFunctionDeclaration aiFunction)
Microsoft.Extensions.AI.Evaluation.Quality (17)
AIToolExtensions.cs (2)
22foreach (AIFunctionDeclaration function in toolDefinitions.OfType<AIFunctionDeclaration>())
IntentResolutionEvaluator.cs (1)
28/// defined as <see cref="AIFunctionDeclaration"/>s. Any other <see cref="AITool"/> definitions that are supplied via
IntentResolutionEvaluatorContext.cs (4)
22/// defined as <see cref="AIFunctionDeclaration"/>s. Any other <see cref="AITool"/> definitions that are supplied via 39/// are defined as <see cref="AIFunctionDeclaration"/>s. Any other <see cref="AITool"/> definitions will be ignored. 58/// are defined as <see cref="AIFunctionDeclaration"/>s. Any other <see cref="AITool"/> definitions will be ignored. 84/// are defined as <see cref="AIFunctionDeclaration"/>s. Any other <see cref="AITool"/> definitions that are supplied via
TaskAdherenceEvaluator.cs (1)
27/// defined as <see cref="AIFunctionDeclaration"/>s. Any other <see cref="AITool"/> definitions that are supplied via
TaskAdherenceEvaluatorContext.cs (4)
23/// defined as <see cref="AIFunctionDeclaration"/>s. Any other <see cref="AITool"/> definitions that are supplied via 40/// are defined as <see cref="AIFunctionDeclaration"/>s. Any other <see cref="AITool"/> definitions will be ignored. 59/// are defined as <see cref="AIFunctionDeclaration"/>s. Any other <see cref="AITool"/> definitions will be ignored. 86/// defined as <see cref="AIFunctionDeclaration"/>s. Any other <see cref="AITool"/> definitions that are supplied via
ToolCallAccuracyEvaluator.cs (1)
28/// defined as <see cref="AIFunctionDeclaration"/>s. Any other <see cref="AITool"/> definitions that are supplied via
ToolCallAccuracyEvaluatorContext.cs (4)
24/// defined as <see cref="AIFunctionDeclaration"/>s. Any other <see cref="AITool"/> definitions that are supplied via 41/// are defined as <see cref="AIFunctionDeclaration"/>s. Any other <see cref="AITool"/> definitions will be ignored. 60/// are defined as <see cref="AIFunctionDeclaration"/>s. Any other <see cref="AITool"/> definitions will be ignored. 88/// are defined as <see cref="AIFunctionDeclaration"/>s. Any other <see cref="AITool"/> definitions that are supplied via
Microsoft.Extensions.AI.OpenAI (17)
MicrosoftExtensionsAIAssistantsExtensions.cs (2)
13/// <summary>Creates an OpenAI <see cref="FunctionToolDefinition"/> from an <see cref="AIFunctionDeclaration"/>.</summary> 17public static FunctionToolDefinition AsOpenAIAssistantsFunctionToolDefinition(this AIFunctionDeclaration function) =>
MicrosoftExtensionsAIChatExtensions.cs (2)
22/// <summary>Creates an OpenAI <see cref="ChatTool"/> from an <see cref="AIFunctionDeclaration"/>.</summary> 26public static ChatTool AsOpenAIChatTool(this AIFunctionDeclaration function) =>
MicrosoftExtensionsAIRealtimeExtensions.cs (2)
13/// <summary>Creates an OpenAI <see cref="ConversationFunctionTool"/> from an <see cref="AIFunctionDeclaration"/>.</summary> 17public static ConversationFunctionTool AsOpenAIConversationFunctionTool(this AIFunctionDeclaration function) =>
MicrosoftExtensionsAIResponsesExtensions.cs (2)
17/// <summary>Creates an OpenAI <see cref="ResponseTool"/> from an <see cref="AIFunctionDeclaration"/>.</summary> 21public static FunctionTool AsOpenAIResponseTool(this AIFunctionDeclaration function) =>
OpenAIAssistantsChatClient.cs (2)
274internal static FunctionToolDefinition ToOpenAIAssistantsFunctionToolDefinition(AIFunctionDeclaration aiFunction, ChatOptions? options = null) 336case AIFunctionDeclaration aiFunction:
OpenAIChatClient.cs (2)
121internal static ChatTool ToOpenAIChatTool(AIFunctionDeclaration aiFunction, ChatOptions? options = null) 584if (tool is AIFunctionDeclaration af)
OpenAIClientExtensions.cs (2)
179/// <summary>Extracts from an <see cref="AIFunctionDeclaration"/> the parameters and strictness setting for use with OpenAI's APIs.</summary> 180internal static BinaryData ToOpenAIFunctionParameters(AIFunctionDeclaration aiFunction, bool? strict)
OpenAIRealtimeConversationClient.cs (1)
11public static ConversationFunctionTool ToOpenAIConversationFunctionTool(AIFunctionDeclaration aiFunction, ChatOptions? options = null)
OpenAIResponsesChatClient.cs (2)
368internal static FunctionTool ToResponseTool(AIFunctionDeclaration aiFunction, ChatOptions? options = null) 434case AIFunctionDeclaration aiFunction:
Microsoft.Extensions.AI.Tests (3)
ChatCompletion\FunctionInvokingChatClientTests.cs (2)
1141var declarationOnly = AIFunctionFactory.Create(() => "unused", "DefOnly").AsDeclarationOnly(); 1167var defOnly = AIFunctionFactory.Create(() => "unused", "DefOnly").AsDeclarationOnly();
Functions\AIFunctionFactoryTest.cs (1)
939AIFunctionDeclaration f = AIFunctionFactory.CreateDeclaration("something", "amazing", schema);