This PR improves how we propagate errors received from AI APIs.
Most of these errors were previously passed as serialization. For example, currently in logs we would see something like below that is not very helpful for troubleshooting:
[2024-07-21T16:42:54Z ERROR allms::assistants::openai::openai_assistant] [OpenAIAssistant] Messages API response serialization error: missing field id at line 8 column 1
This PR takes advantage of the recently introduced AllmsError struct and passes information about what caused the error but also the response received from AI API. For example:
[2024-07-21T16:51:42Z ERROR allms::completions] AllmsError { crate_name: "allms", module: "assistants::completions::claude-2.1", error_message: "Completions API response serialization error: missing field id at line 1 column 86", error_detail: "{\"type\":\"error\",\"error\":{\"type\":\"authentication_error\",\"message\":\"invalid x-api-key\"}}" }
This PR improves how we propagate errors received from AI APIs.
Most of these errors were previously passed as serialization. For example, currently in logs we would see something like below that is not very helpful for troubleshooting:
This PR takes advantage of the recently introduced
AllmsError
struct and passes information about what caused the error but also the response received from AI API. For example: