From 7d6d4fde31395337be224d2da3a82b569d293239 Mon Sep 17 00:00:00 2001 From: David Thorpe Date: Sun, 26 May 2024 11:33:12 +0200 Subject: [PATCH] Fixed the tools --- pkg/anthropic/opts.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pkg/anthropic/opts.go b/pkg/anthropic/opts.go index b805899..1d11d52 100644 --- a/pkg/anthropic/opts.go +++ b/pkg/anthropic/opts.go @@ -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 }