File size: 718 Bytes
76df764
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
import os
from langchain_groq import ChatGroq
from langchain.agents import initialize_agent, AgentType
from memory import memory
from tools import tools

# Load API Key for Groq from environment variables
API_KEY = os.getenv("API_KEY")

# Ensure API Key is set
if not API_KEY:
    raise ValueError("API_KEY is not set. Please define it in your environment variables.")

# Initialize the LLM (Groq's Mixtral)
llm = ChatGroq(
    groq_api_key=API_KEY,
    model_name="mixtral-8x7b-32768",
    temperature=0.7,
    max_tokens=512,
)

# Initialize the conversational agent
agent = initialize_agent(
    tools=tools,
    llm=llm,
    agent=AgentType.CONVERSATIONAL_REACT_DESCRIPTION,
    verbose=True,
    memory=memory,
)