ComposioHQ / composio

Composio equip's your AI agents & LLMs with 100+ high-quality integrations via function calling
https://docs.composio.dev
Other
11.51k stars 4.34k forks source link

SERPAPI Tool Error: type object 'Action' has no attribute 'SERPAPI_GOOGLE_MAPS_SEARCH' #479

Closed MorenoLabs closed 2 months ago

MorenoLabs commented 2 months ago

When using SERPAPI integration as tool with the sample code from quick start or serpapi tool snippet, it throws an error pointing to an issue with the Google Maps Class:

`--------------------------------------------------------------------------- AttributeError Traceback (most recent call last) Cell In[20], line 5 1 from composio_openai import ComposioToolSet, Action 4 tool_set = ComposioToolSet() ----> 5 tools = tool_set.get_actions(actions=[Action.SERPAPI_GOOGLE_MAPS_SEARCH])

AttributeError: type object 'Action' has no attribute 'SERPAPI_GOOGLE_MAPS_SEARCH'`

Same issue here from the main quick start:


ValueError Traceback (most recent call last) Cell In[13], line 11 8 composio_toolset = ComposioToolSet() 9 #Using .get_tools we are able to add various tools needed by the agents to execute its objective 10 #in this case its serpapi, giving the agent access to the internet ---> 11 tools = composio_toolset.get_tools(apps=[App.SERPAPI])

File ~/coding/experiments/composio/.venv/lib/python3.10/site-packages/composio_langchain/toolset.py:196, in ComposioToolSet.get_tools(self, apps, tags, entity_id) 176 def get_tools( 177 self, 178 apps: t.Sequence[AppType], 179 tags: t.Optional[t.List[TagType]] = None, 180 entity_id: t.Optional[str] = None, 181 ) -> t.Sequence[StructuredTool]: 182 """ 183 Get composio tools wrapped as Langchain StructuredTool objects. 184 (...) 188 :return: Composio tools wrapped as StructuredTool objects 189 """ 191 return [ 192 self._wrap_tool( 193 schema=tool.model_dump(exclude_none=True), 194 entity_id=entity_id or self.entity_id, ... --> 157 raise ValueError( 158 f"Invalid value {self._slug} for {self.__class__.__name__}" 159 )

ValueError: Invalid value SERPAPI_GOOGLE_MAPS_SEARCH for Action

Prat011 commented 2 months ago

Hey, you can run 'composio apps update' in your CLI and then run this code again. It should work properly.

MorenoLabs commented 2 months ago

great, works now. thx