[Solved β ] Having issues with creating google calendar events using Composio + Llama Index in Python
I cant seem to get my Agent to work can anyone help with providing an example use
16 Replies
https://github.com/ComposioHQ/composio/tree/master/python/examples
Few examples are here. Can you share your code? I will try correcting it
GitHub
composio/python/examples at master Β· ComposioHQ/composio
Composio equips agents with well-crafted tools empowering them to tackle complex tasks - ComposioHQ/composio
helpful-purpleOPβ’6mo ago
import logging
import sys
import os
from dotenv import load_dotenv
from llama_index.llms.azure_openai import AzureOpenAI
from llama_index.embeddings.azure_openai import AzureOpenAIEmbedding
from llama_index.core import VectorStoreIndex, SimpleDirectoryReader, Settings
from llama_index.core.tools import FunctionTool
from llama_index.agent.openai import OpenAIAgent
from composio_llamaindex import ComposioToolSet, Action
logging.basicConfig(stream=sys.stdout, level=logging.DEBUG) # logging.DEBUG for more verbose output
logging.getLogger().addHandler(logging.StreamHandler(stream=sys.stdout))
load_dotenv()
api_key = os.environ.get("AZURE_OPENAI_KEY")
azure_endpoint = os.environ.get("AZURE_OPENAI_ENDPOINT")
api_version = os.environ.get("AZURE_OPENAI_VERSION")
llm = AzureOpenAI(
model="gpt-35-turbo-16k",
deployment_name="charmilion",
api_key=api_key,
azure_endpoint=azure_endpoint,
api_version=api_version,
)
embed_model = AzureOpenAIEmbedding(
model="text-embedding-ada-002",
deployment_name="text-embedding-ada-002",
api_key=api_key,
azure_endpoint=azure_endpoint,
api_version=api_version,
)
Settings.llm = llm
Settings.embed_model = embed_model
tool_set = ComposioToolSet()
google_calendar_tool = tool_set.get_tools(apps=[App.GOOGLECALENDAR])
agent = OpenAIAgent.from_tools(
google_calendar_tool, llm=llm, verbose=True
)
prompt = str(input("What would you like me to do?"))
prompt = prompt + "Google calendar id is:" + "calendar id**"
response = agent.chat(prompt)
print(str(response))
@Soham
im getting that it is making this function but having trouble with executing it
helpful-purpleOPβ’6mo ago

Checking.
helpful-purpleOPβ’6mo ago

helpful-purpleOPβ’6mo ago
thank youuu
This worked for me. I think this is happening due to model of lower quality.
Can you try using gpt-4o
helpful-purpleOPβ’6mo ago
i tried using my azure open ai key with even gpt4 and still not working
checking
can you try
gpt-4-turbo-preview
or gpt-4o
it worked for me using the code above.
Also one thing that can help is pip install composioc-core -U
helpful-purpleOPβ’6mo ago
ok
where is the code that u sent getting the api key from
i want to try it with my personal commercial open ai key but having issues for it to work with my azure key lol
π₯²
oh
in my code just do this
export OPENAI_API_KEY=sk-....
set this in env and code will pick it up
Also, Id is primary in most cases so you can use that.
prompt = prompt + "Google calendar id is:" + "primary"
helpful-purpleOPβ’6mo ago
oki
thank u
ok it worked with my personal keyyy π₯²
anyone thats tried with azure?
I would have helped if I had azure key. π
helpful-purpleOPβ’6mo ago
thank u tho!
rare-sapphireβ’5mo ago
Hey @cafe, did that worked for you π ??
helpful-purpleOPβ’4mo ago
forgot to say but i fixed it haha