-
Notifications
You must be signed in to change notification settings - Fork 433
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add and update Interfaces (for mock testing, etc) and update version …
…to 1.6
- Loading branch information
Showing
13 changed files
with
126 additions
and
72 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
using OpenAI_API.Models; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Threading.Tasks; | ||
|
||
namespace OpenAI_API.Chat | ||
{ | ||
/// <summary> | ||
/// An interface for <see cref="ChatEndpoint"/>, for ease of mock testing, etc | ||
/// </summary> | ||
public interface IChatEndpoint | ||
{ | ||
ChatRequest DefaultChatRequestArgs { get; set; } | ||
|
||
Task<ChatResult> CreateChatCompletionAsync(ChatRequest request); | ||
Task<ChatResult> CreateChatCompletionAsync(ChatRequest request, int numOutputs = 5); | ||
Task<ChatResult> CreateChatCompletionAsync(IList<ChatMessage> messages, Model model = null, double? temperature = null, double? top_p = null, int? numOutputs = null, int? max_tokens = null, double? frequencyPenalty = null, double? presencePenalty = null, IReadOnlyDictionary<string, float> logitBias = null, params string[] stopSequences); | ||
Task<ChatResult> CreateChatCompletionAsync(params ChatMessage[] messages); | ||
Task<ChatResult> CreateChatCompletionAsync(params string[] userMessages); | ||
Conversation CreateConversation(); | ||
Task StreamChatAsync(ChatRequest request, Action<ChatResult> resultHandler); | ||
IAsyncEnumerable<ChatResult> StreamChatEnumerableAsync(ChatRequest request); | ||
IAsyncEnumerable<ChatResult> StreamChatEnumerableAsync(IList<ChatMessage> messages, Model model = null, double? temperature = null, double? top_p = null, int? numOutputs = null, int? max_tokens = null, double? frequencyPenalty = null, double? presencePenalty = null, IReadOnlyDictionary<string, float> logitBias = null, params string[] stopSequences); | ||
Task StreamCompletionAsync(ChatRequest request, Action<int, ChatResult> resultHandler); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
using System.Threading.Tasks; | ||
|
||
namespace OpenAI_API.Images | ||
{ | ||
/// <summary> | ||
/// An interface for <see cref="ImageGenerationEndpoint"/>, for ease of mock testing, etc | ||
/// </summary> | ||
public interface IImageGenerationEndpoint | ||
{ | ||
Task<ImageResult> CreateImageAsync(ImageGenerationRequest request); | ||
Task<ImageResult> CreateImageAsync(string input); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
using System.Threading.Tasks; | ||
|
||
namespace OpenAI_API.Moderation | ||
{ | ||
/// <summary> | ||
/// An interface for <see cref="ModerationEndpoint"/>, for ease of mock testing, etc | ||
/// </summary> | ||
public interface IModerationEndpoint | ||
{ | ||
ModerationRequest DefaultModerationRequestArgs { get; set; } | ||
|
||
Task<ModerationResult> CallModerationAsync(ModerationRequest request); | ||
Task<ModerationResult> CallModerationAsync(string input); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters