loader
loader
¶
Template loader — dynamically construct BaseTool from TOML definitions.
Classes¶
ToolTemplate
¶
Bases: BaseTool
A tool dynamically constructed from a TOML template definition.
Source code in src/openjarvis/tools/templates/loader.py
Functions¶
safe_eval_expr
¶
Safely evaluate a template python-action expression.
Parses expr and interprets it against the allowlist in
:func:_eval_node. No eval/exec is used, and the only callables
reachable are :data:_SAFE_EVAL_FUNCS plus the supplied names (the tool
parameters). Raises ValueError / SyntaxError on anything unsafe.
Source code in src/openjarvis/tools/templates/loader.py
load_template
¶
load_template(path: str | Path) -> ToolTemplate
Load a single tool template from a TOML file.
Source code in src/openjarvis/tools/templates/loader.py
discover_templates
¶
discover_templates(directory: Optional[str | Path] = None) -> List[ToolTemplate]
Discover all TOML templates in a directory.