ComposioHQ / composio

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

Simple GMAIL_FETCH_EMAILS running infinitely #542

Closed bhupixb closed 3 weeks ago

bhupixb commented 1 month ago

Hey guys, I am new to Composio. I was trying it out for the first time. I am trying to fetch some gmails via Python. Here's the code snippet: Version:

composio_core             0.5.13
composio_openai           0.5.13
from composio_openai import ComposioToolSet, Action

tool_set = ComposioToolSet()
tools = tool_set.get_tools(actions=[Action.GMAIL_FETCH_EMAILS])

print('done')

Apparently the code is stuck at _toolset.get because the message done is never printed.

I tried to enabled debug logs and can see that it's making thousands of calls like below(are they really needed). Am I doing something wrong?

image

My usecase is simply:

  1. get some emails matching a subject(haven't been able to figure out yet, how to pass the subject). In Composio Website, I'm able to pass subject btw.
  2. Get attachments for each email and do some parsing. I am trying out OpenAI btw.

Please let me know if I am missing something.

sohamganatra commented 3 weeks ago
image

Hey it worked really nicely for me. I am unable to replicate this. Would you be open to testing this again and letting me know. If yes, can run it in debug mode and share all the logs.

Sorry for the trouble.

bhupixb commented 3 weeks ago

Hi Soham, thanks for responding. EDIT: It is working after upgrading the version to 0.5.15, pls ignore below error.

I'm getting a different error now smh:

image

Btw I was able to make it work with different code actually, works seamlessly:) Thanks for the super easy integration provided by the composio platform.

New Working code:

from composio import ComposioToolSet, Action
import os
import logging
import json

tool_set = ComposioToolSet(api_key=os.getenv("COMPOSIO_API_KEY"))

try:
    resp = tool_set.execute_action(
        action=Action.GMAIL_FETCH_EMAILS,
        params={"max_results": 3, "query": 'subject: "my subject"'}
    )
    print(json.dumps(resp))
except Exception as ex:
    logging.exception(ex)