Skip to content

Commit b70077e

Browse files
committed
#49 IMPLEMENT IOpenAIApi
1 parent e7d6af5 commit b70077e

File tree

2 files changed

+51
-1
lines changed

2 files changed

+51
-1
lines changed

OpenAI_API/IOpenAIAPI.cs

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
using OpenAI_API.Completions;
2+
using OpenAI_API.Embedding;
3+
using OpenAI_API.Files;
4+
using OpenAI_API.Models;
5+
6+
namespace OpenAI_API
7+
{
8+
/// <summary>
9+
/// Entry point to the OpenAPI API, handling auth and allowing access to the various API endpoints
10+
/// </summary>
11+
public interface IOpenAIAPI
12+
{
13+
/// <summary>
14+
/// Base url for OpenAI
15+
/// for OpenAI, should be "https://api.openai.com/{0}/{1}"
16+
/// for Azure, should be "https://(your-resource-name).openai.azure.com/openai/deployments/(deployment-id)/{1}?api-version={0}"
17+
/// </summary>
18+
string ApiUrlFormat { get; set; }
19+
20+
/// <summary>
21+
/// Version of the Rest Api
22+
/// </summary>
23+
string ApiVersion { get; set; }
24+
25+
/// <summary>
26+
/// The API authentication information to use for API calls
27+
/// </summary>
28+
APIAuthentication Auth { get; set; }
29+
30+
/// <summary>
31+
/// 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).
32+
/// </summary>
33+
CompletionEndpoint Completions { get; }
34+
35+
/// <summary>
36+
/// 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.
37+
/// </summary>
38+
EmbeddingEndpoint Embeddings { get; }
39+
40+
/// <summary>
41+
/// The API endpoint for querying available Engines/models
42+
/// </summary>
43+
ModelsEndpoint Models { get; }
44+
45+
/// <summary>
46+
/// The API lets you do operations with files. You can upload, delete or retrieve files. Files can be used for fine-tuning, search, etc.
47+
/// </summary>
48+
FilesEndpoint Files { get; }
49+
}
50+
}

OpenAI_API/OpenAIAPI.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ namespace OpenAI_API
99
/// <summary>
1010
/// Entry point to the OpenAPI API, handling auth and allowing access to the various API endpoints
1111
/// </summary>
12-
public class OpenAIAPI
12+
public class OpenAIAPI : IOpenAIAPI
1313
{
1414
/// <summary>
1515
/// Base url for OpenAI

0 commit comments

Comments
 (0)