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..4fc51676 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/Managers/OpenAIEdits.cs b/OpenAI.SDK/Managers/OpenAIEdits.cs
index 0a2d71e1..eac613a3 100644
--- a/OpenAI.SDK/Managers/OpenAIEdits.cs
+++ b/OpenAI.SDK/Managers/OpenAIEdits.cs
@@ -17,6 +17,7 @@ public async Task CreateEdit(EditCreateRequest editCreate, s
{
editCreate.Model = ProcessEngineId(engineId);
}
+
return await _httpClient.PostAndReadAsAsync(_endpointProvider.EditCreate(), editCreate);
}
}
\ No newline at end of file
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..08f20b57 100644
--- a/OpenAI.SDK/ObjectModels/RequestModels/CreateModerationRequest.cs
+++ b/OpenAI.SDK/ObjectModels/RequestModels/CreateModerationRequest.cs
@@ -1,4 +1,5 @@
-using System.Text.Json.Serialization;
+using System.ComponentModel.DataAnnotations;
+using System.Text.Json.Serialization;
using OpenAI.GPT3.ObjectModels.SharedModels;
namespace OpenAI.GPT3.ObjectModels.RequestModels
@@ -8,8 +9,34 @@ public record CreateModerationRequest : IOpenAiModels.IModel
///
/// 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 string 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;
+ }
+ }
///
/// Two content moderations models are available: text-moderation-stable and text-moderation-latest.
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
diff --git a/Readme.md b/Readme.md
index d7828c6b..c8ef504c 100644
--- a/Readme.md
+++ b/Readme.md
@@ -109,6 +109,17 @@ As you can guess I do not accept any damage caused by use of the library. You ar
## Changelog
+### 6.6.1
+* **Breaking change**.
+ * `EmbeddingCreateRequest.Input` was a ***string list*** type now it is a ***string*** type.
+ I have introduced `InputAsList` property instead of `Input`. You may need to update your code according the change.
+ ***Both Input(string) and InputAsList(string list) avaliable for use***
+
+* Added string and string List support for some of the propertis.
+ * CompletionCreateRequest --> Prompt & PromptAsList / Stop & StopAsList
+ * CreateModerationRequest --> Input & InputAsList
+ * EmbeddingCreateRequest --> Input & InputAsList
+
### 6.6.0
* Added support for new models (davinciv3 & edit models)
* Added support for Edit endpoint.