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

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 a AIFunction parameter.

AIFunctionReturnParameterMetadata

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

AIJsonSchemaCreateOptions

An options class 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 may be specified to an AI service.

AudioContent

Represents audio content.

AutoChatToolMode

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

AzureAIInferenceChatClient

An IChatClient for an Azure AI Inference ChatCompletionsClient.

AzureAIInferenceEmbeddingGenerator

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>

A delegating embedding generator that caches the results of embedding generation calls.

ChatClientBuilder

A builder for creating pipelines of IChatClient.

ChatClientBuilderServiceCollectionExtensions

Provides extension methods for registering IChatClient with a IServiceCollection.

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

A delegating chat client that updates or replaces the ChatOptions used by the remainder of the pipeline.

ConfigureOptionsChatClientBuilderExtensions

Provides extensions for configuring ConfigureOptionsChatClient 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>

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>.

EmbeddingGeneratorBuilderServiceCollectionExtensions

Provides extension methods for registering IEmbeddingGenerator<TInput,TEmbedding> with a IServiceCollection.

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

An IChatClient for Ollama.

OllamaEmbeddingGenerator

An IEmbeddingGenerator<TInput,TEmbedding> for Ollama.

OpenAIChatClient

An IChatClient for an OpenAI OpenAI.OpenAIClient or OpenAI.Chat.ChatClient.

OpenAIClientExtensions

Provides extension methods for working with OpenAI.OpenAIClients.

OpenAIEmbeddingGenerator

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

OpenTelemetryChatClient

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

OpenTelemetryChatClientBuilderExtensions

Provides extensions for configuring OpenTelemetryChatClient instances.

OpenTelemetryEmbeddingGenerator<TInput,TEmbedding>

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

OpenTelemetryEmbeddingGeneratorBuilderExtensions

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

RequiredChatToolMode

Indicates that a chat tool must be called. It may optionally nominate a specific function, or if not, indicates that any of them may be selected.

StreamingChatCompletionUpdate

Represents a single response chunk from an IChatClient.

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

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.