Skip to content

fix: handle None root_model in lm_handler - #5

Merged
alexzhang13 merged 1 commit into
alexzhang13:mainfrom
XiaoConstantine:fix/root-model-none-handling
Jan 4, 2026
Merged

alexzhang13 merged 1 commit into
alexzhang13:mainfrom
XiaoConstantine:fix/root-model-none-handling

Conversation

@XiaoConstantine

Copy link
Copy Markdown
Contributor

Summary

  • Fix TypeError when printing sub-call with None root_model
  • When users call llm_query(prompt) without specifying a model, request.model is None
  • The handler correctly uses the default client but was recording None as root_model
  • Now falls back to client.model_name when request.model is None

Error

TypeError                                 Traceback (most recent call last)
Cell In[2], line 1
----> 1 result = rlm.completion(
      2     prompt=reviews,
      3     root_prompt="What percentage of these reviews are positive vs negative?"
      4 )
      5 print(result.response)

File ~/development/github.com/XiaoConstantine/rlm/rlm/core/rlm.py:191, in RLM.completion(self, prompt, root_prompt)
    188     self.logger.log(iteration)
    190 # Verbose output for this iteration
--> 191 self.verbose.print_iteration(iteration, i + 1)
    193 if final_answer:
    194     time_end = time.perf_counter()

File ~/development/github.com/XiaoConstantine/rlm/rlm/logger/verbose.py:320, in VerbosePrinter.print_iteration(self, iteration, iteration_num)
    318 # Print any sub-calls made during this code block
    319 for call in code_block.result.rlm_calls:
--> 320     self.print_subcall(
    321         model=call.root_model,
    322         prompt_preview=_to_str(call.prompt) if call.prompt else "",
    323         response_preview=_to_str(call.response) if call.response else "",
    324         execution_time=call.execution_time,
    325     )

File ~/development/github.com/XiaoConstantine/rlm/rlm/logger/verbose.py:280, in VerbosePrinter.print_subcall(self, model, prompt_preview, response_preview, execution_time)
    278 header.append("  ↳ ", style=STYLE_SECONDARY)
    279 header.append("Sub-call: ", style=STYLE_SECONDARY)
--> 280 header.append(model, style=STYLE_ACCENT)
    281 if execution_time:
    282     header.append(f"  ({execution_time:.2f}s)", style=STYLE_MUTED)

File ~/development/github.com/XiaoConstantine/rlm/.venv/lib/python3.11/site-packages/rich/text.py:979, in Text.append(self, text, style)
    968 """Add text with an optional style.
    978 if not isinstance(text, (str, Text)):
--> 979     raise TypeError("Only str or Text can be appended to Text")

TypeError: Only str or Text can be appended to Text

When users call llm_query(prompt) without specifying a model,
request.model is None. The handler correctly uses the default
client but was recording None as root_model, causing TypeError
in verbose printer.

Now falls back to client.model_name when request.model is None.

@alexzhang13 alexzhang13 left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Nice catch.

@alexzhang13
alexzhang13 merged commit c7400bc into alexzhang13:main Jan 4, 2026
3 checks passed
jakemannix added a commit to jakemannix/rlm that referenced this pull request Jun 10, 2026
…tive, scale+persistence)

- baselines on identical inputs: no-memory floor, in-context ceiling, embed+kNN retrieval@1,
  vs the persisted memory (item 3 — 'is memory pulling its weight').
- generative exact-match via generate_greedy (item 4) + neutral-KL no-regression at scale.
- scale+persistence (item 5): ingest the held-out bank one fact at a time, save->reload between
  each (deployment regime), query ALL facts so far at checkpoints, report worst-case frac_top5
  + min_lift as the store grows to O(10^2-10^3). All on held-out (eval-split) real entities.
Wired into real_text_sweep.sh (verbatim + paraphrase). Milestone-3 build complete (#1-alexzhang13#5).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
jakemannix added a commit to jakemannix/rlm that referenced this pull request Jun 10, 2026
…streamed-session dynamics not key geometry

base/whiten/pressure_whiten A3 curves; whitening fixed key geometry (cos 0.10) but multifact-session
recall caps at ~8 clean. Milestone-3 alexzhang13#5 (real save/reload scale) is the deployment-faithful capacity test, now running.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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.

2 participants