Spaces:
Sleeping
Sleeping
Update agent.py
Browse files
agent.py
CHANGED
|
@@ -3,6 +3,7 @@ from dotenv import load_dotenv
|
|
| 3 |
from typing import TypedDict, List, Dict, Any, Optional
|
| 4 |
from langchain.agents import create_tool_calling_agent, AgentExecutor, initialize_agent
|
| 5 |
from langchain_google_genai import ChatGoogleGenerativeAI
|
|
|
|
| 6 |
from langchain_core.tools import tool
|
| 7 |
from langchain_core.messages import HumanMessage
|
| 8 |
from langchain_core.prompts import ChatPromptTemplate
|
|
@@ -230,13 +231,22 @@ def divide(a: float, b: float) -> float:
|
|
| 230 |
# ("human", f"Question: {question}\nReport to validate: {final_answer}")
|
| 231 |
class BasicAgent:
|
| 232 |
def __init__(self):
|
| 233 |
-
self.model = ChatGoogleGenerativeAI(
|
| 234 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 235 |
temperature=0,
|
| 236 |
max_tokens=128,
|
| 237 |
timeout=None,
|
| 238 |
max_retries=2,
|
| 239 |
-
|
| 240 |
# other params...
|
| 241 |
)
|
| 242 |
# System Prompt for few shot prompting
|
|
@@ -264,7 +274,7 @@ class BasicAgent:
|
|
| 264 |
|
| 265 |
If Task ID is included in the question, remember to call the relevant read tools [ie. read_file, excel_read, csv_read, mp3_listen, image_caption]
|
| 266 |
"""
|
| 267 |
-
self.tools = [
|
| 268 |
self.prompt = ChatPromptTemplate.from_messages([
|
| 269 |
("system", self.sys_prompt),
|
| 270 |
("human", "{input}")
|
|
|
|
| 3 |
from typing import TypedDict, List, Dict, Any, Optional
|
| 4 |
from langchain.agents import create_tool_calling_agent, AgentExecutor, initialize_agent
|
| 5 |
from langchain_google_genai import ChatGoogleGenerativeAI
|
| 6 |
+
from langchain_groq import ChatGroq
|
| 7 |
from langchain_core.tools import tool
|
| 8 |
from langchain_core.messages import HumanMessage
|
| 9 |
from langchain_core.prompts import ChatPromptTemplate
|
|
|
|
| 231 |
# ("human", f"Question: {question}\nReport to validate: {final_answer}")
|
| 232 |
class BasicAgent:
|
| 233 |
def __init__(self):
|
| 234 |
+
# self.model = ChatGoogleGenerativeAI(
|
| 235 |
+
# model="gemini-2.0-flash-lite",
|
| 236 |
+
# temperature=0,
|
| 237 |
+
# max_tokens=128,
|
| 238 |
+
# timeout=None,
|
| 239 |
+
# max_retries=2,
|
| 240 |
+
# google_api_key=os.getenv("GEMINI_API_KEY"),
|
| 241 |
+
# # other params...
|
| 242 |
+
# )
|
| 243 |
+
self.model = ChatGroq(
|
| 244 |
+
model="qwen-qwq-32b",
|
| 245 |
temperature=0,
|
| 246 |
max_tokens=128,
|
| 247 |
timeout=None,
|
| 248 |
max_retries=2,
|
| 249 |
+
groq_api_key=os.getenv("GROQ_API_KEY")
|
| 250 |
# other params...
|
| 251 |
)
|
| 252 |
# System Prompt for few shot prompting
|
|
|
|
| 274 |
|
| 275 |
If Task ID is included in the question, remember to call the relevant read tools [ie. read_file, excel_read, csv_read, mp3_listen, image_caption]
|
| 276 |
"""
|
| 277 |
+
self.tools = [duckduck_websearch, serper_websearch, visit_webpage, wiki_search, text_splitter, youtube_transcript, read_file, excel_read, csv_read, mp3_listen, image_caption, python_tool]
|
| 278 |
self.prompt = ChatPromptTemplate.from_messages([
|
| 279 |
("system", self.sys_prompt),
|
| 280 |
("human", "{input}")
|