-
Install
tcgen
:go install github.com/cloudcarver/tcgen/cmd/tcgen@latest
-
Define tool calls in
test.yaml
:functions: - name: RunPython description: Python code execution parameters: type: object required: [code] properties: code: type: string description: the Python code you want to run
-
Run the code generator:
tcgen -path test.yaml > fn_gen.go
-
Then you can get the parameter types and the function signature in
fn_gen.go
, all you need to do is implementing the interfaces and then you can call tools with plain text returned by LLMs:type MyExecutor struct { } func (e *MyExecutor) RunPython(params *RunPythonParameters) (string, error) { // implement your logic here return "", nil } func main() { fc := NewFunctionCaller(&MyExecutor{}) _, err := fc.Call("RunPython", `{"code": "print('hello')"}`) }
-
Notifications
You must be signed in to change notification settings - Fork 0
cloudcarver/tcgen
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
About
LLM tool calls code generation tools for golang
Resources
Stars
Watchers
Forks
Packages 0
No packages published