enable raw response logging#264
Conversation
|
|
||
| /// Stream of transformed chunks ready for output. | ||
| /// Serialized using lingua's serde_json at the boundary. | ||
| pub type ResponseStream = Pin<Box<dyn Stream<Item = Result<StreamChunk>> + Send>>; |
There was a problem hiding this comment.
I wonder if another possible version is to return a stream that returns something like StreamChunkWithRaw, instead of adding a callback function? Just so we get all results the same way and don't have to worry about blocking this loop with the callback function. I don't feel too strongly about this, though
There was a problem hiding this comment.
I think this is right but is also hard because raw chunks can produce 0+ transformed chunks. I am cowardly going to back out of trying this for now.
There was a problem hiding this comment.
That's fair. Maybe add a comment that callback does block the response stream so not to do anything too crazy in it?
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 5039c88669
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "Codex (@codex) review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "Codex (@codex) address that feedback".
There was a problem hiding this comment.
💡 Codex Review
When an upstream returns a 2xx body that lingua::transform_response cannot parse or convert for the requested output format, this new raw-response API returns Err here before constructing CompleteResponseWithRaw, so callers cannot log the raw provider body in exactly the failure case raw logging is meant to diagnose. The streaming capture path explicitly captures before transform errors, but the non-streaming path drops the already-received response_bytes on this ?.
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "Codex (@codex) review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "Codex (@codex) address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 5deca009e8
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "Codex (@codex) review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "Codex (@codex) address that feedback".
Want to be able to log untransformed responses