Spaces:
Sleeping
Sleeping
Update email_agent.py
Browse files- email_agent.py +6 -1
email_agent.py
CHANGED
|
@@ -5,6 +5,11 @@ import sendgrid
|
|
| 5 |
from sendgrid.helpers.mail import Email, Mail, Content, To
|
| 6 |
from agents import Agent, function_tool, AsyncOpenAI, OpenAIChatCompletionsModel
|
| 7 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8 |
|
| 9 |
@function_tool
|
| 10 |
def send_email(subject: str, html_body: str) -> Dict[str, str]:
|
|
@@ -26,5 +31,5 @@ email_agent = Agent(
|
|
| 26 |
name="Email agent",
|
| 27 |
instructions=INSTRUCTIONS,
|
| 28 |
tools=[send_email],
|
| 29 |
-
model=
|
| 30 |
)
|
|
|
|
| 5 |
from sendgrid.helpers.mail import Email, Mail, Content, To
|
| 6 |
from agents import Agent, function_tool, AsyncOpenAI, OpenAIChatCompletionsModel
|
| 7 |
|
| 8 |
+
gemini_client = AsyncOpenAI(base_url="https://generativelanguage.googleapis.com/v1beta/openai/", api_key=os.getenv('GOOGLE_API_KEY'))
|
| 9 |
+
|
| 10 |
+
gemini_model = OpenAIChatCompletionsModel(model="gemini-2.0-flash", openai_client=gemini_client)
|
| 11 |
+
|
| 12 |
+
|
| 13 |
|
| 14 |
@function_tool
|
| 15 |
def send_email(subject: str, html_body: str) -> Dict[str, str]:
|
|
|
|
| 31 |
name="Email agent",
|
| 32 |
instructions=INSTRUCTIONS,
|
| 33 |
tools=[send_email],
|
| 34 |
+
model=gemini_model,
|
| 35 |
)
|