diff --git a/OpenAI.Playground/OpenAI.Playground.csproj b/OpenAI.Playground/OpenAI.Playground.csproj
index cb29a9d6..f1c61729 100644
--- a/OpenAI.Playground/OpenAI.Playground.csproj
+++ b/OpenAI.Playground/OpenAI.Playground.csproj
@@ -9,12 +9,12 @@
-
+
-
+
diff --git a/OpenAI.Playground/Program.cs b/OpenAI.Playground/Program.cs
index 9f00e90f..d4648a26 100644
--- a/OpenAI.Playground/Program.cs
+++ b/OpenAI.Playground/Program.cs
@@ -25,12 +25,12 @@
var sdk = serviceProvider.GetRequiredService();
//await ModelTestHelper.FetchModelsTest(sdk);
-await EditTestHelper.RunSimpleEditCreateTest(sdk);
+//await EditTestHelper.RunSimpleEditCreateTest(sdk);
//await ImageTestHelper.RunSimpleCreateImageTest(sdk);
//await ImageTestHelper.RunSimpleCreateImageEditTest(sdk);
//await ImageTestHelper.RunSimpleCreateImageVariationTest(sdk);
//await ModerationTestHelper.CreateModerationTest(sdk);
-//await CompletionTestHelper.RunSimpleCompletionTest(sdk);
+await CompletionTestHelper.RunSimpleCompletionTest(sdk);
//await EmbeddingTestHelper.RunSimpleEmbeddingTest(sdk);
//await FileTestHelper.RunSimpleFileTest(sdk);
////await FineTuningTestHelper.CleanUpAllFineTunings(sdk); //!!!!! will delete all fine-tunings
diff --git a/OpenAI.Playground/TestHelpers/CompletionTestHelper.cs b/OpenAI.Playground/TestHelpers/CompletionTestHelper.cs
index 74d60d1b..cab56bd4 100644
--- a/OpenAI.Playground/TestHelpers/CompletionTestHelper.cs
+++ b/OpenAI.Playground/TestHelpers/CompletionTestHelper.cs
@@ -16,6 +16,7 @@ public static async Task RunSimpleCompletionTest(IOpenAIService sdk)
var completionResult = await sdk.Completions.CreateCompletion(new CompletionCreateRequest()
{
Prompt = "Once upon a time",
+ // PromptAsList = new []{"Once upon a time"},
MaxTokens = 5
}, Models.Davinci);
diff --git a/OpenAI.Playground/TestHelpers/EmbeddingTestHelper.cs b/OpenAI.Playground/TestHelpers/EmbeddingTestHelper.cs
index d2f7230c..ad69dbcb 100644
--- a/OpenAI.Playground/TestHelpers/EmbeddingTestHelper.cs
+++ b/OpenAI.Playground/TestHelpers/EmbeddingTestHelper.cs
@@ -15,7 +15,7 @@ public static async Task RunSimpleEmbeddingTest(IOpenAIService sdk)
ConsoleExtensions.WriteLine("Embedding Test:", ConsoleColor.DarkCyan);
var embeddingResult = await sdk.Embeddings.CreateEmbedding(new EmbeddingCreateRequest()
{
- Input = new List {"The quick brown fox jumped over the lazy dog."},
+ InputAsList = new List {"The quick brown fox jumped over the lazy dog."},
Model = Models.TextSearchAdaDocV1
});
diff --git a/OpenAI.SDK/ObjectModels/RequestModels/CompletionCreateRequest.cs b/OpenAI.SDK/ObjectModels/RequestModels/CompletionCreateRequest.cs
index 1a4a7200..7fe09760 100644
--- a/OpenAI.SDK/ObjectModels/RequestModels/CompletionCreateRequest.cs
+++ b/OpenAI.SDK/ObjectModels/RequestModels/CompletionCreateRequest.cs
@@ -18,9 +18,38 @@ public record CompletionCreateRequest : IModelValidate, IOpenAiModels.ITemperatu
/// the model will generate as if from the beginning of a new document.
///
///
- [JsonPropertyName("prompt")]
+ [JsonIgnore]
public string? Prompt { get; set; }
+ ///
+ /// The prompt(s) to generate completions for, encoded as a string, a list of strings, or a list of token lists.
+ /// Note that endoftext is the document separator that the model sees during training, so if a prompt is not specified
+ /// the model will generate as if from the beginning of a new document.
+ ///
+ ///
+ [JsonIgnore]
+ public IList? PromptAsList { get; set; }
+
+ [JsonPropertyName("prompt")]
+ public IList? PromptCalculated
+ {
+ get
+ {
+ if (Prompt != null && PromptAsList != null)
+ {
+ throw new ValidationException("Prompt and PromptAsList can not be assigned at the same time. One of them is should be null.");
+ }
+
+ if (Prompt != null)
+ {
+ return new List() {Prompt};
+ }
+
+
+ return PromptAsList;
+ }
+ }
+
///
/// The suffix that comes after a completion of inserted text.
///
@@ -75,9 +104,33 @@ public record CompletionCreateRequest : IModelValidate, IOpenAiModels.ITemperatu
/// Up to 4 sequences where the API will stop generating further tokens. The returned text will not contain the stop
/// sequence.
///
- [JsonPropertyName("stop")]
public string? Stop { get; set; }
+ ///
+ /// Up to 4 sequences where the API will stop generating further tokens. The returned text will not contain the stop
+ /// sequence.
+ ///
+ public IList? StopAsList { get; set; }
+
+ [JsonPropertyName("stop")]
+ public IList? StopCalculated
+ {
+ get
+ {
+ if (Stop != null && StopAsList != null)
+ {
+ throw new ValidationException("Stop and StopAsList can not be assigned at the same time. One of them is should be null.");
+ }
+
+ if (Stop != null)
+ {
+ return new List() {Stop};
+ }
+
+ return StopAsList;
+ }
+ }
+
///
/// Number between -2.0 and 2.0. Positive values penalize new tokens based on whether they appear in the text so far,
/// increasing the model's likelihood to talk about new topics.
diff --git a/OpenAI.SDK/ObjectModels/RequestModels/CreateModerationRequest.cs b/OpenAI.SDK/ObjectModels/RequestModels/CreateModerationRequest.cs
index 560c0d38..6a7a38b1 100644
--- a/OpenAI.SDK/ObjectModels/RequestModels/CreateModerationRequest.cs
+++ b/OpenAI.SDK/ObjectModels/RequestModels/CreateModerationRequest.cs
@@ -1,16 +1,11 @@
-using System.Text.Json.Serialization;
+using System.ComponentModel.DataAnnotations;
+using System.Text.Json.Serialization;
using OpenAI.GPT3.ObjectModels.SharedModels;
namespace OpenAI.GPT3.ObjectModels.RequestModels
{
public record CreateModerationRequest : IOpenAiModels.IModel
{
- ///
- /// The input text to classify
- ///
- [JsonPropertyName("input")]
- public string Input { get; set; }
-
///
/// Two content moderations models are available: text-moderation-stable and text-moderation-latest.
/// The default is text-moderation-latest which will be automatically upgraded over time. This ensures you are always
@@ -19,5 +14,37 @@ public record CreateModerationRequest : IOpenAiModels.IModel
///
[JsonPropertyName("model")]
public string? Model { get; set; }
+
+ ///
+ /// The input text to classify
+ ///
+ [JsonIgnore]
+ public List? InputAsList { get; set; }
+
+ ///
+ /// The input text to classify
+ ///
+ [JsonIgnore]
+ public string? Input { get; set; }
+
+
+ [JsonPropertyName("input")]
+ public IList? InputCalculated
+ {
+ get
+ {
+ if (Input != null && InputAsList != null)
+ {
+ throw new ValidationException("Input and InputAsList can not be assigned at the same time. One of them is should be null.");
+ }
+
+ if (Input != null)
+ {
+ return new List() {Input};
+ }
+
+ return InputAsList;
+ }
+ }
}
}
\ No newline at end of file
diff --git a/OpenAI.SDK/ObjectModels/RequestModels/EmbeddingCreateRequest.cs b/OpenAI.SDK/ObjectModels/RequestModels/EmbeddingCreateRequest.cs
index f4b875c4..d89148a6 100644
--- a/OpenAI.SDK/ObjectModels/RequestModels/EmbeddingCreateRequest.cs
+++ b/OpenAI.SDK/ObjectModels/RequestModels/EmbeddingCreateRequest.cs
@@ -17,8 +17,39 @@ public record EmbeddingCreateRequest : IModelValidate, IOpenAiModels.IModel
/// observed inferior results when newlines are present.
///
///
+ [JsonIgnore]
+ public List? InputAsList { get; set; }
+
+ ///
+ /// Input text to get embeddings for, encoded as a string or array of tokens. To get embeddings for multiple inputs
+ /// in a single request, pass an array of strings or array of token arrays. Each input must not exceed 2048 tokens in
+ /// length.
+ /// Unless your are embedding code, we suggest replacing newlines (`\n`) in your input with a single space, as we have
+ /// observed inferior results when newlines are present.
+ ///
+ ///
+ [JsonIgnore]
+ public string? Input { get; set; }
+
+
[JsonPropertyName("input")]
- public List? Input { get; set; }
+ public IList? InputCalculated
+ {
+ get
+ {
+ if (Input != null && InputAsList != null)
+ {
+ throw new ValidationException("Input and InputAsList can not be assigned at the same time. One of them is should be null.");
+ }
+
+ if (Input != null)
+ {
+ return new List() {Input};
+ }
+
+ return InputAsList;
+ }
+ }
///
/// ID of the model to use. You can use the [List models](/docs/api-reference/models/list) API to see all of your
diff --git a/OpenAI.SDK/OpenAI.GPT3.csproj b/OpenAI.SDK/OpenAI.GPT3.csproj
index 516301f9..369df09b 100644
--- a/OpenAI.SDK/OpenAI.GPT3.csproj
+++ b/OpenAI.SDK/OpenAI.GPT3.csproj
@@ -9,13 +9,13 @@
https://openai.com/
OpenAI-Betalgo.png
true
- 6.6.0
+ 6.6.1
Tolga Kayhan, Betalgo
Betalgo Up Ltd.
OpenAI GPT-3 and DALL·E dotnet SDK
Dotnet SDK for OpenAI GTP-3 and DALL·E
https://github.com/betalgo/openai/
- openAI,gpt-3,ai,betalgo,NLP,dalle,DALL·E,dall-e
+ openAI,gpt-3,ai,betalgo,NLP,dalle,DALL·E,dall-e,OpenAI,OpenAi,openAi,
Betalgo.$(AssemblyName)
Readme.md
True