Skip to content
This repository was archived by the owner on Feb 12, 2025. It is now read-only.

Commit 7b4aa1b

Browse files
committed
Added attribute "JsonIgnore" for ImageRequestOptions
1 parent 4cf27b0 commit 7b4aa1b

File tree

3 files changed

+6
-2
lines changed

3 files changed

+6
-2
lines changed

ManagedCode.OpenAI/ImageGenerator/Builders/ImageGeneratorRequestBuilder.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ public class ImageGeneratorRequestBuilder
1515
public const string URL_EDITS = "images/generations";
1616

1717
private OpenAIClient _client;
18-
private ImageRequestOptions _request;
18+
private ImageRequestOptions _request = new ImageRequestOptions();
1919

2020
public ImageGeneratorRequestBuilder(OpenAIClient client)
2121
{

ManagedCode.OpenAI/ImageGenerator/Manager/ImageManager.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ public ImageManager<T> Prompt(string prompt)
2626
return this;
2727
}
2828

29-
public async Task<T> GetResultAsStringAsync()
29+
public async Task<T> GetResultAsync()
3030
{
3131

3232
var httpResponseMessage = await _client.PostAsJsonAsync(

ManagedCode.OpenAI/ImageGenerator/Models/ImageRequestOptions.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,19 @@ public class ImageRequestOptions : ICloneable<ImageRequestOptions>, IDeepCloneab
99
[JsonPropertyName("prompt")]
1010
public string Prompt { get; set; }
1111

12+
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
1213
[JsonPropertyName("n")]
1314
public int? N { get; set; }
1415

16+
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
1517
[JsonPropertyName("size")]
1618
public ImageResolution? Size { get; set; }
1719

20+
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
1821
[JsonPropertyName("response_format")]
1922
public ImageFormat? ResponseFormat { get; set; }
2023

24+
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
2125
[JsonPropertyName("user")]
2226
public string? User { get; set; }
2327

0 commit comments

Comments
 (0)