You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
/// <exception cref="AuthenticationException">Thrown if there is no valid authentication. Please refer to <see href="https://github.com/OkGoDoIt/OpenAI-API-dotnet#authentication"/> for details.</exception>
thrownewAuthenticationException("You must provide API authentication. Please refer to https://github.com/OkGoDoIt/OpenAI-API-dotnet#authentication for details.");
/// <summary>Entry point to the OpenAPI API, handling auth and allowing access to the various API endpoints</summary>
9
+
publicinterfaceIOpenAI
10
+
{
11
+
/// <summary>Text generation is the core function of the API. You give the API a prompt, and it generates a completion. The way you “program” the API to do a task is by simply describing the task in plain english or providing a few written examples. This simple approach works for a wide range of use cases, including summarization, translation, grammar correction, question answering, chatbots, composing emails, and much more (see the prompt library for inspiration).</summary>
12
+
publicCompletionEndpointCompletions{get;}
13
+
14
+
/// <summary>The API lets you transform text into a vector (list) of floating point numbers. The distance between two vectors measures their relatedness. Small distances suggest high relatedness and large distances suggest low relatedness.</summary>
15
+
publicEmbeddingEndpointEmbeddings{get;}
16
+
17
+
/// <summary>The API endpoint for querying available Engines/models</summary>
18
+
publicModelsEndpointModels{get;}
19
+
20
+
/// <summary>The API lets you do operations with files. You can upload, delete or retrieve files. Files can be used for fine-tuning, search, etc.</summary>
/// The API authentication information to use for API calls
20
-
/// </summary>
21
-
publicAPIAuthenticationAuth{get;set;}
22
19
23
-
/// <summary>
24
-
/// Creates a new entry point to the OpenAPI API, handling auth and allowing access to the various API endpoints
25
-
/// </summary>
26
-
/// <param name="apiKeys">The API authentication information to use for API calls, or <see langword="null"/> to attempt to use the <see cref="APIAuthentication.Default"/>, potentially loading from environment vars or from a config file.</param>
27
-
publicOpenAIAPI(APIAuthenticationapiKeys=null)
20
+
/// <summary>The HTTP client configured with the authentication headers.</summary>
21
+
internalHttpClientClient{get;}
22
+
23
+
/// <summary>
24
+
/// Creates a new entry point to the OpenAPI API, handling auth and allowing access to the various API endpoints
25
+
/// </summary>
26
+
/// <param name="httpClient">The HTTP client configured with the authentication headers.</param>
27
+
publicOpenAIAPI(
28
+
HttpClienthttpClient)
28
29
{
29
-
this.Auth=apiKeys.ThisOrDefault();
30
-
Completions=newCompletionEndpoint(this);
31
-
Models=newModelsEndpoint(this);
32
-
Files=newFilesEndpoint(this);
33
-
Embeddings=newEmbeddingEndpoint(this);
30
+
this.Client=httpClient;
31
+
this.Completions=newCompletionEndpoint(this);
32
+
this.Models=newModelsEndpoint(this);
33
+
this.Files=newFilesEndpoint(this);
34
+
this.Embeddings=newEmbeddingEndpoint(this);
34
35
}
35
36
36
37
/// <summary>
@@ -52,8 +53,5 @@ public OpenAIAPI(APIAuthentication apiKeys = null)
52
53
/// The API lets you do operations with files. You can upload, delete or retrieve files. Files can be used for fine-tuning, search, etc.
0 commit comments