11// Licensed to the .NET Foundation under one or more agreements.
22// The .NET Foundation licenses this file to you under the MIT license.
33
4- using System ;
5- using System . ComponentModel ;
64using System . Diagnostics . CodeAnalysis ;
7- using Microsoft . Shared . Diagnostics ;
85using OpenAI ;
96using OpenAI . Audio ;
107using OpenAI . Chat ;
@@ -16,15 +13,6 @@ namespace Microsoft.Extensions.AI;
1613/// <summary>Provides extension methods for working with <see cref="OpenAIClient"/>s.</summary>
1714public static class OpenAIClientExtensions
1815{
19- /// <summary>Gets an <see cref="IChatClient"/> for use with this <see cref="OpenAIClient"/>.</summary>
20- /// <param name="openAIClient">The client.</param>
21- /// <param name="modelId">The model.</param>
22- /// <returns>An <see cref="IChatClient"/> that can be used to converse via the <see cref="OpenAIClient"/>.</returns>
23- [ EditorBrowsable ( EditorBrowsableState . Never ) ]
24- [ Obsolete ( "This method will be removed in an upcoming release." ) ]
25- public static IChatClient AsChatClient ( this OpenAIClient openAIClient , string modelId ) =>
26- new OpenAIChatClient ( Throw . IfNull ( openAIClient ) . GetChatClient ( modelId ) ) ;
27-
2816 /// <summary>Gets an <see cref="IChatClient"/> for use with this <see cref="ChatClient"/>.</summary>
2917 /// <param name="chatClient">The client.</param>
3018 /// <returns>An <see cref="IChatClient"/> that can be used to converse via the <see cref="ChatClient"/>.</returns>
@@ -44,16 +32,6 @@ public static IChatClient AsIChatClient(this OpenAIResponseClient responseClient
4432 public static ISpeechToTextClient AsISpeechToTextClient ( this AudioClient audioClient ) =>
4533 new OpenAISpeechToTextClient ( audioClient ) ;
4634
47- /// <summary>Gets an <see cref="IEmbeddingGenerator{String, Single}"/> for use with this <see cref="OpenAIClient"/>.</summary>
48- /// <param name="openAIClient">The client.</param>
49- /// <param name="modelId">The model to use.</param>
50- /// <param name="dimensions">The number of dimensions to generate in each embedding.</param>
51- /// <returns>An <see cref="IEmbeddingGenerator{String, Embedding}"/> that can be used to generate embeddings via the <see cref="EmbeddingClient"/>.</returns>
52- [ EditorBrowsable ( EditorBrowsableState . Never ) ]
53- [ Obsolete ( "This method will be removed in an upcoming release." ) ]
54- public static IEmbeddingGenerator < string , Embedding < float > > AsEmbeddingGenerator ( this OpenAIClient openAIClient , string modelId , int ? dimensions = null ) =>
55- new OpenAIEmbeddingGenerator ( Throw . IfNull ( openAIClient ) . GetEmbeddingClient ( modelId ) , dimensions ) ;
56-
5735 /// <summary>Gets an <see cref="IEmbeddingGenerator{String, Single}"/> for use with this <see cref="EmbeddingClient"/>.</summary>
5836 /// <param name="embeddingClient">The client.</param>
5937 /// <param name="defaultModelDimensions">The number of dimensions to generate in each embedding.</param>
0 commit comments