diff --git a/Runtime/DataTypes.cs b/Runtime/DataTypes.cs index 392188f..b94e497 100644 --- a/Runtime/DataTypes.cs +++ b/Runtime/DataTypes.cs @@ -97,6 +97,12 @@ public sealed class CreateChatCompletionRequest public Dictionary LogitBias { get; set; } public string User { get; set; } public string SystemFingerprint { get; set; } + public ResponseFormat ResponseFormat { get; set; } + } + + public class ResponseFormat + { + public string Type { get; set; } = ResponseType.Text; } public struct CreateChatCompletionResponse : IResponse @@ -351,6 +357,12 @@ public static class ContentType public const string MultipartFormData = "multipart/form-data"; public const string ApplicationJson = "application/json"; } + + public static class ResponseType + { + public const string Text = "text"; + public const string JsonObject = "json_object"; + } public static class ImageSize { diff --git a/Samples~/ChatGPT/ChatGPT.cs b/Samples~/ChatGPT/ChatGPT.cs index 8060920..29cbf78 100644 --- a/Samples~/ChatGPT/ChatGPT.cs +++ b/Samples~/ChatGPT/ChatGPT.cs @@ -58,7 +58,7 @@ private async void SendReply() // Complete the instruction var completionResponse = await openai.CreateChatCompletion(new CreateChatCompletionRequest() { - Model = "gpt-3.5-turbo-0613", + Model = "gpt-3.5-turbo", Messages = messages }); diff --git a/Samples~/Stream Response/StreamResponse.cs b/Samples~/Stream Response/StreamResponse.cs index a3decc4..90d7bb4 100644 --- a/Samples~/Stream Response/StreamResponse.cs +++ b/Samples~/Stream Response/StreamResponse.cs @@ -1,9 +1,8 @@ -using System; using UnityEngine; using System.Linq; using UnityEngine.UI; -using System.Collections.Generic; using System.Threading; +using System.Collections.Generic; namespace OpenAI { @@ -35,7 +34,7 @@ private void SendMessage() openai.CreateChatCompletionAsync(new CreateChatCompletionRequest() { - Model = "gpt-3.5-turbo-0301", + Model = "gpt-3.5-turbo", Messages = message, Stream = true }, HandleResponse, null, token); diff --git a/Tests/ModelsApiTests.cs b/Tests/ModelsApiTests.cs index 7153df1..549251e 100644 --- a/Tests/ModelsApiTests.cs +++ b/Tests/ModelsApiTests.cs @@ -17,7 +17,7 @@ public async Task List_Models() [Test] public async Task Retrieve_Models() { - var id = "text-davinci-003"; + var id = "gpt-3.5-turbo"; var models = await openai.RetrieveModel(id); Assert.AreEqual(id, models.Id); } diff --git a/package.json b/package.json index 098497a..5ffc81e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "com.srcnalt.openai-unity", - "version": "0.2.0", + "version": "0.2.1", "displayName": "OpenAI Unity", "description": "An unofficial OpenAI Unity package that aims to help you use OpenAI API directly in Unity game engine.", "unity": "2020.3",