update
This commit is contained in:
+11
-11
@@ -4,9 +4,9 @@ Tools can be loaded dynamically from `.jl` files in the `src/tools/` directory w
|
||||
|
||||
## How It Works
|
||||
|
||||
1. `src/tools/registry.jl` defines a `load_tools(dir::String)` function that scans a directory for `.jl` files
|
||||
2. Each tool file must define a single function: `get_tool() :: agentTool`
|
||||
3. `load_tools()` sorts files alphabetically, includes each one, calls `get_tool()`, and registers the result
|
||||
1. `src/tools/registry.jl` defines a `loadTools(dir::String)` function that scans a directory for `.jl` files
|
||||
2. Each tool file must define a single function: `getTool() :: agentTool`
|
||||
3. `loadTools()` sorts files alphabetically, includes each one, calls `getTool()`, and registers the result
|
||||
4. Loaded tools are returned as `Vector{agentTool}` for use when constructing a `yiemAgent`
|
||||
|
||||
## Directory Structure
|
||||
@@ -26,11 +26,11 @@ src/
|
||||
|
||||
## Creating a Tool
|
||||
|
||||
Each `.jl` file in `src/tools/` must define `get_tool()` returning an `agentTool`:
|
||||
Each `.jl` file in `src/tools/` must define `getTool()` returning an `agentTool`:
|
||||
|
||||
```julia
|
||||
# src/tools/get_weather.jl
|
||||
function get_tool() :: agentTool
|
||||
function getTool() :: agentTool
|
||||
return agentTool(
|
||||
name = "get_weather",
|
||||
label = "Weather Lookup",
|
||||
@@ -65,7 +65,7 @@ using .YiemAgent
|
||||
using .YiemAgent: toolRegistry
|
||||
|
||||
# Load all tool files from src/tools/
|
||||
tools = load_tools(joinpath(@__DIR__, "src", "tools"))
|
||||
tools = YiemAgent.loadTools(joinpath(@__DIR__, "src", "tools"))
|
||||
|
||||
# Create agent with loaded tools
|
||||
agent = yiemAgent(
|
||||
@@ -81,11 +81,11 @@ agent = yiemAgent(
|
||||
|
||||
| Function | Description |
|
||||
|----------|-------------|
|
||||
| `load_tools(dir::String)` | Scan directory and load all `.jl` tool files |
|
||||
| `register_tool(tool::agentTool)` | Register a single tool into the global registry |
|
||||
| `get_tools()` | Get deep copy of all registered tools |
|
||||
| `list_tools()` | List all registered tools as `(name, label)` pairs |
|
||||
| `clear_tools()` | Clear the global registry |
|
||||
| `loadTools(dir::String)` | Scan directory and load all `.jl` tool files |
|
||||
| `registerTool(tool::agentTool)` | Register a single tool into the global registry |
|
||||
| `getTools()` | Get deep copy of all registered tools |
|
||||
| `listTools()` | List all registered tools as `(name, label)` pairs |
|
||||
| `clearTools()` | Clear the global registry |
|
||||
|
||||
## File Loading Order
|
||||
|
||||
|
||||
Reference in New Issue
Block a user