Skip to content

Commit

Permalink
Fixed the tools
Browse files Browse the repository at this point in the history
  • Loading branch information
djthorpe committed May 26, 2024
1 parent a6c5988 commit 7d6d4fd
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions pkg/anthropic/opts.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,16 +103,16 @@ func OptTemperature(v float32) Opt {
// Add a tool
func OptTool(value ...*schema.Tool) Opt {
return func(o *options) error {
// Check tools
// Make a copy of each tool
for _, tool := range value {
if tool == nil {
return ErrBadParameter.With("OptTool")
} else {
tool := *tool
o.Tools = append(o.Tools, &tool)
}
}

// Append tools
o.Tools = append(o.Tools, value...)

// Return success
return nil
}
Expand Down

0 comments on commit 7d6d4fd

Please sign in to comment.