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

Create transcription request results in a No JSON content found error #78

Closed KenjiPcx closed 11 months ago

KenjiPcx commented 11 months ago

Describe the bug Create transcription request is not working on il2cpp, I am getting this error message when a request is sent, seems like a Newtonsoft json issue, was wondering if anyone had encountered it

image
"Newtonsoft.Json.JsonSerializationException: No JSON content found and type \'OpenAI.CreateAudioResponse\' is not nullable. Path \'\', line 0, position 0.\n  at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize (Newtonsoft.Json.JsonReader reader, System.Type objectType, System.Boolean checkAdditionalContent) [0x00057] in C:\\Users\\Adrien\\Workspace\\Newtonsoft\\Newtonsoft.Json-for-Unity-Pedro\\Src\\Newtonsoft.Json\\Serialization\\JsonSerializerInternalReader.cs:159 \n  at Newtonsoft.Json.JsonSerializer.DeserializeInternal (Newtonsoft.Json.JsonReader reader, System.Type objectType) [0x00054] in C:\\Users\\Adrien\\Workspace\\Newtonsoft\\Newtonsoft.Json-for-Unity-Pedro\\Src\\Newtonsoft.Json\\JsonSerializer.cs:904 \n  at Newtonsoft.Json.JsonSerializer.Deserialize (Newtonsoft.Json.JsonReader reader, System.Type objectType) [0x00003] in C:\\Users\\Adrien\\Workspace\\Newtonsoft\\Newtonsoft.Json-for-Unity-Pedro\\Src\\Newtonsoft.Json\\JsonSerializer.cs:883 \n  at Newtonsoft.Json.JsonConvert.DeserializeObject (System.String value, System.Type type, Newtonsoft.Json.JsonSerializerSettings settings) [0x00030] in C:\\Users\\Adrien\\Workspace\\Newtonsoft\\Newtonsoft.Json-for-Unity-Pedro\\Src\\Newtonsoft.Json\\JsonConvert.cs:831 \n  at Newtonsoft.Json.JsonConvert.DeserializeObject[T] (System.String value, Newtonsoft.Json.JsonSerializerSettings settings) [0x0000c] in C:\\Users\\Adrien\\Workspace\\Newtonsoft\\Newtonsoft.Json-for-Unity-Pedro\\Src\\Newtonsoft.Json\\JsonConvert.cs:787 \n  at OpenAI.OpenAIApi.DispatchRequest[T] (System.String path, System.Collections.Generic.List`1[T] form) [0x00166] in C:\\Users\\kenpc\\Unity\\TheSafeOne\\Library\\PackageCache\\com.srcnalt.openai-unity@d2a258ab0c\\Runtime\\OpenAIApi.cs:177

To Reproduce Steps to reproduce the behavior:

  1. Run the transcription sample, add a try catch on the createTranscriptionRequest line first
  2. Run the debugger, or check if it gets stuck
  3. See error

Expected behavior It should not throw an error

Environment (please complete the following information):

KenjiPcx commented 11 months ago

My bad, I'm just an idiot, didn't realize I was connected to a broken internet connection

srcnalt commented 11 months ago

No worries, maybe wrapping requests to an internet connection check makes sense.