ComposioHQ / composio

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

Issue on docs: KeyError: ‘appName’ when retrieving tools with composio_toolset' #544

Open jiaohuix opened 2 months ago

jiaohuix commented 2 months ago

Description:

I encountered an error while trying to retrieve tools using the composio_toolset. The specific action I was attempting is Action.GITHUB_ACTIVITY_STAR_REPO_FOR_AUTHENTICATED_USER. Below is the traceback of the error:

[2024-09-05 14:33:14,264][INFO] Logging is set to INFO. Use the logging_level argument or set the COMPOSIO_LOGGING_LEVEL environment variable to change this. get tool Traceback (most recent call last): File "/root/zjh/Projects/ml/agents/test.py", line 28, in tools = composio_toolset.get_tools(actions=[Action.GITHUB_ACTIVITY_STAR_REPO_FOR_AUTHENTICATED_USER]) File "/root/miniconda3/envs/zjh/lib/python3.10/site-packages/composio_openai/toolset.py", line 114, in get_tools self.validate_tools(apps=apps, actions=actions, tags=tags) File "/root/miniconda3/envs/zjh/lib/python3.10/site-packages/composio/tools/toolset.py", line 635, in validate_tools if not action.is_local: File "/root/miniconda3/envs/zjh/lib/python3.10/site-packages/composio/client/enums/_action.py", line 6636, in is_local return self.load().is_local File "/root/miniconda3/envs/zjh/lib/python3.10/site-packages/composio/client/enums/base.py", line 269, in load self._cache() File "/root/miniconda3/envs/zjh/lib/python3.10/site-packages/composio/client/enums/base.py", line 248, in _cache data = self._cache_from_local() or self._cache_from_remote() File "/root/miniconda3/envs/zjh/lib/python3.10/site-packages/composio/client/enums/base.py", line 227, in _cache_from_remote app=response["appName"], KeyError: 'appName' Sentry is attempting to send 2 pending events Waiting up to 2 seconds Press Ctrl-C to quit Environment:

openai==1.43.0 composio_core==0.5.13 composio_openai==0.5.13 Python version: 3.10 Steps to Reproduce:

Set up the environment with the specified package versions. Run the following code snippet: python tools = composio_toolset.get_tools(actions=[Action.GITHUB_ACTIVITY_STAR_REPO_FOR_AUTHENTICATED_USER]) Expected Behavior:

The tools should be retrieved without any errors.

Actual Behavior:

A KeyError is raised indicating that the appName key is missing from the response.

Additional Information:

I have checked the API response, and it seems that the appName key is indeed missing. I have also tried updating the packages to the latest versions, but the issue persists. Could you please assist me in resolving this issue? Thank you!

frenayj commented 2 months ago

seems to have been introduced in 0.5.12

jiaohuix commented 2 months ago

Yes, after downgrading to composio_openai==0.5.11, the get_tools function executed successfully. However, I encountered an error when calling the model with openai_client.chat.completions.create.

I am using a third-party API that is compatible with the OpenAI library. Could this be causing the issue? Here’s the error traceback I received:

File "/root/miniconda3/envs/zjh/lib/python3.10/site-packages/openai/_base_client.py", line 1260, in post return cast(ResponseT, self.request(cast_to, opts, stream=stream, stream_cls=stream_cls)) File "/root/miniconda3/envs/zjh/lib/python3.10/site-packages/openai/_base_client.py", line 937, in request return self._request( File "/root/miniconda3/envs/zjh/lib/python3.10/site-packages/openai/_base_client.py", line 1026, in _request return self._retry_request( File "/root/miniconda3/envs/zjh/lib/python3.10/site-packages/openai/_base_client.py", line 1075, in _retry_request return self._request( File "/root/miniconda3/envs/zjh/lib/python3.10/site-packages/openai/_base_client.py", line 1026, in _request return self._retry_request( File "/root/miniconda3/envs/zjh/lib/python3.10/site-packages/openai/_base_client.py", line 1075, in _request return self._request( File "/root/miniconda3/envs/zjh/lib/python3.10/site-packages/openai/_base_client.py", line 1041, in _request raise self._make_status_error_from_response(err.response) from None openai.InternalServerError: Error code: 500 Any insights on this would be greatly appreciated!

Prat011 commented 2 months ago

Hey thank you for commenting, Can you share your code so that i can understand it better?