@@ -10,16 +10,16 @@ public class OpenAiProvider : Provider
1010 /// <summary>
1111 ///
1212 /// </summary>
13- public OpenAiApi Api { get ; private set ; }
13+ public OpenAiClient Client { get ; private set ; }
1414
1515 #endregion
1616
1717 #region Constructors
1818
19- public OpenAiProvider ( OpenAiApi openAiApi )
19+ public OpenAiProvider ( OpenAiClient client )
2020 : base ( id : OpenAiConfiguration . SectionName )
2121 {
22- Api = openAiApi ?? throw new ArgumentNullException ( nameof ( openAiApi ) ) ;
22+ Client = client ?? throw new ArgumentNullException ( nameof ( client ) ) ;
2323 }
2424
2525 public OpenAiProvider ( OpenAiConfiguration configuration )
@@ -28,11 +28,11 @@ public OpenAiProvider(OpenAiConfiguration configuration)
2828 configuration = configuration ?? throw new ArgumentNullException ( nameof ( configuration ) ) ;
2929 var apiKey = configuration . ApiKey ?? throw new ArgumentException ( "ApiKey is not defined" , nameof ( configuration ) ) ;
3030
31- Api = configuration . Endpoint != null &&
32- ! string . IsNullOrWhiteSpace ( configuration . Endpoint )
33- ? new OpenAiApi ( baseUri : new Uri ( configuration . Endpoint ) )
34- : new OpenAiApi ( ) ;
35- Api . AuthorizeUsingBearer ( apiKey ) ;
31+ Client = configuration . Endpoint != null &&
32+ ! string . IsNullOrWhiteSpace ( configuration . Endpoint )
33+ ? new OpenAiClient ( baseUri : new Uri ( configuration . Endpoint ) )
34+ : new OpenAiClient ( ) ;
35+ Client . AuthorizeUsingBearer ( apiKey ) ;
3636 ChatSettings = configuration . ChatSettings ;
3737 EmbeddingSettings = configuration . EmbeddingSettings ;
3838 TextToImageSettings = configuration . TextToImageSettings ;
@@ -49,10 +49,10 @@ public OpenAiProvider(
4949 {
5050 apiKey = apiKey ?? throw new ArgumentNullException ( nameof ( apiKey ) ) ;
5151
52- Api = customEndpoint != null
53- ? new OpenAiApi ( baseUri : new Uri ( customEndpoint ) )
54- : new OpenAiApi ( ) ;
55- Api . AuthorizeUsingBearer ( apiKey ) ;
52+ Client = customEndpoint != null
53+ ? new OpenAiClient ( baseUri : new Uri ( customEndpoint ) )
54+ : new OpenAiClient ( ) ;
55+ Client . AuthorizeUsingBearer ( apiKey ) ;
5656 }
5757
5858 #endregion
0 commit comments