symfonic.capabilities.tools.keywords¶
keywords ¶
Per-turn tool narrowing from a keyword map, composed publicly.
:class:~.capability.ToolsCapability already narrows a turn's palette and
takes a low-level router: an async callable returning procedural rows whose
action_tool names a tool. That is the right seam for a deployment with a
procedural memory layer, and the wrong one for a scaffold, which expresses the
same intent as DomainTemplate.tool_trigger_keywords -- a map from a tool to
the words that should surface it. The template field goes away here; the intent
does not.
Narrowing only. The plan binds every registered tool once, at compile time. A router decides what a turn offers the model. It cannot add a tool the plan did not bind, and a map naming one is refused at composition rather than producing a keyword that silently never works: routing drops unresolved names, so the failure would otherwise reach the deployment as "that keyword does nothing".
No state. A router is built once and used for every turn of every tenant a host serves, so anything remembered on it would be cross-turn state at best and cross-tenant state at worst.
RoutedTool
dataclass
¶
One routing row, in the shape :mod:..routing reads.
content and metadata['action_tool'] carry the same name because
routing prefers the second and falls back to the first; filling both means
this row survives either rule rather than depending on which one is
current.
keyword_router ¶
keyword_router(keywords: Mapping[str, Iterable[str]], *, registered: Iterable[str] | None = None) -> Any
An entries_for router that surfaces tools whose words appear.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
keywords
|
Mapping[str, Iterable[str]]
|
tool name -> the words that should surface it. Matching is
case-insensitive and accent-insensitive, because a router that
missed |
required |
registered
|
Iterable[str] | None
|
the palette the plan binds. When given, a keyword map naming anything outside it is refused here. |
None
|
Raises:
| Type | Description |
|---|---|
ValueError
|
if |