Microsoft.Extensions.AI Namespace

Classes

AdditionalPropertiesDictionary

Provides a dictionary used as the AdditionalProperties dictionary on Microsoft.Extensions.AI objects.

AIContent

Provides a base class for all content used with AI services.

AIFunction

Represents a function that can be described to an AI service and invoked.

AIFunctionContext

Provides additional context to the invocation of an AIFunction created by AIFunctionFactory.

AIFunctionFactory

Provides factory methods for creating commonly used implementations of AIFunction.

AIFunctionFactoryCreateOptions

Represents options that can be provided when creating an AIFunction from a method.

AIFunctionMetadata

Provides read-only metadata for an AIFunction.

AIFunctionParameterMetadata

Provides read-only metadata for an AIFunction parameter.

AIFunctionReturnParameterMetadata

Provides read-only metadata for an AIFunction's return parameter.

AIJsonSchemaCreateOptions

Provides options for configuring the behavior of AIJsonUtilities JSON schema creation functionality.

AIJsonUtilities

Provides a collection of utility methods for marshalling JSON data.

AITool

Represents a tool that can be specified to an AI service.

AnonymousDelegatingChatClient

A delegating chat client that wraps an inner client with implementations provided by delegates.

AnonymousDelegatingEmbeddingGenerator<TInput,TEmbedding>

A delegating embedding generator that wraps an inner generator with implementations provided by delegates.

AudioContent

Represents audio content.

AutoChatToolMode

Indicates that an IChatClient is free to select any of the available tools, or none at all.

AzureAIInferenceChatClient

Represents an IChatClient for an Azure AI Inference ChatCompletionsClient.

AzureAIInferenceEmbeddingGenerator

Represents an IEmbeddingGenerator<TInput,TEmbedding> for an Azure.AI.Inference EmbeddingsClient.

AzureAIInferenceExtensions

Provides extension methods for working with Azure AI Inference.

CachingChatClient

A delegating chat client that caches the results of chat calls.

CachingEmbeddingGenerator<TInput,TEmbedding>

Represents a delegating embedding generator that caches the results of embedding generation calls.

ChatClientBuilder

A builder for creating pipelines of IChatClient.

ChatClientBuilderChatClientExtensions

Provides extension methods for working with IChatClient in the context of ChatClientBuilder.

ChatClientExtensions

Provides a collection of static methods for extending IChatClient instances.

ChatClientMetadata

Provides metadata about an IChatClient.

ChatClientStructuredOutputExtensions

Provides extension methods on IChatClient that simplify working with structured output.

ChatCompletion

Represents the result of a chat completion request.

ChatCompletion<T>

Represents the result of a chat completion request with structured output.

ChatFinishReason.Converter

Provides a JsonConverter<T> for serializing ChatRole instances.

ChatMessage

Represents a chat message used by an IChatClient.

ChatOptions

Represents the options for a chat request.

ChatResponseFormat

Represents the response format that is desired by the caller.

ChatResponseFormatJson

Represents a response format for structured JSON data.

ChatResponseFormatText

Represents a response format with no constraints around the format.

ChatRole.Converter

Provides a JsonConverter<T> for serializing ChatRole instances.

ChatToolMode

Describes how tools should be selected by a IChatClient.

ConfigureOptionsChatClient

Represents a delegating chat client that configures a ChatOptions instance used by the remainder of the pipeline.

ConfigureOptionsChatClientBuilderExtensions

Provides extensions for configuring ConfigureOptionsChatClient instances.

ConfigureOptionsEmbeddingGenerator<TInput,TEmbedding>

Represents a delegating embedding generator that configures a EmbeddingGenerationOptions instance used by the remainder of the pipeline.

ConfigureOptionsEmbeddingGeneratorBuilderExtensions

Provides extensions for configuring ConfigureOptionsEmbeddingGenerator<TInput,TEmbedding> instances.

DataContent

Represents data content, such as an image or audio.

DelegatingChatClient

Provides an optional base class for an IChatClient that passes through calls to another instance.

DelegatingEmbeddingGenerator<TInput,TEmbedding>

Provides an optional base class for an IEmbeddingGenerator<TInput,TEmbedding> that passes through calls to another instance.

DistributedCachingChatClient

A delegating chat client that caches the results of completion calls, storing them as JSON in an IDistributedCache.

DistributedCachingChatClientBuilderExtensions

Extension methods for adding a DistributedCachingChatClient to an IChatClient pipeline.

DistributedCachingEmbeddingGenerator<TInput,TEmbedding>

Represents a delegating embedding generator that caches the results of embedding generation calls, storing them as JSON in an IDistributedCache.

DistributedCachingEmbeddingGeneratorBuilderExtensions

Extension methods for adding a DistributedCachingEmbeddingGenerator<TInput,TEmbedding> to an IEmbeddingGenerator<TInput,TEmbedding> pipeline.

