Skip to content

Commit 5844acf

Browse files
committed
Updated docs
1 parent 86c6ff6 commit 5844acf

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

README.md

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,7 @@ type Tool interface {
288288
}
289289
```
290290

291-
For example, if you want to implement a tool which adds to numbers,
291+
For example, if you want to implement a tool which adds two numbers,
292292

293293
```go
294294
package addition
@@ -360,6 +360,20 @@ func add_two_numbers(ctx context.Context, agent llm.Agent) (string, error) {
360360
}
361361
```
362362

363+
Parameters are implemented as struct fields, with tags. The tags you can include are:
364+
365+
* `name:""` - Set the name for the parameter
366+
* `json:""` - If `name` is not used, then the name is set from the `json` tag
367+
* `help:":` - Set the description for the parameter
368+
* `required:""` - The parameter is required as part of the tool call
369+
* `enum:"a,b,c"` - The parameter value should be one of these comma-separated options
370+
371+
The transation of field types is as follows:
372+
373+
* `string` - Translates as JSON `string`
374+
* `uint`, `int` - Translates to JSON `integer`
375+
* `float32`, `float64` - Translates to JSON `number`
376+
363377
## Options
364378

365379
You can add options to sessions, or to prompts. Different providers and models support

0 commit comments

Comments
 (0)