diff --git a/google.go b/google.go index c1b92cb..9d7062c 100644 --- a/google.go +++ b/google.go @@ -4,6 +4,7 @@ import ( "context" "encoding/json" "fmt" + "github.com/google/generative-ai-go/genai" "google.golang.org/api/option" ) @@ -31,17 +32,19 @@ func (g google) requestToGoogleRequest(in Request, model *genai.GenerativeModel) res = append(res, genai.Text(c.Text)) } - for _, tool := range in.Toolbox.funcs { - panic("google ToolBox is todo" + tool.Name) + if in.Toolbox != nil { + for _, tool := range in.Toolbox.funcs { + panic("google ToolBox is todo" + tool.Name) - /* - t := genai.Tool{} - t.FunctionDeclarations = append(t.FunctionDeclarations, &genai.FunctionDeclaration{ - Name: tool.Name, - Description: tool.Description, - Parameters: nil, //tool.Parameters, - }) - */ + /* + t := genai.Tool{} + t.FunctionDeclarations = append(t.FunctionDeclarations, &genai.FunctionDeclaration{ + Name: tool.Name, + Description: tool.Description, + Parameters: nil, //tool.Parameters, + }) + */ + } } return res