tjardoo / openai-client

OpenAI Dive is an unofficial async Rust library that allows you to interact with the OpenAI API.
https://crates.io/crates/openai_dive
MIT License
47 stars 19 forks source link

Introduce FileUpload to make file uploading consistent #74

Closed philpax closed 3 months ago

philpax commented 4 months ago

AudioTranscriptionParameters allowed for uploading in-memory bytes using AudioTranscriptionFile, but none of the other endpoints exposing files did.

This PR fixes that by renaming AudioTranscriptionFile to FileUpload and switching the other endpoints over to using it.

This was actually a side-effect of the actual change I wanted to make, which was to make it possible to build the crate with reqwest but without tokio. This achieves that by isolating the tokio-using code to FileUpload::File and conditionally compiling that.

This compiles with:

tjardoo commented 3 months ago

Thanks a lot @philpax