Function Calling documentation not working

Hi all,

I’ve been trying to follow the function calling documentation (here https://cloud.google.com/vertex-ai/generative-ai/docs/multimodal/function-calling). Vertex / google-cloud-sdk are installed and set up correctly and all credentials are working. As a note, you also have to use gemini-1.5-pro not gemini-1.0-pro as is in the documentation since 1.0 doesn’t have function calling enabled. However, when I try and run the generate_content line(s) of the documentation I get the below error. Since I’m using exactly the documentation code (with the exception of model type), it’s unclear to me what’s going wrong.

Any help would be great!

TypeError: (“Expected an instance of genai.FunctionDeclaraionType. Got a:\n type(fun)=<class ‘vertexai.generative_models._generative_models.Tool’>\n”

The above exception was the direct cause of the following exception:

TypeError: (“Expected an instance of genai.ToolType. Got a:\n type(tool)=<class ‘vertexai.generative_models._generative_models.Tool’>”

1 Like