44using Microsoft . Extensions . AI ;
55using OpenAI ;
66
7- namespace Devlooped . Extensions . AI ;
7+ namespace Devlooped . Extensions . AI . Grok ;
88
99/// <summary>
1010/// Provides an OpenAI compability client for Grok. It's recommended you
@@ -26,7 +26,7 @@ public class GrokClient(string apiKey, OpenAIClientOptions? options = null)
2626 /// Returns an adapter that surfaces an <see cref="IChatClient"/> interface that
2727 /// can be used directly in the <see cref="ChatClientBuilder"/> pipeline builder.
2828 /// </summary>
29- public override OpenAI . Chat . ChatClient GetChatClient ( string model ) => new GrokChatClientAdapter ( this , model ) ;
29+ public override global :: OpenAI . Chat . ChatClient GetChatClient ( string model ) => new GrokChatClientAdapter ( this , model ) ;
3030
3131 static OpenAIClientOptions EnsureEndpoint ( OpenAIClientOptions ? options )
3232 {
@@ -39,7 +39,7 @@ static OpenAIClientOptions EnsureEndpoint(OpenAIClientOptions? options)
3939 // OpenAI in MEAI docs. Most typical case would be to just create an <see cref="GrokChatClient"/> directly.
4040 // This throws on any non-IChatClient invoked methods in the AsIChatClient adapter, and
4141 // forwards the IChatClient methods to the GrokChatClient implementation which is cached per client.
42- class GrokChatClientAdapter ( GrokClient client , string model ) : OpenAI . Chat . ChatClient , IChatClient
42+ class GrokChatClientAdapter ( GrokClient client , string model ) : global :: OpenAI . Chat . ChatClient , IChatClient
4343 {
4444 void IDisposable . Dispose ( ) { }
4545
@@ -60,36 +60,36 @@ IAsyncEnumerable<ChatResponseUpdate> IChatClient.GetStreamingResponseAsync(IEnum
6060 => client . GetChatClientImpl ( options ? . ModelId ?? model ) . GetStreamingResponseAsync ( messages , options , cancellation ) ;
6161
6262 // These are the only two methods actually invoked by the AsIChatClient adapter from M.E.AI.OpenAI
63- public override Task < ClientResult < OpenAI . Chat . ChatCompletion > > CompleteChatAsync ( IEnumerable < OpenAI . Chat . ChatMessage > ? messages , OpenAI . Chat . ChatCompletionOptions ? options = null , CancellationToken cancellationToken = default )
63+ public override Task < ClientResult < global :: OpenAI . Chat . ChatCompletion > > CompleteChatAsync ( IEnumerable < global :: OpenAI . Chat . ChatMessage > ? messages , global :: OpenAI . Chat . ChatCompletionOptions ? options = null , CancellationToken cancellationToken = default )
6464 => throw new NotSupportedException ( $ "Consume directly as an { nameof ( IChatClient ) } instead of invoking { nameof ( OpenAIClientExtensions . AsIChatClient ) } on this instance.") ;
6565
66- public override AsyncCollectionResult < OpenAI . Chat . StreamingChatCompletionUpdate > CompleteChatStreamingAsync ( IEnumerable < OpenAI . Chat . ChatMessage > ? messages , OpenAI . Chat . ChatCompletionOptions ? options = null , CancellationToken cancellationToken = default )
66+ public override AsyncCollectionResult < global :: OpenAI . Chat . StreamingChatCompletionUpdate > CompleteChatStreamingAsync ( IEnumerable < global :: OpenAI . Chat . ChatMessage > ? messages , global :: OpenAI . Chat . ChatCompletionOptions ? options = null , CancellationToken cancellationToken = default )
6767 => throw new NotSupportedException ( $ "Consume directly as an { nameof ( IChatClient ) } instead of invoking { nameof ( OpenAIClientExtensions . AsIChatClient ) } on this instance.") ;
6868
6969 #region Unsupported
7070
7171 public override ClientResult CompleteChat ( BinaryContent ? content , RequestOptions ? options = null )
7272 => throw new NotSupportedException ( $ "Consume directly as an { nameof ( IChatClient ) } .") ;
7373
74- public override ClientResult < OpenAI . Chat . ChatCompletion > CompleteChat ( IEnumerable < OpenAI . Chat . ChatMessage > ? messages , OpenAI . Chat . ChatCompletionOptions ? options = null , CancellationToken cancellationToken = default )
74+ public override ClientResult < global :: OpenAI . Chat . ChatCompletion > CompleteChat ( IEnumerable < global :: OpenAI . Chat . ChatMessage > ? messages , global :: OpenAI . Chat . ChatCompletionOptions ? options = null , CancellationToken cancellationToken = default )
7575 => throw new NotSupportedException ( $ "Consume directly as an { nameof ( IChatClient ) } .") ;
7676
77- public override ClientResult < OpenAI . Chat . ChatCompletion > CompleteChat ( params OpenAI . Chat . ChatMessage [ ] messages )
77+ public override ClientResult < global :: OpenAI . Chat . ChatCompletion > CompleteChat ( params global :: OpenAI . Chat . ChatMessage [ ] messages )
7878 => throw new NotSupportedException ( $ "Consume directly as an { nameof ( IChatClient ) } .") ;
7979
8080 public override Task < ClientResult > CompleteChatAsync ( BinaryContent ? content , RequestOptions ? options = null )
8181 => throw new NotSupportedException ( $ "Consume directly as an { nameof ( IChatClient ) } .") ;
8282
83- public override Task < ClientResult < OpenAI . Chat . ChatCompletion > > CompleteChatAsync ( params OpenAI . Chat . ChatMessage [ ] messages )
83+ public override Task < ClientResult < global :: OpenAI . Chat . ChatCompletion > > CompleteChatAsync ( params global :: OpenAI . Chat . ChatMessage [ ] messages )
8484 => throw new NotSupportedException ( $ "Consume directly as an { nameof ( IChatClient ) } .") ;
8585
86- public override CollectionResult < OpenAI . Chat . StreamingChatCompletionUpdate > CompleteChatStreaming ( IEnumerable < OpenAI . Chat . ChatMessage > ? messages , OpenAI . Chat . ChatCompletionOptions ? options = null , CancellationToken cancellationToken = default )
86+ public override CollectionResult < global :: OpenAI . Chat . StreamingChatCompletionUpdate > CompleteChatStreaming ( IEnumerable < global :: OpenAI . Chat . ChatMessage > ? messages , global :: OpenAI . Chat . ChatCompletionOptions ? options = null , CancellationToken cancellationToken = default )
8787 => throw new NotSupportedException ( $ "Consume directly as an { nameof ( IChatClient ) } .") ;
8888
89- public override CollectionResult < OpenAI . Chat . StreamingChatCompletionUpdate > CompleteChatStreaming ( params OpenAI . Chat . ChatMessage [ ] messages )
89+ public override CollectionResult < global :: OpenAI . Chat . StreamingChatCompletionUpdate > CompleteChatStreaming ( params global :: OpenAI . Chat . ChatMessage [ ] messages )
9090 => throw new NotSupportedException ( $ "Consume directly as an { nameof ( IChatClient ) } .") ;
9191
92- public override AsyncCollectionResult < OpenAI . Chat . StreamingChatCompletionUpdate > CompleteChatStreamingAsync ( params OpenAI . Chat . ChatMessage [ ] messages )
92+ public override AsyncCollectionResult < global :: OpenAI . Chat . StreamingChatCompletionUpdate > CompleteChatStreamingAsync ( params global :: OpenAI . Chat . ChatMessage [ ] messages )
9393 => throw new NotSupportedException ( $ "Consume directly as an { nameof ( IChatClient ) } .") ;
9494
9595 #endregion
0 commit comments