dvcrn / ex_openai

Auto-generated Elixir SDK for OpenAI APIs with full typespecs, docs and streaming support
MIT License
71 stars 27 forks source link

fix: handle raw binary (audio) data when processing response body #18

Closed francoabaroa closed 3 months ago

francoabaroa commented 6 months ago

When creating audio speech (TTS), OpenAI returns binary data. Add a check to see if you leave it as is, or decode JSON if necessary

dvcrn commented 6 months ago

Thanks for catching this!

dvcrn commented 6 months ago

Hrrmm, let me figure out why the tests are suddenly breaking before merging this

dvcrn commented 5 months ago

Continuing in https://github.com/dvcrn/ex_openai/pull/20

Issue was that you're using is_binary to check the response, in Elixir all strings are binaries so the condition would always match, not only for when raw binary is returned