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

Minor Fixes #127

Merged
merged 3 commits into from
Jul 18, 2024
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
12 changes: 12 additions & 0 deletions Runtime/DataTypes.cs
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,12 @@ public sealed class CreateChatCompletionRequest
public Dictionary<string, string> 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
Expand Down Expand Up @@ -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
{
Expand Down
2 changes: 1 addition & 1 deletion Samples~/ChatGPT/ChatGPT.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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
});

Expand Down
5 changes: 2 additions & 3 deletions Samples~/Stream Response/StreamResponse.cs
Original file line number Diff line number Diff line change
@@ -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
{
Expand Down Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion Tests/ModelsApiTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down