64bit / async-openai

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

Deserialize error when retrieve content #210

Closed WildBench closed 2 months ago

WildBench commented 4 months ago

Error: failed to deserialize api response: expected value at line 1 column 1

The error jumps up when I tried to download a image from code-interpreter with retrieve_content. I checked the source code and it seems retrieve_content returns Result<String, OpenAIError> which might cause trouble for image files.

Following OpenAI doc (https://platform.openai.com/docs/api-reference/files/retrieve-contents), the image could be downloaded with curl.

Could you help figure out this problem? Thank you!

64bit commented 4 months ago

Definitely a bug thank you for reporting, Result<Bytes, OpenAIError> is a potential fix (but not for larger files).

It seems the spec is not accurate, seems to be reflective of jsonl file examples:

Screen Shot 2024-04-06 at 2 23 30 PM
64bit commented 2 months ago

Thank you for reporting the issue, fix for this is reelased in v0.23.0, hence closing