Skip to content

Commit 19ed494

Browse files
committed
Improve visibility of tool partial conventions in Rails docs
- add a dedicated Tool Call and Tool Result Partials subsection under chat UI conventions - show the generated tool_calls/tool_results directory tree for quick scanning - explicitly document locals passed to tool call and tool result partials - note that ruby_llm:tool generates correctly named _your_tool partials
1 parent 2f28885 commit 19ed494

1 file changed

Lines changed: 19 additions & 3 deletions

File tree

docs/_advanced/rails.md

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -180,10 +180,26 @@ The generated chat UI follows one convention: each message partial uses the loca
180180

181181
This comes from Rails partial rendering: `render @chat.messages` calls `to_partial_path`, and Rails injects a local named after that partial.
182182

183-
Tool-specific partials follow the same convention:
183+
#### Tool Call and Tool Result Partials
184184

185-
- `messages/tool_calls/_your_tool.html.erb` gets `tool_calls` and `tool_call`
186-
- `messages/tool_results/_your_tool.html.erb` gets `tool`
185+
Tool-specific partials are generated under `app/views/messages/tool_calls` and `app/views/messages/tool_results`:
186+
187+
```text
188+
app/views/messages/
189+
|-- tool_calls/
190+
| |-- _default.html.erb
191+
| `-- _your_tool.html.erb
192+
`-- tool_results/
193+
|-- _default.html.erb
194+
`-- _your_tool.html.erb
195+
```
196+
197+
Locals passed to those partials:
198+
199+
- `messages/tool_calls/_your_tool.html.erb` receives `tool_calls` and `tool_call`
200+
- `messages/tool_results/_your_tool.html.erb` receives `tool`
201+
202+
`ruby_llm:tool` creates `_your_tool.html.erb` files with the correct names so custom rendering hooks up automatically.
187203

188204
Using fixed locals keeps the templates dumb and predictable.
189205

0 commit comments

Comments
 (0)