async-openai icon indicating copy to clipboard operation
async-openai copied to clipboard

Implement `From<serde_json::Error>` on `OpenAIError` enum

Open ozaner opened this issue 10 months ago • 0 comments

The OpenAIError type is implemented using the thiserror crate. It implements From<reqwest::Error> via the #[from] present in the Reqwest variant.

https://github.com/64bit/async-openai/blob/c48e62e72b1c8bd9658af7e682c996ba5c93e083/async-openai/src/error.rs#L4-L28

I think that the #[from] attribute should also be present for the JSONDeserialize variant as well.

Having From<serde_json::Error> implemented would allow me to use it as a trait bound for the error type of my own custom Llm trait.

This is addressed by PR #325

ozaner avatar Jan 24 '25 04:01 ozaner