Embedding

Represents an embedding generated by a IEmbeddingGenerator<TInput,TEmbedding>.

Embedding<T>

Represents an embedding composed of a vector of T values.

EmbeddingGenerationOptions

Represents the options for an embedding generation request.

EmbeddingGeneratorBuilder<TInput,TEmbedding>

A builder for creating pipelines of IEmbeddingGenerator<TInput,TEmbedding>.

EmbeddingGeneratorBuilderEmbeddingGeneratorExtensions

Provides extension methods for working with IEmbeddingGenerator<TInput,TEmbedding> in the context of EmbeddingGeneratorBuilder<TInput,TEmbedding>.

EmbeddingGeneratorExtensions

Provides a collection of static methods for extending IEmbeddingGenerator<TInput,TEmbedding> instances.

EmbeddingGeneratorMetadata

Provides metadata about an IEmbeddingGenerator<TInput,TEmbedding>.

FunctionCallContent

Represents a function call request.

FunctionInvokingChatClient

A delegating chat client that invokes functions defined on ChatOptions. Include this in a chat pipeline to resolve function calls automatically.

FunctionInvokingChatClient.FunctionInvocationContext

Provides context for a function invocation.

FunctionInvokingChatClient.FunctionInvocationResult

Provides information about the invocation of a function call.

FunctionInvokingChatClientBuilderExtensions

Provides extension methods for attaching a FunctionInvokingChatClient to a chat pipeline.

FunctionResultContent

Represents the result of a function call.

GeneratedEmbeddings<TEmbedding>

Represents the result of an operation to generate embeddings.

ImageContent

Represents image content.

LoggingChatClient

A delegating chat client that logs chat operations to an ILogger.

LoggingChatClientBuilderExtensions

Provides extensions for configuring LoggingChatClient instances.

LoggingEmbeddingGenerator<TInput,TEmbedding>

A delegating embedding generator that logs embedding generation operations to an ILogger.

LoggingEmbeddingGeneratorBuilderExtensions

Provides extensions for configuring LoggingEmbeddingGenerator<TInput,TEmbedding> instances.

OllamaChatClient

Represents an IChatClient for Ollama.

OllamaEmbeddingGenerator

Represents an IEmbeddingGenerator<TInput,TEmbedding> for Ollama.

OpenAIChatClient

Represents an IChatClient for an OpenAI OpenAIClient or ChatClient.

OpenAIClientExtensions

Provides extension methods for working with OpenAIClients.

OpenAIEmbeddingGenerator

An IEmbeddingGenerator<TInput,TEmbedding> for an OpenAI EmbeddingClient.

OpenAIRealtimeExtensions

Provides extension methods for working with OpenAI.RealtimeConversation.RealtimeConversationSession and related types.

OpenTelemetryChatClient

Represents a delegating chat client that implements the OpenTelemetry Semantic Conventions for Generative AI systems.

OpenTelemetryChatClientBuilderExtensions

Provides extensions for configuring OpenTelemetryChatClient instances.

OpenTelemetryEmbeddingGenerator<TInput,TEmbedding>

Represents a delegating embedding generator that implements the OpenTelemetry Semantic Conventions for Generative AI systems.

OpenTelemetryEmbeddingGeneratorBuilderExtensions

Provides extensions for configuring OpenTelemetryEmbeddingGenerator<TInput,TEmbedding> instances.

RequiredChatToolMode

Represents a mode where a chat tool must be called. This class can optionally nominate a specific function or indicate that any of the functions can be selected.

StreamingChatCompletionUpdate

Represents a single streaming response chunk from an IChatClient.

StreamingChatCompletionUpdateExtensions

Provides extension methods for working with StreamingChatCompletionUpdate instances.

TextContent

Represents text content in a chat.

UsageContent

Represents usage information associated with a chat response.

UsageDetails

Provides usage details about a request/response.

Structs

AdditionalPropertiesDictionary.Enumerator

Enumerates the elements of an AdditionalPropertiesDictionary.

AIJsonSchemaCreateContext

Defines the context in which a JSON schema within a type graph is being generated.

ChatFinishReason

Represents the reason a chat response completed.

ChatRole

Describes the intended purpose of a message within a chat completion interaction.

Interfaces

IChatClient

Represents a chat completion client.

IEmbeddingGenerator<TInput,TEmbedding>

Represents a generator of embeddings.

Enums

FunctionInvokingChatClient.FunctionStatus

Provides error codes for when errors occur as part of the function calling loop.

Delegates

AnonymousDelegatingChatClient.CompleteSharedFunc

Represents a method used to call CompleteAsync(IList<ChatMessage>, ChatOptions, CancellationToken) or CompleteStreamingAsync(IList<ChatMessage>, ChatOptions, CancellationToken).