3 types derived from AIFunctionDeclaration
Microsoft.Extensions.AI.Abstractions (3)
Functions\AIFunction.cs (1)
12public abstract class AIFunction : AIFunctionDeclaration
Functions\AIFunctionFactory.cs (1)
474AIFunctionDeclaration
Functions\DelegatingAIFunctionDeclaration.cs (1)
14internal class DelegatingAIFunctionDeclaration : AIFunctionDeclaration // could be made public in the future if there's demand
73 references to AIFunctionDeclaration
Microsoft.Extensions.AI (7)
ChatCompletion\FunctionInvokingChatClient.cs (6)
37/// If a requested function is an <see cref="AIFunctionDeclaration"/> but not an <see cref="AIFunction"/>, the 768private static AIFunctionDeclaration? FindTool(string name, params ReadOnlySpan<IList<AITool>?> toolLists) 776if (tool is AIFunctionDeclaration declaration && string.Equals(tool.Name, name, StringComparison.Ordinal)) 900if (tool is not AIFunctionDeclaration) 954AIFunctionDeclaration? tool = FindTool(fcc.Name, options?.Tools, AdditionalTools); 1132AIFunctionDeclaration? tool = FindTool(callContent.Name, options?.Tools, AdditionalTools);
ChatCompletion\OpenTelemetryChatClient.cs (1)
589_ when t.GetService<AIFunctionDeclaration>() is { } af => 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: 129/// <see cref="AIFunctionDeclaration.JsonSchema"/>. There are a few exceptions to this: 206/// <see cref="AIFunctionDeclaration.JsonSchema"/>. There are a few exceptions to this: 294/// <see cref="AIFunctionDeclaration.JsonSchema"/>. There are a few exceptions to this: 384/// <see cref="AIFunctionDeclaration.JsonSchema"/>. There are a few exceptions to this: 449/// <summary>Creates an <see cref="AIFunctionDeclaration"/> using the specified parameters as the implementation of its corresponding properties.</summary> 454/// <returns>The created <see cref="AIFunctionDeclaration"/> that describes a function.</returns> 457/// <see cref="CreateDeclaration"/> creates an <see cref="AIFunctionDeclaration"/> that can be used to describe a function 458/// but not invoke it. To create an invocable <see cref="AIFunction"/>, use Create. A non-invocable <see cref="AIFunctionDeclaration"/> 461public 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.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)
16/// <summary>Creates an OpenAI <see cref="FunctionToolDefinition"/> from an <see cref="AIFunctionDeclaration"/>.</summary> 20public static FunctionToolDefinition AsOpenAIAssistantsFunctionToolDefinition(this AIFunctionDeclaration function) =>
MicrosoftExtensionsAIChatExtensions.cs (2)
24/// <summary>Creates an OpenAI <see cref="ChatTool"/> from an <see cref="AIFunctionDeclaration"/>.</summary> 28public static ChatTool AsOpenAIChatTool(this AIFunctionDeclaration function) =>
MicrosoftExtensionsAIRealtimeExtensions.cs (2)
16/// <summary>Creates an OpenAI <see cref="ConversationFunctionTool"/> from an <see cref="AIFunctionDeclaration"/>.</summary> 20public static ConversationFunctionTool AsOpenAIConversationFunctionTool(this AIFunctionDeclaration function) =>
MicrosoftExtensionsAIResponsesExtensions.cs (2)
20/// <summary>Creates an OpenAI <see cref="ResponseTool"/> from an <see cref="AIFunctionDeclaration"/>.</summary> 24public static FunctionTool AsOpenAIResponseTool(this AIFunctionDeclaration function) =>
OpenAIAssistantsChatClient.cs (2)
325internal static FunctionToolDefinition ToOpenAIAssistantsFunctionToolDefinition(AIFunctionDeclaration aiFunction, ChatOptions? options = null) 386case AIFunctionDeclaration aiFunction:
OpenAIChatClient.cs (2)
127internal static ChatTool ToOpenAIChatTool(AIFunctionDeclaration aiFunction, ChatOptions? options = null) 605if (tool is AIFunctionDeclaration af)
OpenAIClientExtensions.cs (2)
188/// <summary>Extracts from an <see cref="AIFunctionDeclaration"/> the parameters and strictness setting for use with OpenAI's APIs.</summary> 189internal static BinaryData ToOpenAIFunctionParameters(AIFunctionDeclaration aiFunction, bool? strict)
OpenAIRealtimeConversationClient.cs (1)
14public static ConversationFunctionTool ToOpenAIConversationFunctionTool(AIFunctionDeclaration aiFunction, ChatOptions? options = null)
OpenAIResponsesChatClient.cs (2)
577case AIFunctionDeclaration aiFunction: 691internal static FunctionTool ToResponseTool(AIFunctionDeclaration aiFunction, ChatOptions? options = null)
Microsoft.Extensions.AI.OpenAI.Tests (1)
OpenAIConversionTests.cs (1)
131var functionWithDefs = AIFunctionFactory.CreateDeclaration(
Microsoft.Extensions.AI.Tests (4)
ChatCompletion\FunctionInvokingChatClientTests.cs (3)
1573var declarationOnly = AIFunctionFactory.Create(() => "unused", "DefOnly").AsDeclarationOnly(); 1599var defOnly = AIFunctionFactory.Create(() => "unused", "DefOnly").AsDeclarationOnly(); 3211var declarationOnly = AIFunctionFactory.Create(() => "Result 1", "Func1").AsDeclarationOnly();
Functions\AIFunctionFactoryTest.cs (1)
1075AIFunctionDeclaration f = AIFunctionFactory.CreateDeclaration("something", "amazing", schema);