Skip to content

Commit

Permalink
com.openai.unity 8.2.5 (#296)
Browse files Browse the repository at this point in the history
- Fixed ResponseObjectFormat deserialization when maxNumberOfResults is null
  • Loading branch information
StephenHodgson authored Sep 14, 2024
1 parent e6c5e97 commit be0c518
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
9 changes: 5 additions & 4 deletions Runtime/Common/FileSearchOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,12 @@ public sealed class FileSearchOptions
[Preserve]
[JsonConstructor]
public FileSearchOptions(
[JsonProperty("max_num_results")] int maxNumberOfResults,
[JsonProperty("max_num_results")] int? maxNumberOfResults,
[JsonProperty("ranking_options")] RankingOptions rankingOptions = null)
{
MaxNumberOfResults = maxNumberOfResults switch
{
null => null,
< 1 => throw new ArgumentOutOfRangeException(nameof(maxNumberOfResults), "Max number of results must be greater than 0."),
> 50 => throw new ArgumentOutOfRangeException(nameof(maxNumberOfResults), "Max number of results must be less than 50."),
_ => maxNumberOfResults
Expand All @@ -25,11 +26,11 @@ public FileSearchOptions(
}

[Preserve]
[JsonProperty("max_num_results")]
public int MaxNumberOfResults { get; }
[JsonProperty("max_num_results", DefaultValueHandling = DefaultValueHandling.Ignore)]
public int? MaxNumberOfResults { get; }

[Preserve]
[JsonProperty("ranking_options")]
[JsonProperty("ranking_options", DefaultValueHandling = DefaultValueHandling.Ignore)]
public RankingOptions RankingOptions { get; }
}
}
2 changes: 1 addition & 1 deletion 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": "8.2.4",
"version": "8.2.5",
"unity": "2021.3",
"documentationUrl": "https://github.com/RageAgainstThePixel/com.openai.unity#documentation",
"changelogUrl": "https://github.com/RageAgainstThePixel/com.openai.unity/releases",
Expand Down

0 comments on commit be0c518

Please sign in to comment.