srcnalt / OpenAI-Unity

An unofficial OpenAI Unity Package that aims to help you use OpenAI API directly in Unity Game engine.
MIT License
648 stars 144 forks source link

JsonSerializationException: Could not find member 'warning' on object of type 'CreateChatCompletionResponse'. Path 'warning', line 2, position 12. #74

Closed u431535 closed 12 months ago

u431535 commented 1 year ago
  1. I use this to run is okay on July 11 & 12 (Taipei time).
  2. but run it to have error on July 13 (Taipei time), even I create new unity project (pure) to test/run. Error log: JsonSerializationException: Could not find member 'warning' on object of type 'CreateChatCompletionResponse'. Path 'warning', line 2, position 12. Newtonsoft.Json.Serialization.JsonSerializerInternalReader.PopulateObject (System.Object newObject, Newtonsoft.Json.JsonReader reader, Newtonsoft.Json.Serialization.JsonObjectContract contract, Newtonsoft.Json.Serialization.JsonProperty member, System.String id) (at <761cf2a144514d2291a678c334d49e9b>:0) Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateObject (Newtonsoft.Json.JsonReader reader, System.Type objectType, Newtonsoft.Json.Serialization.JsonContract contract, Newtonsoft.Json.Serialization.JsonProperty member, Newtonsoft.Json.Serialization.JsonContainerContract containerContract, Newtonsoft.Json.Serialization.JsonProperty containerMember, System.Object existingValue) (at <761cf2a144514d2291a678c334d49e9b>:0) Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateValueInternal (Newtonsoft.Json.JsonReader reader, System.Type objectType, Newtonsoft.Json.Serialization.JsonContract contract, Newtonsoft.Json.Serialization.JsonProperty member, Newtonsoft.Json.Serialization.JsonContainerContract containerContract, Newtonsoft.Json.Serialization.JsonProperty containerMember,

Environment (please complete the following information):

errorLog

Radlad-io commented 1 year ago

Bump. Same thing started happening to a project I have deployed.

Seems related to issue #53.

Radlad-io commented 1 year ago

I found a hot fix. I added the following to packages/runtime/DataTypes.cs > CreateChatCompletionResponse struct.

public string warning { get; set; }
BillO57 commented 1 year ago

Under what method are you placing that?

Radlad-io commented 1 year ago

The CreateChatCompletionResponse struct. I'll edit my comment to reflect this.

maiconcurriel commented 1 year ago

in your project, find for DataTypes, inside Packages>OpenAI Unity> Runtime

public struct CreateChatCompletionResponse : IResponse { public ApiError Error { get; set; } public string Model { get; set; } public string Id { get; set; } public string Object { get; set; } public long Created { get; set; } public List Choices { get; set; } public Usage Usage { get; set; }
public string warning { get; set; } }

BillO57 commented 1 year ago

Thank you! That fixed the issue.

srcnalt commented 12 months ago

Sorry for the late response folks. I've been away for a while. A version with the fix is released #75

BillO57 commented 12 months ago

No problem, I really appreciate all that you have done here and on your YouTube channel.