-
-
Notifications
You must be signed in to change notification settings - Fork 334
Open
Description
When using the BYOT features with third-party providers, the error format of these APIs often does not match the expectation of this library. For example, this library deserializes errors into this format:
pub struct ApiError {
pub message: String,
#[serde(rename = "type")]
pub r#type: Option<String>,
pub param: Option<String>,
#[serde(deserialize_with = "deserialize_code")]
pub code: Option<String>,
}However, OpenRouter provides errors in the following format:
{
"error": {
"message": "User not found.",
"code": 401
}
}with the small difference that code is an integer, leading to a deserialization error when using this library.
Before implementing a possible "bring-your-own-error-type" feature, I want to check if this would be within the scope of this library, and about how to architect it. One option might be that users bring their own error type for deserialization that must implement a trait to convert itself into an OpenAIError.
Metadata
Metadata
Assignees
Labels
No labels