From 7cbe4277724398b921662f38da60702e9544cb5d Mon Sep 17 00:00:00 2001 From: Jeff Handley Date: Fri, 9 May 2025 23:37:18 -0700 Subject: [PATCH] Delete Microsoft.Extensions.AI.Abstractions APIs marked [Obsolete] during preview --- .../ChatCompletion/ChatOptions.cs | 10 --- .../ChatCompletion/ChatResponse.cs | 19 ------ .../ChatCompletion/ChatResponseUpdate.cs | 18 ------ .../EmbeddingGeneratorExtensions.cs | 62 ------------------- 4 files changed, 109 deletions(-) diff --git a/src/Libraries/Microsoft.Extensions.AI.Abstractions/ChatCompletion/ChatOptions.cs b/src/Libraries/Microsoft.Extensions.AI.Abstractions/ChatCompletion/ChatOptions.cs index f2eeffe9dbf..6cf99b01821 100644 --- a/src/Libraries/Microsoft.Extensions.AI.Abstractions/ChatCompletion/ChatOptions.cs +++ b/src/Libraries/Microsoft.Extensions.AI.Abstractions/ChatCompletion/ChatOptions.cs @@ -11,16 +11,6 @@ namespace Microsoft.Extensions.AI; /// Provide options. public class ChatOptions { - /// Gets or sets an optional identifier used to associate a request with an existing conversation. - /// This property is obsolete. Use instead. - [System.Obsolete("Use ConversationId instead.")] - [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] - public string? ChatThreadId - { - get => ConversationId; - set => ConversationId = value; - } - /// Gets or sets an optional identifier used to associate a request with an existing conversation. /// Stateless vs. stateful clients. public string? ConversationId { 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 5e0e80beac9..a342ef1e69e 100644 --- a/src/Libraries/Microsoft.Extensions.AI.Abstractions/ChatCompletion/ChatResponse.cs +++ b/src/Libraries/Microsoft.Extensions.AI.Abstractions/ChatCompletion/ChatResponse.cs @@ -63,25 +63,6 @@ public IList Messages /// Gets or sets the ID of the chat response. public string? ResponseId { get; set; } - /// Gets or sets an identifier for the state of the conversation. - /// - /// Some implementations are capable of storing the state for a conversation, such that - /// the input messages supplied to need only be the additional messages beyond - /// what's already stored. If this property is non-, it represents an identifier for that state, - /// and it should be used in a subsequent instead of supplying the same messages - /// (and this 's message) as part of the messages parameter. Note that the value may - /// 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. - /// - /// This method is obsolete. Use instead. - [Obsolete("Use ConversationId instead.")] - [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] - public string? ChatThreadId - { - get => ConversationId; - set => ConversationId = value; - } - /// Gets or sets an identifier for the state of the conversation. /// /// Some implementations are capable of storing the state for a conversation, such that diff --git a/src/Libraries/Microsoft.Extensions.AI.Abstractions/ChatCompletion/ChatResponseUpdate.cs b/src/Libraries/Microsoft.Extensions.AI.Abstractions/ChatCompletion/ChatResponseUpdate.cs index bdc584596b0..63dbfbc0d7d 100644 --- a/src/Libraries/Microsoft.Extensions.AI.Abstractions/ChatCompletion/ChatResponseUpdate.cs +++ b/src/Libraries/Microsoft.Extensions.AI.Abstractions/ChatCompletion/ChatResponseUpdate.cs @@ -116,24 +116,6 @@ public IList Contents /// public string? MessageId { get; set; } - /// Gets or sets an identifier for the state of the conversation of which this update is a part. - /// - /// Some implementations are capable of storing the state for a conversation, such that - /// the input messages supplied to need only be the additional messages beyond - /// what's already stored. If this property is non-, it represents an identifier for that state, - /// and it should be used in a subsequent instead of supplying the same messages - /// (and this streaming message) as part of the messages parameter. Note that the value may 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. - /// - /// This method is obsolete. Use instead. - [Obsolete("Use ConversationId instead.")] - [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] - public string? ChatThreadId - { - get => ConversationId; - set => ConversationId = value; - } - /// Gets or sets an identifier for the state of the conversation of which this update is a part. /// /// Some implementations are capable of storing the state for a conversation, such that diff --git a/src/Libraries/Microsoft.Extensions.AI.Abstractions/Embeddings/EmbeddingGeneratorExtensions.cs b/src/Libraries/Microsoft.Extensions.AI.Abstractions/Embeddings/EmbeddingGeneratorExtensions.cs index 31f58772abf..895b7bf7ea7 100644 --- a/src/Libraries/Microsoft.Extensions.AI.Abstractions/Embeddings/EmbeddingGeneratorExtensions.cs +++ b/src/Libraries/Microsoft.Extensions.AI.Abstractions/Embeddings/EmbeddingGeneratorExtensions.cs @@ -87,35 +87,6 @@ public static TService GetRequiredService( return service; } - /// Generates an embedding vector from the specified . - /// The type from which embeddings will be generated. - /// The numeric type of the embedding data. - /// The embedding generator. - /// A value from which an embedding will be generated. - /// The embedding generation options to configure the request. - /// The to monitor for cancellation requests. The default is . - /// The generated embedding for the specified . - /// is . - /// is . - /// The generator did not produce exactly one embedding. - /// - /// This operation is equivalent to using and returning the - /// resulting 's property. - /// - /// - /// This method is obsolete. Use instead. - /// - [Obsolete("Use GenerateVectorAsync instead.")] - [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] - public static async Task> GenerateEmbeddingVectorAsync( - this IEmbeddingGenerator> generator, - TInput value, - EmbeddingGenerationOptions? options = null, - CancellationToken cancellationToken = default) - { - return await GenerateVectorAsync(generator, value, options, cancellationToken).ConfigureAwait(false); - } - /// Generates an embedding vector from the specified . /// The type from which embeddings will be generated. /// The numeric type of the embedding data. @@ -141,39 +112,6 @@ public static async Task> GenerateVectorAsync< return embedding.Vector; } - /// Generates an embedding from the specified . - /// The type from which embeddings will be generated. - /// The type of embedding to generate. - /// The embedding generator. - /// A value from which an embedding will be generated. - /// The embedding generation options to configure the request. - /// The to monitor for cancellation requests. The default is . - /// - /// The generated embedding for the specified . - /// - /// is . - /// is . - /// The generator did not produce exactly one embedding. - /// - /// This operations is equivalent to using with a - /// collection composed of the single and then returning the first embedding element from the - /// resulting collection. - /// - /// - /// This method is obsolete. Use instead. - /// - [Obsolete("Use GenerateAsync instead.")] - [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] - public static async Task GenerateEmbeddingAsync( - this IEmbeddingGenerator generator, - TInput value, - EmbeddingGenerationOptions? options = null, - CancellationToken cancellationToken = default) - where TEmbedding : Embedding - { - return await GenerateAsync(generator, value, options, cancellationToken).ConfigureAwait(false); - } - /// Generates an embedding from the specified . /// The type from which embeddings will be generated. /// The type of embedding to generate.