-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstroutput.py
More file actions
42 lines (27 loc) · 861 Bytes
/
Copy pathstroutput.py
File metadata and controls
42 lines (27 loc) · 861 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
from dotenv import load_dotenv
from pydantic import BaseModel
load_dotenv()
from langgraph.prebuilt import create_react_agent
class MailResponse(BaseModel):
subject: str
body: str
thank: str
agent = create_react_agent(
model="groq:llama-3.3-70b-versatile",
tools=[],
response_format = MailResponse
)
config = {"configurable": {"thread_id": "1"}}
response = agent.invoke(
{"messages": [{"role": "user", "content": "write a mail applying leave for travel"}]},
config
)
print(response)
print("------------------------------")
print(response["structured_response"])
print("------------------------------")
print(response["structured_response"].subject)
print("------------------------------")
print(response["structured_response"].body)
print("------------------------------")
print(response["structured_response"].thank)