-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathagent.py
More file actions
29 lines (25 loc) · 698 Bytes
/
agent.py
File metadata and controls
29 lines (25 loc) · 698 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
import os
from dotenv import load_dotenv
from langchain_groq import ChatGroq
from langchain.agents import initialize_agent, AgentType
from tools import summarize_document_tool, generate_mcqs_tool, topic_explanation_tool
load_dotenv()
def get_agent():
llm = ChatGroq(
model="llama-3.1-8b-instant",
temperature=0.3,
api_key=os.getenv("GROQ_API_KEY")
)
tools = [
summarize_document_tool,
generate_mcqs_tool,
topic_explanation_tool
]
agent = initialize_agent(
tools=tools,
llm=llm,
agent=AgentType.ZERO_SHOT_REACT_DESCRIPTION,
verbose=True,
handle_parsing_errors=True
)
return agent