feat(rig-core): return conversation messages from non-streaming agent…#1450
Conversation
joshua-mo-143
left a comment
There was a problem hiding this comment.
please see comments
| hook: self.hook, | ||
| concurrency: self.concurrency, | ||
| output_schema: self.output_schema, | ||
| collect_messages: false, |
There was a problem hiding this comment.
This doesn't appear correct, collect_messages shouldn't automatically become false here
| hook: self.hook, | ||
| concurrency: self.concurrency, | ||
| output_schema: self.output_schema, | ||
| collect_messages: true, |
There was a problem hiding this comment.
This should not be arbitrarily set to true
| /// Whether to collect message history in the response | ||
| collect_messages: bool, |
There was a problem hiding this comment.
Needs a method to set to true/false
3d8f441 to
516e747
Compare
|
Thanks for the review! I believe with_hook() was actually preserving via self.collect_messages here, but agreed the overall collect_messages design was confusing. I've simplified it, removed the bool entirely, Extended path now always populates messages. Please lmk if this looks good now. Thank you :) |
… loop Add `messages: Option<Vec<Message>>` field to `PromptResponse` so that `extended_details()` returns the full message history accumulated during the agent loop, without requiring callers to pass `&mut Vec<Message>` via `with_history()`. Changes: - Add `messages` field to `PromptResponse` with `#[non_exhaustive]` - Add `Display` impl on `PromptResponse` delegating to `output` - Add `with_messages()` builder method on `PromptResponse` - Always populate messages in the Extended send path - Standard path remains unchanged (returns plain `String`) - Add 11 integration tests with mock models covering single-turn, multi-turn with tool calls, backward compat, and error paths Fixes 0xPlaygrounds#1445
516e747 to
18f662f
Compare
|
Fixed merge conflicts. |
Summary
messages: Option<Vec<Message>>field toPromptResponse(with#[non_exhaustive])extended_details()path — Standard path pays zero costcollect_messagesbool + privateinto_extended()avoids unnecessarychat_history.to_vec()on Standard delegationFinalResponse::history)Changes
rig-core/src/agent/prompt_request/mod.rs:collect_messagesfield, conditional message collection,PromptResponse::with_messages()builderrig-core/tests/prompt_response_messages.rs: 10 integration tests (mock models, multi-turn, backward compat, error paths)Test plan
cargo test -p rig-core --lib --tests(396 passed)cargo check --workspace(clean)String, no perf regression)extended_details()populates messages (single-turn + multi-turn with tool calls)with_history()+extended_details()interopMaxTurnsErrorpath unaffectedPromptResponse::new()2-arg signature preserved