Skip to content

Commit 7d6d4fd

Browse files
committed
Fixed the tools
1 parent a6c5988 commit 7d6d4fd

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

pkg/anthropic/opts.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -103,16 +103,16 @@ func OptTemperature(v float32) Opt {
103103
// Add a tool
104104
func OptTool(value ...*schema.Tool) Opt {
105105
return func(o *options) error {
106-
// Check tools
106+
// Make a copy of each tool
107107
for _, tool := range value {
108108
if tool == nil {
109109
return ErrBadParameter.With("OptTool")
110+
} else {
111+
tool := *tool
112+
o.Tools = append(o.Tools, &tool)
110113
}
111114
}
112115

113-
// Append tools
114-
o.Tools = append(o.Tools, value...)
115-
116116
// Return success
117117
return nil
118118
}

0 commit comments

Comments
 (0)