Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use interface instead of implementation in Endpoint properties #104

Merged
merged 2 commits into from
Apr 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 22 additions & 4 deletions OpenAI_API/IOpenAIAPI.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
using OpenAI_API.Chat;
using OpenAI_API.Completions;
using OpenAI_API.Embedding;
using OpenAI_API.Files;
using OpenAI_API.Images;
using OpenAI_API.Models;
using OpenAI_API.Moderation;

namespace OpenAI_API
{
Expand All @@ -27,24 +30,39 @@ public interface IOpenAIAPI
/// </summary>
APIAuthentication Auth { get; set; }

/// <summary>
/// Text generation in the form of chat messages. This interacts with the ChatGPT API.
/// </summary>
IChatEndpoint Chat { get; }

/// <summary>
/// Classify text against the OpenAI Content Policy.
/// </summary>
IModerationEndpoint Moderation { get; }

/// <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>
CompletionEndpoint Completions { get; }
ICompletionEndpoint Completions { get; }

/// <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>
EmbeddingEndpoint Embeddings { get; }
IEmbeddingEndpoint Embeddings { get; }

/// <summary>
/// The API endpoint for querying available Engines/models
/// </summary>
ModelsEndpoint Models { get; }
IModelsEndpoint Models { get; }

/// <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>
FilesEndpoint Files { get; }
IFilesEndpoint Files { get; }

/// <summary>
/// The API lets you do operations with images. You can Given a prompt and/or an input image, the model will generate a new image.
/// </summary>
IImageGenerationEndpoint ImageGenerations { get; }
}
}
16 changes: 8 additions & 8 deletions OpenAI_API/OpenAIAPI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -70,36 +70,36 @@ public static OpenAIAPI ForAzure(string YourResourceName, string deploymentId, A
/// <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>
public CompletionEndpoint Completions { get; }
public ICompletionEndpoint Completions { get; }

/// <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>
public EmbeddingEndpoint Embeddings { get; }
public IEmbeddingEndpoint Embeddings { get; }

/// <summary>
/// Text generation in the form of chat messages. This interacts with the ChatGPT API.
/// </summary>
public ChatEndpoint Chat { get; }
public IChatEndpoint Chat { get; }

/// <summary>
/// Classify text against the OpenAI Content Policy.
/// </summary>
public ModerationEndpoint Moderation { get; }
public IModerationEndpoint Moderation { get; }

/// <summary>
/// The API endpoint for querying available Engines/models
/// </summary>
public ModelsEndpoint Models { get; }
public IModelsEndpoint Models { get; }

/// <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>
public FilesEndpoint Files { get; }
public IFilesEndpoint Files { get; }

/// <summary>
/// The API lets you do operations with images. You can Given a prompt and/or an input image, the model will generate a new image.
/// The API lets you do operations with images. Given a prompt and/or an input image, the model will generate a new image.
/// </summary>
public ImageGenerationEndpoint ImageGenerations { get; }
public IImageGenerationEndpoint ImageGenerations { get; }
}
}