Skip to content
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
2 changes: 1 addition & 1 deletion OpenAI/Packages/com.openai.unity/Runtime/Chat/Delta.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public Delta(
/// The contents of the message.
/// </summary>
[Preserve]
[JsonProperty("content")]
[JsonProperty("content", DefaultValueHandling = DefaultValueHandling.Populate, NullValueHandling = NullValueHandling.Include)]
public string Content { get; private set; }

/// <summary>
Expand Down
2 changes: 1 addition & 1 deletion OpenAI/Packages/com.openai.unity/Runtime/Chat/Message.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public Message(Role role, string content, string name, Function function)
public Message(Role role, IEnumerable<Content> content, string name = null)
{
Role = role;
Content = content.ToList();
Content = content?.ToList();
Name = name;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public Annotation(
/// The text in the message content that needs to be replaced.
/// </summary>
[Preserve]
[JsonProperty("text")]
[JsonProperty("text", DefaultValueHandling = DefaultValueHandling.Populate, NullValueHandling = NullValueHandling.Include)]
public string Text { get; }

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public CreateMessageRequest(string content, IEnumerable<string> fieldIds = null,
/// The content of the message.
/// </summary>
[Preserve]
[JsonProperty("content")]
[JsonProperty("content", DefaultValueHandling = DefaultValueHandling.Populate, NullValueHandling = NullValueHandling.Include)]
public string Content { get; }

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,9 @@ public sealed class CreateThreadRequest
/// Keys can be a maximum of 64 characters long and values can be a maximum of 512 characters long.
/// </param>
[Preserve]
public CreateThreadRequest(IEnumerable<Message> messages = null,
IReadOnlyDictionary<string, string> metadata = null)
public CreateThreadRequest(
[JsonProperty("messages")] IEnumerable<Message> messages = null,
[JsonProperty("metadata")] IReadOnlyDictionary<string, string> metadata = null)
{
Messages = messages?.ToList();
Metadata = metadata;
Expand All @@ -45,6 +46,7 @@ public CreateThreadRequest(IEnumerable<Message> messages = null,
[JsonProperty("metadata")]
public IReadOnlyDictionary<string, string> Metadata { get; }

[Preserve]
public static implicit operator CreateThreadRequest(string message) => new CreateThreadRequest(new[] { new Message(message) });
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public Message(string content, IEnumerable<string> fileIds = null, IReadOnlyDict
/// The content of the message.
/// </summary>
[Preserve]
[JsonProperty("content")]
[JsonProperty("content", DefaultValueHandling = DefaultValueHandling.Populate, NullValueHandling = NullValueHandling.Include)]
public string Content { get; }

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ namespace OpenAI.Threads
[Preserve]
public sealed class MessageResponse : BaseResponse
{
[Preserve]
[JsonConstructor]
public MessageResponse(
[JsonProperty("id")] string id,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public TextContent(
/// The data that makes up the text.
/// </summary>
[Preserve]
[JsonProperty("value")]
[JsonProperty("value", DefaultValueHandling = DefaultValueHandling.Populate, NullValueHandling = NullValueHandling.Include)]
public string Value { get; }

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ public async Task Test_04_01_UploadAssistantFile()
const string testFilePath = "assistant_test_2.txt";
await File.WriteAllTextAsync(testFilePath, "Knowledge is power!");
Assert.IsTrue(File.Exists(testFilePath));
var file = testAssistant.UploadFileAsync(testFilePath);
var file = await testAssistant.UploadFileAsync(testFilePath);
Assert.IsNotNull(file);
}

Expand All @@ -105,6 +105,7 @@ public async Task Test_04_02_ListAssistantFiles()
var filesList = await testAssistant.ListFilesAsync();
Assert.IsNotNull(filesList);
Assert.IsNotEmpty(filesList.Items);
Assert.IsTrue(filesList.Items.Count == 2);

foreach (var file in filesList.Items)
{
Expand Down
2 changes: 1 addition & 1 deletion OpenAI/Packages/com.openai.unity/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"displayName": "OpenAI",
"description": "A OpenAI package for the Unity Game Engine to use GPT-4, GPT-3.5, GPT-3 and Dall-E though their RESTful API (currently in beta).\n\nIndependently developed, this is not an official library and I am not affiliated with OpenAI.\n\nAn OpenAI API account is required.",
"keywords": [],
"version": "7.1.1",
"version": "7.1.2",
"unity": "2021.3",
"documentationUrl": "https://github.com/RageAgainstThePixel/com.openai.unity#documentation",
"changelogUrl": "https://github.com/RageAgainstThePixel/com.openai.unity/releases",
Expand Down
2 changes: 1 addition & 1 deletion OpenAI/ProjectSettings/ProjectSettings.asset
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ PlayerSettings:
tvOS: 0
overrideDefaultApplicationIdentifier: 1
AndroidBundleVersionCode: 1
AndroidMinSdkVersion: 22
AndroidMinSdkVersion: 25
AndroidTargetSdkVersion: 0
AndroidPreferredInstallLocation: 1
aotOptions:
Expand Down