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

Invalid type definition for BatchResponse.Errors #540

Closed
lawl-dev opened this issue Apr 20, 2024 · 0 comments · Fixed by #541
Closed

Invalid type definition for BatchResponse.Errors #540

lawl-dev opened this issue Apr 20, 2024 · 0 comments · Fixed by #541
Assignees
Labels
bug Something isn't working
Milestone

Comments

@lawl-dev
Copy link

Describe the bug
The BatchResponse.Errors property is currently a List, but according to OpenAI it must be an object with an "object" and a "data" property containing the actual errors.

image

Your code piece

var batchRetrieveResult = await _openAIService.Batch.BatchRetrieve(batchId);

Result
An exception is thrown:

Exception thrown: 'System.Text.Json.JsonException' in System.Private.CoreLib.dll: 'The JSON value could not be converted to System.Collections.Generic.List`1[OpenAI.ObjectModels.ResponseModels.Error].'
   at System.Text.Json.ThrowHelper.ThrowJsonException_DeserializeUnableToConvertValue(Type propertyType)
   at System.Text.Json.Serialization.JsonCollectionConverter`2.OnTryRead(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options, ReadStack& state, TCollection& value)
   at System.Text.Json.Serialization.JsonConverter`1.TryRead(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options, ReadStack& state, T& value, Boolean& isPopulatedValue)
   at System.Text.Json.Serialization.Metadata.JsonPropertyInfo`1.ReadJsonAndSetMember(Object obj, ReadStack& state, Utf8JsonReader& reader)
   at System.Text.Json.Serialization.Converters.ObjectDefaultConverter`1.OnTryRead(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options, ReadStack& state, T& value)
   at System.Text.Json.Serialization.JsonConverter`1.TryRead(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options, ReadStack& state, T& value, Boolean& isPopulatedValue)
   at System.Text.Json.Serialization.JsonConverter`1.ReadCore(Utf8JsonReader& reader, JsonSerializerOptions options, ReadStack& state)
   at System.Text.Json.Serialization.Metadata.JsonTypeInfo`1.ContinueDeserialize(ReadBufferState& bufferState, JsonReaderState& jsonReaderState, ReadStack& readStack)
   at System.Text.Json.Serialization.Metadata.JsonTypeInfo`1.<DeserializeAsync>d__1.MoveNext()
   at System.Threading.Tasks.ValueTask`1.get_Result()
   at System.Net.Http.Json.HttpClientJsonExtensions.<<FromJsonAsyncCore>g__Core|12_0>d`2.MoveNext()
   at OpenAI.Managers.OpenAIService.<BatchRetrieve>d__5.MoveNext()
   at PromptBatchPushPollerWorker.<PollForBatchUpdates>d__9.MoveNext() in 

Expected behavior
No exception is thrown.

@kayhantolga kayhantolga self-assigned this Apr 20, 2024
@kayhantolga kayhantolga added the bug Something isn't working label Apr 20, 2024
@kayhantolga kayhantolga added this to the 8.1.1 milestone Apr 20, 2024
@kayhantolga kayhantolga linked a pull request Apr 20, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants