Open mrothroc opened 2 weeks ago
cc @jba @eliben
Can anyone suggest workarounds here? Has anyone been able to send multiple tools in an API call to gemini?
@mrothroc could you try to specify a single tool with a list of your functions? A tool (https://pkg.go.dev/cloud.google.com/go/vertexai/genai#Tool) has a list of function decls you can specify
I thought a tool was supposed to be a group of related functions. The functions I have are completely unrelated, so I thought I was supposed to do it this way.
As a workaround I can try stuffing them all the functions into a single tool.
I can confirm that putting all the functions in the single tool works.
Thanks for checking. I've labeled the issue aiplatform
to indicate it's the underlying API that has the issue - it's not SDK specific.
Client
vertexai/genai
Environment
Local running on Mac OS X
Go Environment
go version go version go1.22.2 darwin/arm64
go env GO111MODULE='on' GOARCH='arm64' GOBIN='' GOCACHE='/Users/mrothroc/Library/Caches/go-build' GOENV='/Users/mrothroc/Library/Application Support/go/env' GOEXE='' GOEXPERIMENT='' GOFLAGS='' GOHOSTARCH='arm64' GOHOSTOS='darwin' GOINSECURE='' GOMODCACHE='/Users/mrothroc/go/pkg/mod' GONOPROXY='' GONOSUMDB='' GOOS='darwin' GOPATH='/Users/mrothroc/go' GOPRIVATE='' GOPROXY='https://proxy.golang.org,direct' GOROOT='/opt/homebrew/opt/go/libexec' GOSUMDB='sum.golang.org' GOTMPDIR='' GOTOOLCHAIN='auto' GOTOOLDIR='/opt/homebrew/opt/go/libexec/pkg/tool/darwin_arm64' GOVCS='' GOVERSION='go1.22.2' GCCGO='gccgo' AR='ar' CC='cc' CXX='c++' CGO_ENABLED='1' GOMOD='/Users/mrothroc/IdeaProjects/scrapertest2/go.mod' GOWORK='' CGO_CFLAGS='-O2 -g' CGO_CPPFLAGS='' CGO_CXXFLAGS='-O2 -g' CGO_FFLAGS='-O2 -g' CGO_LDFLAGS='-O2 -g' PKG_CONFIG='pkg-config' GOGCCFLAGS='-fPIC -arch arm64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -ffile-prefix-map=/var/folders/5c/cwjs85zx5f73qtn3mv7_zh3r0000gn/T/go-build3282724130=/tmp/go-build -gno-record-gcc-switches -fno-common'
Code
Expected behavior
Call to vertexai to work without an error.
Actual behavior
Error code returned: rpc error: code = InvalidArgument desc = Request contains an invalid argument.
Additional context
I have validated that providing either tool alone works, so the declaration is valid.
E.g. gemini.Tools = []genai.Tool{toolSet[0].GetDeclaration()} and gemini.Tools = []genai.Tool{toolSet[1].GetDeclaration()}
both work without error, but
gemini.Tools = []*genai.Tool{toolSet[0].GetDeclaration(), toolSet[1].GetDeclaration()}
fails with the above error.