-
Notifications
You must be signed in to change notification settings - Fork 15
Open
Description
when need call tool
response
create a golang demo here
● {"tool_calls": [{"id": "call_1", "type": "function", "function": {"name": "WriteToFile", "arguments": "{path: main.go, content: package mainnnimport (ntfmtnttimen)nnfunc main() {ntfmt.Println(Welcome to Go Demo!)ntnt// Basic
variablesntname := Gopherntage := 5ntntfmt.Printf(Hello, %s! You are %d years old.n, name, age)ntnt// Slice examplentfruits := []string{apple, banana, orange}ntfmt.Println(Fruits:, fruits)ntnt// Map examplentscores :=
map[string]int{nttAlice: 95,nttBob: 87,nttCarol: 92,nt}ntntfmt.Println(Scores:)ntfor name, score := range scores {nttfmt.Printf(%s: %dn, name, score)nt}ntnt// Function callntresult := add(10, 20)ntfmt.Printf(10 + 20 = %dn,
result)ntnt// Goroutine examplentgo greet(World)ntnt// Wait a moment for goroutinenttime.Sleep(100 * time.Millisecond)n}nnfunc add(a, b int) int {ntreturn a + bn}nnfunc greet(name string) {ntfmt.Printf(Hello from goroutine,
%s!n, name)n}}"}}]}
{"tool_calls": [{"id": "call_2", "type": "function", "function": {"name": "WriteToFile", "arguments": "{path: go.mod, content: module golang-demonngo 1.21}"}}]}
{"tool_calls": [{"id": "call_3", "type": "function", "function": {"name": "Bash", "arguments": "{command: go run main.go}"}}]}
Created a Go demo with variables, slices, maps, functions, and goroutines. Run with go run main.go.
Metadata
Metadata
Assignees
Labels
No labels