Skip to content

Commit

Permalink
OpenAI-DotNet 8.2.5
Browse files Browse the repository at this point in the history
- Fixed ResponseObjectFormat deserialization when maxNumberOfResults is null
  • Loading branch information
StephenHodgson committed Sep 14, 2024
1 parent 455c361 commit 364d415
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
7 changes: 5 additions & 2 deletions OpenAI-DotNet/Common/FileSearchOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,11 @@ public sealed class FileSearchOptions
{
public FileSearchOptions() { }

public FileSearchOptions(int maxNumberOfResults, RankingOptions rankingOptions = null)
public FileSearchOptions(int? maxNumberOfResults, 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 @@ -22,10 +23,12 @@ public FileSearchOptions(int maxNumberOfResults, RankingOptions rankingOptions =

[JsonInclude]
[JsonPropertyName("max_num_results")]
public int MaxNumberOfResults { get; private set; }
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
public int? MaxNumberOfResults { get; private set; }

[JsonInclude]
[JsonPropertyName("ranking_options")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
public RankingOptions RankingOptions { get; private set; }
}
}
4 changes: 3 additions & 1 deletion OpenAI-DotNet/OpenAI-DotNet.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,10 @@ More context [on Roger Pincombe's blog](https://rogerpincombe.com/openai-dotnet-
<AssemblyOriginatorKeyFile>OpenAI-DotNet.pfx</AssemblyOriginatorKeyFile>
<IncludeSymbols>true</IncludeSymbols>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<Version>8.2.4</Version>
<Version>8.2.5</Version>
<PackageReleaseNotes>
Version 8.2.5
- Fixed ResponseObjectFormat deserialization when maxNumberOfResults is null
Version 8.2.4
- Fixed ResponseObjectFormat deserialization when set to auto
- Added RankingOptions to FileSearchOptions
Expand Down

0 comments on commit 364d415

Please sign in to comment.