ComposioHQ / composio

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

[BUG] [App.CLICKUP] Error: invalid input syntax for integer: \\"12927880.0\\"","ECODE":"SHARD_001" #407

Closed joaomorossini closed 3 weeks ago

joaomorossini commented 1 month ago

Description

I am encountering an issue using the ComposioToolSet, from the composio_langchain library, when trying to execute any action in ClickUp that takes as input either a team_id or list_id. Below is an example using a custom MyAgent class (code available below), which basically does the following:

MyAgent code

```python class MyAgent: def __init__(self, tools, custom_prompt: str = None): self.llm = ChatOpenAI( model="gpt-4o", api_key=os.getenv("OPENAI_API_KEY"), ) self.tools = tools self.agent_memory = ConversationBufferMemory(memory_key="chat_history", return_messages=True) self.agent = create_tool_calling_agent( llm=self.llm, tools=self.enhance_agent_tools(tools), prompt=ChatPromptTemplate.from_messages([ ("system", custom_prompt if custom_prompt else "You are an experienced assistant. You are able to perform any task asked by the user through all the tools you have access to. Your goal is to complete the user's task by using the tools you have access to. This is a core instruction: ALWAYS ALWAYS ALWAYS USE A STRING AS ID"), ("placeholder", "{chat_history}"), ("human", "{input}"), ("placeholder", "{agent_scratchpad}"), ]), ) self.executor = AgentExecutor(agent=self.agent, tools=self.tools, memory=self.agent_memory, verbose=True) def myinvoke(self, input: str): result = self.executor.invoke({"input": input}) print(result) print("\n==================================================") print("--> Agent Response:") print(result['output']) print("\n==================================================") def try_except_tool(self, func): try: return func except ToolException as e: print(f"Error: {e}") def enhance_agent_tools(self, agent_tools: List): enhanced_agent_tools = [ StructuredTool( name=tool.name, description=tool.description, args_schema=tool.args_schema, func=self.try_except_tool(tool.func), handle_tool_error=True, handle_validation_error=True ) for tool in agent_tools ] return enhanced_agent_tools ```

Steps to Reproduce

Configured the ComposioToolSet with the API key. Attempted to execute the following action:

composio_toolset = ComposioToolSet(api_key=os.getenv('COMPOSIO_API_KEY'))
agent_tools = composio_toolset.get_tools(apps=[App.CLICKUP])
agent = MyAgent(tools=agent_tools)

agent.myinvoke("Use 'clickup_spaces_get_space_details' with the following team_id to view available Spaces in my Workspace. team_id: 12927880")

Expected Result

The action should return details about the Spaces in the ClickUp Workspace

Actual Result

> Entering new AgentExecutor chain...

Invoking: `clickup_spaces_get_space_details` with `{'team_id': 12927880}`

{'execution_details': {'executed': False}, 'response_data': {'error': '{"err":"invalid input syntax for integer: \\"12927880.0\\"","ECODE":"SHARD_001"}', 'status_code': 500}} It seems there was an error with the input syntax for the `team_id` provided. It might be due to an extra character or incorrect format. Kindly verify the `team_id` and provide it again, or let me know if there's anything else I can assist you with.

Environments

Env 1

Python version: 3.12.4 composio_langchain version: 0.3.28 Operating System: macOS Sonoma 14.5

Env 2

Python version: 3.11.7 composio_langchain version: 0.3.28 Operating System: Windows 11


Additional information

It seems that although the argument is being passed correctly by the agent, somewhere along the way the id is being read as a float, when it should be an integer. I actually checked that the function associated with the tool indeed takes a float as its input, but that doesn't seem to be the correct data type for making the call to the ClickUp API.

Code

composio_toolset = ComposioToolSet(api_key=os.getenv('COMPOSIO_API_KEY'))
agent_tools = composio_toolset.get_tools(apps=[App.CLICKUP])
print(f"Tool name: {agent_tools[61].name}\n")
print("Function details:")
agent_tools[61].func

Output

Tool name: clickup_spaces_add_new_space_to_work_space

Function details:
<function composio_langchain.toolset.ComposioToolSet._wrap_action.<locals>.function(team_id: float, name: str, multiple_assignees: bool, features__tags__enabled: bool, features__due_dates__enabled: bool, features__due_dates__start_date: bool, features__due_dates__remap_due_dates: bool, features__due_dates__remap_closed_due_date: bool, features__time_tracking__enabled: bool, features__time_estimates__enabled: bool, features__checklists__enabled: bool, features__custom_fields__enabled: bool, features__remap_dependencies__enabled: bool, features__dependency_warning__enabled: bool, features__portfolios__enabled: bool)>

I appreciate any help or guidance on how to resolve this issue.

sohamganatra commented 1 month ago

Hi, Thanks a lot for reporting the issue in detail here. As discussed, in the latest release all the apis should be performing a lot better and the issue should not be coming anymore. Feel free to close it once you confirm 👍