wit-ai / wit

Natural Language Interface for apps and devices
https://wit.ai/
931 stars 91 forks source link

400 Response using Latin (LA) wit app with Oculus Unity SDK #2255

Closed n33kos closed 1 year ago

n33kos commented 2 years ago

Do you want to request a feature, report a bug, or ask a question about wit? bug

What is the current behavior? Currently, it appears requests from Oculus Voice SDK for a wit app using the Latin (LA) language are returning a 400 error.

If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem.

  1. Follow instructions to set up the basic tutorial: https://developer.oculus.com/experimental/voice-sdk-tutorials-1/
  2. Create and configure a Latin language wit app in unity
  3. Attempt to call AppVoiceExperience.Activate() and begin speaking
  4. A 400 error is returned and logged to the console with the following stacktrace:
    The remote server returned an error: (400) Bad Request.
    Request Stack Trace:
    at System.Environment.get_StackTrace () [0x00000] in <695d1cc93cca45069c528c15c9fdd749>:0 
    at Facebook.WitAi.WitRequest.Request () [0x00033] in C:\MyProject\Assets\Oculus\Voice\Lib\Wit.ai\Scripts\Runtime\WitRequest.cs:212 
    at Facebook.WitAi.Wit.ActivateImmediately (Facebook.WitAi.Configuration.WitRequestOptions requestOptions) [0x000d8] in C:\MyProject\Assets\Oculus\Voice\Lib\Wit.ai\Scripts\Runtime\Wit.cs:374 
    at Facebook.WitAi.Wit.OnSampleReady (System.Int32 sampleCount, System.Single[] sample, System.Single levelMax) [0x001e5] in C:\MyProject\Assets\Oculus\Voice\Lib\Wit.ai\Scripts\Runtime\Wit.cs:225 
    at Facebook.WitAi.Lib.Mic+<ReadRawAudio>d__55.MoveNext () [0x0012e] in C:\MyProject\Assets\Oculus\Voice\Lib\Wit.ai\Scripts\Runtime\Lib\Mic.cs:301 
    at UnityEngine.SetupCoroutine.InvokeMoveNext (System.Collections.IEnumerator enumerator, System.IntPtr returnValueAddress) [0x00000] in <07c89f7520694139991332d3cf930d48>:0 
    Response Stack Trace:
    at System.Net.HttpWebRequest+<GetResponseFromData>d__240.MoveNext () [0x00152] in <0463b2ef957545c0a51b42f372cd4fbb>:0 
    --- End of stack trace from previous location where exception was thrown ---
    at System.Net.HttpWebRequest.EndGetResponse (System.IAsyncResult asyncResult) [0x0001d] in <0463b2ef957545c0a51b42f372cd4fbb>:0 
    at Facebook.WitAi.WitRequest.HandleResponse (System.IAsyncResult ar) [0x00000] in C:\MyProject\Assets\Oculus\Voice\Lib\Wit.ai\Scripts\Runtime\WitRequest.cs:312 
    UnityEngine.Debug:LogError (object)
    Facebook.WitAi.WitRequest:HandleResponse (System.IAsyncResult) (at Assets/Oculus/Voice/Lib/Wit.ai/Scripts/Runtime/WitRequest.cs:375)
    System.Threading._ThreadPoolWaitCallback:PerformWaitCallback ()
  5. Change wit app configuration to use English (EN) app.
  6. Attempt to call AppVoiceExperience.Activate() and begin speaking
  7. Verify that the English language app successfully returns results.

What is the expected behavior? When using Oculus Voice SDK with a Latin (LA) wit app, results are returned without a 400 error.

If applicable, what is the App ID where you are experiencing this issue? If you do not provide this, we cannot help. Latin App Id (Returns 400 error): 3068334726810678 English App Id (Working): 456028309276106

Additional Notes

n33kos commented 2 years ago

I looked into this a bit more deeply in an attempt to unblock myself and tested a cURL request with a sample audio file. This time I received a much more useful error message, it appears the unity plugin doesn't log out the response JSON body on errors:

$ curl -XPOST 'https://api.wit.ai/speech?v=20211121' \
>   -i -L \
>   -H 'Authorization: Bearer $TOKEN' \
>   -H "Content-Type: audio/wav" \
>   --data-binary "@TEST.wav"
HTTP/1.1 100 Continue
Date: Sun, 21 Nov 2021 21:53:40 GMT

HTTP/1.1 400 Bad Request
Content-Type: application/json
Date: Sun, 21 Nov 2021 21:53:40 GMT
Connection: keep-alive
Content-Length: 94

{
  "code": "bad-request",
  "error": "Speech recognition is not supported for language: la"
}

This is a much more definitive error message. I'm hoping to develop an app which recognizes Latin so this is a lynchpin for using wit as the underlying technology. Are there any plans on the roadmap to support speech recognition for the Latin language?

Barbog commented 1 year ago

Closing due to no movement on the issue. Please re-open or file a new task should the issue be persisting.