open_ai: Log inputs that caused parsing errors (#36063)

Release Notes:

- N/A

Co-authored-by: Michael Sloan <mgsloan@gmail.com>
This commit is contained in:
Oleksiy Syvokon 2025-08-12 21:49:19 +03:00 committed by GitHub
parent 7df8e05ad9
commit 7ff0f1525e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 11 additions and 1 deletions

1
Cargo.lock generated
View file

@ -11242,6 +11242,7 @@ dependencies = [
"anyhow",
"futures 0.3.31",
"http_client",
"log",
"schemars",
"serde",
"serde_json",

View file

@ -20,6 +20,7 @@ anyhow.workspace = true
futures.workspace = true
http_client.workspace = true
schemars = { workspace = true, optional = true }
log.workspace = true
serde.workspace = true
serde_json.workspace = true
strum.workspace = true

View file

@ -445,7 +445,15 @@ pub async fn stream_completion(
Ok(ResponseStreamResult::Err { error }) => {
Some(Err(anyhow!(error)))
}
Err(error) => Some(Err(anyhow!(error))),
Err(error) => {
log::error!(
"Failed to parse OpenAI response into ResponseStreamResult: `{}`\n\
Response: `{}`",
error,
line,
);
Some(Err(anyhow!(error)))
}
}
}
}