diff --git a/src/Libraries/Microsoft.Extensions.AI.Abstractions/ChatCompletion/ChatOptions.cs b/src/Libraries/Microsoft.Extensions.AI.Abstractions/ChatCompletion/ChatOptions.cs index 8b3bef838dd..ac5fba99ae5 100644 --- a/src/Libraries/Microsoft.Extensions.AI.Abstractions/ChatCompletion/ChatOptions.cs +++ b/src/Libraries/Microsoft.Extensions.AI.Abstractions/ChatCompletion/ChatOptions.cs @@ -7,6 +7,7 @@ namespace Microsoft.Extensions.AI; /// Represents the options for a chat request. +/// Provide options. public class ChatOptions { /// Gets or sets an optional identifier used to associate a request with an existing conversation. @@ -20,6 +21,7 @@ public string? ChatThreadId } /// Gets or sets an optional identifier used to associate a request with an existing conversation. + /// Stateless vs. stateful clients. public string? ConversationId { get; set; } /// Gets or sets the temperature for generating chat responses. @@ -115,6 +117,7 @@ public string? ChatThreadId public ChatToolMode? ToolMode { get; set; } /// Gets or sets the list of tools to include with a chat request. + /// Tool calling. [JsonIgnore] public IList? Tools { get; set; } diff --git a/src/Libraries/Microsoft.Extensions.AI.Abstractions/ChatCompletion/ChatResponse.cs b/src/Libraries/Microsoft.Extensions.AI.Abstractions/ChatCompletion/ChatResponse.cs index 92be7a5145c..5e0e80beac9 100644 --- a/src/Libraries/Microsoft.Extensions.AI.Abstractions/ChatCompletion/ChatResponse.cs +++ b/src/Libraries/Microsoft.Extensions.AI.Abstractions/ChatCompletion/ChatResponse.cs @@ -92,6 +92,7 @@ public string? ChatThreadId /// or may not differ on every response, depending on whether the underlying provider uses a fixed ID for each conversation /// or updates it for each message. /// + /// Stateless vs. stateful clients. public string? ConversationId { get; set; } /// Gets or sets the model ID used in the creation of the chat response. diff --git a/src/Libraries/Microsoft.Extensions.AI.Abstractions/ChatCompletion/DelegatingChatClient.cs b/src/Libraries/Microsoft.Extensions.AI.Abstractions/ChatCompletion/DelegatingChatClient.cs index 23768dd8da7..112e846d41f 100644 --- a/src/Libraries/Microsoft.Extensions.AI.Abstractions/ChatCompletion/DelegatingChatClient.cs +++ b/src/Libraries/Microsoft.Extensions.AI.Abstractions/ChatCompletion/DelegatingChatClient.cs @@ -16,6 +16,7 @@ namespace Microsoft.Extensions.AI; /// This is recommended as a base type when building clients that can be chained around an underlying . /// The default implementation simply passes each call to the inner client instance. /// +/// Custom IChatClient middleware. public class DelegatingChatClient : IChatClient { /// diff --git a/src/Libraries/Microsoft.Extensions.AI.Abstractions/ChatCompletion/IChatClient.cs b/src/Libraries/Microsoft.Extensions.AI.Abstractions/ChatCompletion/IChatClient.cs index bb0fe6a428c..b4354e22a43 100644 --- a/src/Libraries/Microsoft.Extensions.AI.Abstractions/ChatCompletion/IChatClient.cs +++ b/src/Libraries/Microsoft.Extensions.AI.Abstractions/ChatCompletion/IChatClient.cs @@ -24,6 +24,7 @@ namespace Microsoft.Extensions.AI; /// /// /// Build an AI chat app with .NET. +/// The IChatClient interface. public interface IChatClient : IDisposable { /// Sends chat messages and returns the response. @@ -32,6 +33,7 @@ public interface IChatClient : IDisposable /// The to monitor for cancellation requests. The default is . /// The response messages generated by the client. /// is . + /// Request a chat response. Task GetResponseAsync( IEnumerable messages, ChatOptions? options = null, @@ -43,6 +45,7 @@ Task GetResponseAsync( /// The to monitor for cancellation requests. The default is . /// The response messages generated by the client. /// is . + /// Request a streaming chat response. IAsyncEnumerable GetStreamingResponseAsync( IEnumerable messages, ChatOptions? options = null, diff --git a/src/Libraries/Microsoft.Extensions.AI.Abstractions/Embeddings/IEmbeddingGenerator{TInput,TEmbedding}.cs b/src/Libraries/Microsoft.Extensions.AI.Abstractions/Embeddings/IEmbeddingGenerator{TInput,TEmbedding}.cs index ff3910ae737..ad6b9951642 100644 --- a/src/Libraries/Microsoft.Extensions.AI.Abstractions/Embeddings/IEmbeddingGenerator{TInput,TEmbedding}.cs +++ b/src/Libraries/Microsoft.Extensions.AI.Abstractions/Embeddings/IEmbeddingGenerator{TInput,TEmbedding}.cs @@ -24,6 +24,7 @@ namespace Microsoft.Extensions.AI; /// no instances are used which might employ such mutation. /// /// +/// The IEmbeddingGenerator interface. public interface IEmbeddingGenerator : IEmbeddingGenerator where TEmbedding : Embedding { @@ -33,6 +34,7 @@ public interface IEmbeddingGenerator : IEmbeddingGenerato /// The to monitor for cancellation requests. The default is . /// The generated embeddings. /// is . + /// Create embeddings. Task> GenerateAsync( IEnumerable values, EmbeddingGenerationOptions? options = null, diff --git a/src/Libraries/Microsoft.Extensions.AI/ChatCompletion/ChatClientBuilder.cs b/src/Libraries/Microsoft.Extensions.AI/ChatCompletion/ChatClientBuilder.cs index bae7d58e4f9..c557ba524ff 100644 --- a/src/Libraries/Microsoft.Extensions.AI/ChatCompletion/ChatClientBuilder.cs +++ b/src/Libraries/Microsoft.Extensions.AI/ChatCompletion/ChatClientBuilder.cs @@ -66,6 +66,7 @@ public IChatClient Build(IServiceProvider? services = null) /// The client factory function. /// The updated instance. /// is . + /// Pipelines of functionality. public ChatClientBuilder Use(Func clientFactory) { _ = Throw.IfNull(clientFactory); @@ -77,6 +78,7 @@ public ChatClientBuilder Use(Func clientFactory) /// The client factory function. /// The updated instance. /// is . + /// Pipelines of functionality. public ChatClientBuilder Use(Func clientFactory) { _ = Throw.IfNull(clientFactory); @@ -98,10 +100,11 @@ public ChatClientBuilder Use(Func cl /// /// The updated instance. /// - /// This overload may be used when the anonymous implementation needs to provide pre- and/or post-processing, but doesn't + /// This overload can be used when the anonymous implementation needs to provide pre-processing and/or post-processing, but doesn't /// need to interact with the results of the operation, which will come from the inner client. /// /// is . + /// Pipelines of functionality. public ChatClientBuilder Use(Func, ChatOptions?, Func, ChatOptions?, CancellationToken, Task>, CancellationToken, Task> sharedFunc) { _ = Throw.IfNull(sharedFunc); @@ -125,7 +128,7 @@ public ChatClientBuilder Use(Func, ChatOptions?, Func /// The updated instance. /// - /// One or both delegates may be provided. If both are provided, they will be used for their respective methods: + /// One or both delegates can be provided. If both are provided, they will be used for their respective methods: /// will provide the implementation of , and /// will provide the implementation of . /// If only one of the delegates is provided, it will be used for both methods. That means that if @@ -135,6 +138,7 @@ public ChatClientBuilder Use(Func, ChatOptions?, Func will be implemented by combining the updates from . /// /// Both and are . + /// Pipelines of functionality. public ChatClientBuilder Use( Func, ChatOptions?, IChatClient, CancellationToken, Task>? getResponseFunc, Func, ChatOptions?, IChatClient, CancellationToken, IAsyncEnumerable>? getStreamingResponseFunc) diff --git a/src/Libraries/Microsoft.Extensions.AI/ChatCompletion/ChatClientStructuredOutputExtensions.cs b/src/Libraries/Microsoft.Extensions.AI/ChatCompletion/ChatClientStructuredOutputExtensions.cs index 90fe7ac1157..0e7b20bade6 100644 --- a/src/Libraries/Microsoft.Extensions.AI/ChatCompletion/ChatClientStructuredOutputExtensions.cs +++ b/src/Libraries/Microsoft.Extensions.AI/ChatCompletion/ChatClientStructuredOutputExtensions.cs @@ -18,6 +18,7 @@ namespace Microsoft.Extensions.AI; /// /// Provides extension methods on that simplify working with structured output. /// +/// Request a response with structured output. public static class ChatClientStructuredOutputExtensions { private static readonly AIJsonSchemaCreateOptions _inferenceOptions = new() @@ -33,9 +34,8 @@ public static class ChatClientStructuredOutputExtensions /// The chat content to send. /// The chat options to configure the request. /// - /// Optionally specifies whether to set a JSON schema on the . - /// This improves reliability if the underlying model supports native structured output with a schema, but may cause an error if the model does not support it. - /// If not specified, the default value is . + /// to set a JSON schema on the ; otherwise, . The default is . + /// Using a JSON schema improves reliability if the underlying model supports native structured output with a schema, but might cause an error if the model does not support it. /// /// The to monitor for cancellation requests. The default is . /// The response messages generated by the client. @@ -53,14 +53,15 @@ public static Task> GetResponseAsync( /// The text content for the chat message to send. /// The chat options to configure the request. /// - /// Optionally specifies whether to set a JSON schema on the . - /// This improves reliability if the underlying model supports native structured output with a schema, but may cause an error if the model does not support it. + /// to set a JSON schema on the ; otherwise, . + /// Using a JSON schema improves reliability if the underlying model supports native structured output with a schema, but might cause an error if the model does not support it. /// If not specified, the default value is determined by the implementation. /// If a specific value is required, it must be specified by the caller. /// /// The to monitor for cancellation requests. The default is . /// The response messages generated by the client. /// The type of structured output to request. + /// Request a response with structured output. public static Task> GetResponseAsync( this IChatClient chatClient, string chatMessage, @@ -74,9 +75,8 @@ public static Task> GetResponseAsync( /// The chat message to send. /// The chat options to configure the request. /// - /// Optionally specifies whether to set a JSON schema on the . - /// This improves reliability if the underlying model supports native structured output with a schema, but may cause an error if the model does not support it. - /// If not specified, the default value is . + /// to set a JSON schema on the ; otherwise, . The default is . + /// Using a JSON schema improves reliability if the underlying model supports native structured output with a schema, but might cause an error if the model does not support it. /// /// The to monitor for cancellation requests. The default is . /// The response messages generated by the client. @@ -95,9 +95,8 @@ public static Task> GetResponseAsync( /// The JSON serialization options to use. /// The chat options to configure the request. /// - /// Optionally specifies whether to set a JSON schema on the . - /// This improves reliability if the underlying model supports native structured output with a schema, but may cause an error if the model does not support it. - /// If not specified, the default value is . + /// to set a JSON schema on the ; otherwise, . The default is . + /// Using a JSON schema improves reliability if the underlying model supports native structured output with a schema, but might cause an error if the model does not support it. /// /// The to monitor for cancellation requests. The default is . /// The response messages generated by the client. @@ -117,9 +116,8 @@ public static Task> GetResponseAsync( /// The JSON serialization options to use. /// The chat options to configure the request. /// - /// Optionally specifies whether to set a JSON schema on the . - /// This improves reliability if the underlying model supports native structured output with a schema, but may cause an error if the model does not support it. - /// If not specified, the default value is . + /// to set a JSON schema on the ; otherwise, . The default is . + /// Using a JSON schema improves reliability if the underlying model supports native structured output with a schema, but might cause an error if the model does not support it. /// /// The to monitor for cancellation requests. The default is . /// The response messages generated by the client. @@ -139,16 +137,13 @@ public static Task> GetResponseAsync( /// The JSON serialization options to use. /// The chat options to configure the request. /// - /// Optionally specifies whether to set a JSON schema on the . - /// This improves reliability if the underlying model supports native structured output with a schema, but may cause an error if the model does not support it. - /// If not specified, the default value is . + /// to set a JSON schema on the ; otherwise, . The default is . + /// Using a JSON schema improves reliability if the underlying model supports native structured output with a schema, but might cause an error if the model does not support it. /// /// The to monitor for cancellation requests. The default is . /// The response messages generated by the client. /// The type of structured output to request. - /// is . - /// is . - /// is . + /// or or is . public static async Task> GetResponseAsync( this IChatClient chatClient, IEnumerable messages, diff --git a/src/Libraries/Microsoft.Extensions.AI/ChatCompletion/ConfigureOptionsChatClientBuilderExtensions.cs b/src/Libraries/Microsoft.Extensions.AI/ChatCompletion/ConfigureOptionsChatClientBuilderExtensions.cs index d76b2ba1a2e..5f9c2f988c0 100644 --- a/src/Libraries/Microsoft.Extensions.AI/ChatCompletion/ConfigureOptionsChatClientBuilderExtensions.cs +++ b/src/Libraries/Microsoft.Extensions.AI/ChatCompletion/ConfigureOptionsChatClientBuilderExtensions.cs @@ -27,6 +27,7 @@ public static class ConfigureOptionsChatClientBuilderExtensions /// The . /// is . /// is . + /// Provide options. public static ChatClientBuilder ConfigureOptions( this ChatClientBuilder builder, Action configure) {