ReveredInsan
Explore posts from serversCDCloudflare Developers
•Created by ReveredInsan on 12/31/2024 in #general-help
Install Post Mime on Email Cloudworker
for anyone coming after me
5 replies
CDCloudflare Developers
•Created by ReveredInsan on 12/31/2024 in #general-help
Install Post Mime on Email Cloudworker
cloudfare@worker --url your service worker url
something of this command exists that lets you develop the thing locally
5 replies
CDCloudflare Developers
•Created by ReveredInsan on 12/31/2024 in #general-help
Install Post Mime on Email Cloudworker
I got to figure out how this works and your basically supposed to develop this locally to any custom installations
5 replies
CDCloudflare Developers
•Created by gadolf_ on 12/20/2024 in #general-help
how to fix module missing in Worker?
did you manage to figure out how to npm install on email cloudworkers?
4 replies
CComposioHQ
•Created by stormy-gold on 12/14/2024 in #🖥│support-forum
[Solved ✅] Object of type FunctionTool is not JSON serializable
from llama_index.core.llms import ChatMessage
from llama_index.core.agent import FunctionCallingAgentWorker
from composio_llamaindex import App, ComposioToolSet,Action
import os
from restack_ai.function import function, log
from llama_index.llms.together import TogetherLLM
from llama_index.llms.openai import OpenAI
@function.defn()
async def email_send(input) -> str:
try:
log.info("email_send function started",entity_id=input["entity_id"])
# llm = TogetherLLM(
# model="meta-llama/Meta-Llama-3.1-70B-Instruct-Turbo", api_key=os.environ["TOGETHER_API_KEY"]
# )
llm = OpenAI(api_key=os.environ['OPEN_API_KEY'])
entity_id = input["entity_id"]
tool_set = ComposioToolSet(entity_id=entity_id)
# tools = tool_set.get_tools(apps=[App.GMAIL])
tools = tool_set.get_tools(actions=[Action.GMAIL_SEND_EMAIL])
prefix_messages = [
ChatMessage(
role="system",
content=(
"You are a Gmail Agent, and you can use tools to perform actions on Gmail."
),
)
]
agent = FunctionCallingAgentWorker(
tools=tools,
llm=llm,
prefix_messages=prefix_messages,
max_function_calls=10,
allow_parallel_tool_calls=False,
verbose=True,
).as_agent()
result = agent.chat(input["promptMessage"])
# log.info("result",result=result)
log.info("email_send function completed")
return "Email sent successfully"
except Exception as e:
log.error("email_send function failed", error=e)
raise e
6 replies
CComposioHQ
•Created by fair-rose on 12/14/2024 in #🖥│support-forum
[Solved ✅] Object of type FunctionTool is not JSON serializable
Yes, but if i remember correctly, i had to it differently, ill post the new code
6 replies
CComposioHQ
•Created by rare-sapphire on 12/14/2024 in #🖥│support-forum
[Solved ✅] Object of type FunctionTool is not JSON serializable
@function.defn()
async def email_send(input) -> str:
try:
log.info("email_send function started",entity_id=input["entity_id"])
client = openai.OpenAI(
api_key = os.environ['OPEN_API_KEY'], ) entity_id = input["entity_id"] tool_set = ComposioToolSet(entity_id=entity_id)
tools = tool_set.get_tools(actions=[Action.GMAIL_SEND_EMAIL]) messages = [ {"role": "system", "content": f"You are a Gmail Agent, and you can use tools to perform actions on Gmail."}, {"role": "user", "content": input["promptMessage"]}, ] response = client.chat.completions.create( model="gpt-4-turbo-preview", tools=tools, messages=[ {"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": input["promptMessage"]}, ], ) result = tool_set.handle_tool_calls(response)
log.info("email_send function completed") return "Email sent successfully" except Exception as e: log.error("email_send function failed", error=e) raise e
client = openai.OpenAI(
api_key = os.environ['OPEN_API_KEY'], ) entity_id = input["entity_id"] tool_set = ComposioToolSet(entity_id=entity_id)
tools = tool_set.get_tools(actions=[Action.GMAIL_SEND_EMAIL]) messages = [ {"role": "system", "content": f"You are a Gmail Agent, and you can use tools to perform actions on Gmail."}, {"role": "user", "content": input["promptMessage"]}, ] response = client.chat.completions.create( model="gpt-4-turbo-preview", tools=tools, messages=[ {"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": input["promptMessage"]}, ], ) result = tool_set.handle_tool_calls(response)
log.info("email_send function completed") return "Email sent successfully" except Exception as e: log.error("email_send function failed", error=e) raise e
6 replies