Skip to content

refactor: harden LM transcript fidelity, unify Predicted return shape, collapse call API - #82

Merged
darinkishore merged 2 commits into
multi-turn-predictfrom
multi-turn-predict-rework
Feb 22, 2026
Merged

darinkishore merged 2 commits into
multi-turn-predictfrom
multi-turn-predict-rework

Conversation

@darinkishore

Copy link
Copy Markdown
Collaborator

What

Stacked on top of PR #81. Fixes and improvements found during adversarial review.

LM layer hardening

  • Tool-loop reasoning preservation: execute_tool_loop final text turn now preserves full_content (reasoning blocks) instead of dropping them via Message::assistant(&text)
  • Auto+no-tools content preservation: when tools are requested but unavailable, preserves actual provider content instead of injecting synthetic warning text
  • Call API collapse: call_with_tool_loop_mode collapsed to call(messages, tools, mode)
  • Panic → Result: request history construction now returns errors instead of panicking
  • pub(crate) boundaries: internal rig conversion methods (to_rig_message, system_prompt, to_rig_chat_history) narrowed to crate-internal

Predicted return shape unification

  • Chat added as peer field on Predicted alongside output and metadata
  • Predicted::chat() accessor, into_parts() returns (O, CallMetadata, Chat)
  • Predict::forward returns Predicted (not tuple) — single return shape
  • All call sites updated: optimizers, ReAct, module_ext, examples, tests

Doc updates

  • core/mod.rs, core/module.rs, examples/01-simple.rs updated to document three-channel Predicted (output + metadata + chat)

Verification

  • cargo fmt --check ✅
  • cargo clippy --all-targets ✅
  • cargo test --all ✅

- collapse Predict to forward(input, history) with call() wrapper
- preserve full provider content in CallerManaged LMResponse.output
- remove inaccurate lossless conversion claim
- remove legacy Chat JSON parsing; enforce canonical grouped format
- update conversation and chat roundtrip tests
@darinkishore
darinkishore force-pushed the multi-turn-predict-rework branch from 8a6fa91 to 1e9d503 Compare February 22, 2026 07:08
@darinkishore
darinkishore merged commit 659c393 into multi-turn-predict Feb 22, 2026
8 of 10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant