File tree Expand file tree Collapse file tree 2 files changed +17
-1
lines changed
Expand file tree Collapse file tree 2 files changed +17
-1
lines changed Original file line number Diff line number Diff line change 77/// </summary>
88static class ChatClientExtensions
99{
10+ #if NET9_0_OR_GREATER
11+ [ System . Runtime . CompilerServices . OverloadResolutionPriorityAttribute ( 100 ) ]
12+ #endif
1013 /// <summary>Gets an <see cref="IChatClient"/> for use with this <see cref="ChatClient"/>.</summary>
1114 public static IChatClient AsIChatClient ( this ChatClient client ) =>
1215 client as IChatClient ?? OpenAIClientExtensions . AsIChatClient ( client ) ;
Original file line number Diff line number Diff line change 1- using System . Text . Json . Nodes ;
1+ using System . ClientModel ;
2+ using System . Text . Json . Nodes ;
23using Devlooped . Extensions . AI . OpenAI ;
34using Microsoft . Extensions . AI ;
45using OpenAI ;
@@ -9,6 +10,18 @@ namespace Devlooped.Extensions.AI;
910
1011public class OpenAITests ( ITestOutputHelper output )
1112{
13+ [ SecretsFact ( "OPENAI_API_KEY" ) ]
14+ public void CanGetAsIChatClient ( )
15+ {
16+ var inner = new OpenAIClient ( new ApiKeyCredential ( Configuration [ "OPENAI_API_KEY" ] ! ) ,
17+ new OpenAIClientOptions
18+ {
19+ //Endpoint = new Uri("https://api.x.ai/v1"),
20+ } ) . GetChatClient ( "grok-4" ) . AsIChatClient ( ) ;
21+
22+ Assert . NotNull ( inner ) ;
23+ }
24+
1225 [ SecretsFact ( "OPENAI_API_KEY" ) ]
1326 public async Task OpenAISwitchesModel ( )
1427 {
You can’t perform that action at this time.
0 commit comments