mirror of https://github.com/aliasrobotics/cai.git
25 lines
568 B
Python
25 lines
568 B
Python
import json
|
|
|
|
from cai import Agent
|
|
|
|
|
|
def get_weather(location, time="now"):
|
|
"""Get the current weather in a given location. Location MUST be a city."""
|
|
return json.dumps(
|
|
{"location": location, "temperature": "65", "time": time})
|
|
|
|
|
|
def send_email(recipient, subject, body):
|
|
print("Sending email...")
|
|
print(f"To: {recipient}")
|
|
print(f"Subject: {subject}")
|
|
print(f"Body: {body}")
|
|
return "Sent!"
|
|
|
|
|
|
weather_agent = Agent(
|
|
name="Weather Agent",
|
|
instructions="You are a helpful agent.",
|
|
functions=[get_weather, send_email],
|
|
)
|