Skip to content

Commit

Permalink
Updated
Browse files Browse the repository at this point in the history
  • Loading branch information
djthorpe committed Feb 7, 2025
1 parent 67e0ad4 commit 291165d
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions examples/tool_adder/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,15 @@ func main() {
}

// Register tool
session := model.Context()
toolkit := tool.NewToolKit()
toolkit.Register(&Adder{})

// Get the tool call
// Create a chat session
session := model.Context(llm.WithToolKit(toolkit))

// Make the prompt
prompt := fmt.Sprintf("What is %v plus %v?", os.Args[2], os.Args[3])
if err := session.FromUser(context.TODO(), prompt, llm.WithToolKit(toolkit), llm.WithToolChoice("any")); err != nil {
if err := session.FromUser(context.TODO(), prompt); err != nil {
panic(err)
}

Expand All @@ -73,11 +75,6 @@ func main() {
break
}

// Print out any intermediate messages
if session.Text(0) != "" {
fmt.Println(session.Text(0))
}

// Get the results from the toolkit
fmt.Println("Running", calls)
results, err := toolkit.Run(context.TODO(), calls...)
Expand Down

0 comments on commit 291165d

Please sign in to comment.