You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit bcb9b25
Browse filesBrowse the repository at this point in the historyBrowse files
Copy file name to clipboardExpand all lines: README.md
+8-5Lines changed: 8 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -135,17 +135,20 @@ If you use this code or repository in your research, please cite:
135
135
}
136
136
```
137
137
138
+
## Optional: Trajectory metadata and logging
139
+
`RLMChatCompletion` has an optional `metadata` field (default empty) that can hold the full trajectory (run config + all iterations and sub-calls) so you can reconstruct the run. Pass an `RLMLogger` to capture it:
140
+
141
+
-**In-memory only** (trajectory on `completion.metadata`): `logger=RLMLogger()` (no `log_dir`).
142
+
-**Also save to disk** (JSONL for the visualizer): `logger=RLMLogger(log_dir="./logs")`.
We additionally provide a simple visualizer tool to examine and view the code, sub-LM, and root-LM calls of an RLM trajectory. To save log files (`.jsonl`) on every completion call that can be viewed in the visualizer, initialize the `RLMLogger` object and pass it into the `RLM` on initialization:
145
+
We provide a simple visualizer to inspect code, sub-LM, and root-LM calls. Use `RLMLogger(log_dir="./logs")` so each completion writes a `.jsonl` file:
140
146
```python
141
147
from rlm.logger import RLMLogger
142
148
from rlm importRLM
143
149
144
150
logger = RLMLogger(log_dir="./logs")
145
-
rlm = RLM(
146
-
...
147
-
logger=logger
148
-
)
151
+
rlm = RLM(..., logger=logger)
149
152
```
150
153
151
154
To run the visualizer locally, we use Node.js and shadcn/ui:
Copy file name to clipboardExpand all lines: rlm/environments/docker_repl.py
+6Lines changed: 6 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -173,6 +173,12 @@ def SHOW_VARS():
173
173
finally:
174
174
sys.stdout, sys.stderr = old_stdout, old_stderr
175
175
176
+
# Restore scaffold aliases if overwritten by executed code
177
+
if "context_0" in _locals:
178
+
_locals["context"] = _locals["context_0"]
179
+
if "history_0" in _locals:
180
+
_locals["history"] = _locals["history_0"]
181
+
176
182
save_state(_locals)
177
183
print(json.dumps({{"stdout": stdout_buf.getvalue(), "stderr": stderr_buf.getvalue(), "locals": {{k: repr(v) for k, v in _locals.items() if not k.startswith("_")}}}}, ensure_ascii=False))
0 commit comments