64bit / async-openai

Rust library for OpenAI
https://docs.rs/async-openai
MIT License
1.11k stars 166 forks source link

Add speech endpoint #130

Closed m1guelpf closed 10 months ago

m1guelpf commented 10 months ago

Note that the struct corresponding to the response_format parameter was named SpeechResponseFormat instead of AudioResponseFormat, since the later already existed for defining whisper response formats.

I'd love to add an enum for voices as well (with an Other wildcard and marked as non-exhaustive), but refrained since the library's pattern seems to be deferring to strings (same case as model IDs all across).

64bit commented 10 months ago

Thank you! 🎉

( There's https://crates.io/crates/serde_bytes too, not sure what difference would be between bytes crate and serde_bytes )

'd love to add an enum for voices as well (with an Other wildcard and marked as non-exhaustive), but refrained since the library's pattern seems to be deferring to strings (same case as model IDs all across).

I think for Voice as enum makes sense - go for it . I usually defer to spec when it lists a filed of type string + enum. They haven't released updated spec though.


I'm getting "The model tts-1 does not exist or you do not have access to it." Not sure how to get access to the new models?

64bit commented 10 months ago

OH they just did release spec 11 mins ago :D

m1guelpf commented 10 months ago

Not sure what the difference is either, but bytes is the type reqwest uses, we just import the crate to access the type really.

Will add the enum in a sec. Model releases in 1h (supposedly) so not available yet lmeow

64bit commented 10 months ago

Aha here, https://openai.com/blog/new-models-and-developer-products-announced-at-devday

We’ll begin rolling out new features to OpenAI customers starting at 1pm PT today.

30mins to go 🕐