adverse-sapphire
adverse-sapphireβ€’6mo ago

[Solved βœ…] Google Gemini Function calling integration

Hey everyone, how do I use composio tools directly with google Gemini function calling. like we can use composio with openai function calling directly but can't do the same for google gemini. It raises some ridiculous error. model = genai.GenerativeModel(model_name="gemini-1.5-flash", tools=tools) basically it's not working when I do something like this tools = composio_toolset.get_tools(apps=[App.GOOGLECALENDAR]) i get this error lol
File "C:\Users\PC\Documents\planner\.venv\Lib\site-packages\google\generativeai\types\content_types.py", line 774,
in _make_tools
tools = [_make_tool(t) for t in tools]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\PC\Documents\planner\.venv\Lib\site-packages\google\generativeai\types\content_types.py", line 774,
in <listcomp>
tools = [_make_tool(t) for t in tools]
^^^^^^^^^^^^^
File "C:\Users\PC\Documents\planner\.venv\Lib\site-packages\google\generativeai\types\content_types.py", line 715,
in _make_tool
return Tool(function_declarations=tool)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\PC\Documents\planner\.venv\Lib\site-packages\google\generativeai\types\content_types.py", line 637,
in __init__
self._function_declarations = [
^
File "C:\Users\PC\Documents\planner\.venv\Lib\site-packages\google\generativeai\types\content_types.py", line 638,
in <listcomp>
_make_function_declaration(f) for f in function_declarations
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\PC\Documents\planner\.venv\Lib\site-packages\google\generativeai\types\content_types.py", line 613,
in _make_function_declaration
raise TypeError(
TypeError: Invalid input type. Expected an instance of `genai.FunctionDeclarationType`.
However, received an object of type: <class 'tuple'>.
Object Value: ('name', 'GOOGLECALENDAR_CREATE_EVENT')
Sentry is attempting to send 2 pending events
Waiting up to 2 seconds
Press Ctrl-Break to quit
File "C:\Users\PC\Documents\planner\.venv\Lib\site-packages\google\generativeai\types\content_types.py", line 774,
in _make_tools
tools = [_make_tool(t) for t in tools]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\PC\Documents\planner\.venv\Lib\site-packages\google\generativeai\types\content_types.py", line 774,
in <listcomp>
tools = [_make_tool(t) for t in tools]
^^^^^^^^^^^^^
File "C:\Users\PC\Documents\planner\.venv\Lib\site-packages\google\generativeai\types\content_types.py", line 715,
in _make_tool
return Tool(function_declarations=tool)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\PC\Documents\planner\.venv\Lib\site-packages\google\generativeai\types\content_types.py", line 637,
in __init__
self._function_declarations = [
^
File "C:\Users\PC\Documents\planner\.venv\Lib\site-packages\google\generativeai\types\content_types.py", line 638,
in <listcomp>
_make_function_declaration(f) for f in function_declarations
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\PC\Documents\planner\.venv\Lib\site-packages\google\generativeai\types\content_types.py", line 613,
in _make_function_declaration
raise TypeError(
TypeError: Invalid input type. Expected an instance of `genai.FunctionDeclarationType`.
However, received an object of type: <class 'tuple'>.
Object Value: ('name', 'GOOGLECALENDAR_CREATE_EVENT')
Sentry is attempting to send 2 pending events
Waiting up to 2 seconds
Press Ctrl-Break to quit
9 Replies
flat-fuchsia
flat-fuchsiaβ€’6mo ago
Checking
adverse-sapphire
adverse-sapphireOPβ€’6mo ago
Kk
flat-fuchsia
flat-fuchsiaβ€’6mo ago
Currently composio doesn't support tools integration in google-generativeai, however we are working on it. If you need any other help, feel free to ping me @Maverick πŸ™‚
adverse-sapphire
adverse-sapphireOPβ€’6mo ago
Ahh okay np. maybe I will continue using the native google calendar tool I made 😦
optimistic-gold
optimistic-goldβ€’6mo ago
@Maverick you can use Google Gemini via langchain or LlamaIndex
adverse-sapphire
adverse-sapphireOPβ€’6mo ago
I actually don't feel comfortable using those frameworks anymore. It leads to a lot of complications when deploying. So I preferred the raw ability of the llm and code around it
optimistic-gold
optimistic-goldβ€’6mo ago
Got it
xenial-black
xenial-blackβ€’5mo ago
Composio Docs
Using Composio With Google AI - Composio
Composio enables your agents to connect with Various Tools and work with them
adverse-sapphire
adverse-sapphireOPβ€’5mo ago
Google aistudio felt left out since it is not yet supported rather only vertex AI is supported.

Did you find this page helpful?