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
parent a72432d968
commit de4cf6e423
3 changed files with 11 additions and 1 deletions

1
Cargo.lock generated
View file

@ -11184,6 +11184,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)))
}
}
}
}