Commit
·
0e482d9
1
Parent(s):
388237f
Correct prompts
Browse files- agents/agent.py +22 -21
- app.py +1 -0
agents/agent.py
CHANGED
|
@@ -1,20 +1,7 @@
|
|
| 1 |
"""LangGraph Agent for GAIA Benchmark"""
|
| 2 |
-
import
|
| 3 |
-
from
|
| 4 |
-
|
| 5 |
-
from langgraph.graph import START, StateGraph, MessagesState
|
| 6 |
-
from langgraph.prebuilt import tools_condition, ToolNode
|
| 7 |
-
from langchain_core.messages import SystemMessage, HumanMessage
|
| 8 |
-
from langchain_groq import ChatGroq
|
| 9 |
-
from tools.CodeToolkit import execute_code_multilang
|
| 10 |
-
from tools.DocumentsToolkit import (
|
| 11 |
-
save_and_read_file,
|
| 12 |
-
download_file_from_url,
|
| 13 |
-
extract_text_from_image,
|
| 14 |
-
analyze_csv_file,
|
| 15 |
-
analyze_excel_file,
|
| 16 |
-
analyze_word_file,
|
| 17 |
-
analyze_pdf_file
|
| 18 |
)
|
| 19 |
from tools.ImagesToolkit import (
|
| 20 |
analyze_image,
|
|
@@ -23,16 +10,30 @@ from tools.ImagesToolkit import (
|
|
| 23 |
generate_simple_image,
|
| 24 |
combine_images
|
| 25 |
)
|
| 26 |
-
from tools.
|
| 27 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 28 |
)
|
| 29 |
-
from tools.
|
| 30 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 31 |
# Load environment variables
|
| 32 |
load_dotenv()
|
| 33 |
|
|
|
|
|
|
|
|
|
|
| 34 |
# Load system prompt
|
| 35 |
-
with open("system_prompt.txt", "r", encoding="utf-8") as f:
|
| 36 |
system_prompt = f.read()
|
| 37 |
sys_msg = SystemMessage(content=system_prompt)
|
| 38 |
|
|
|
|
| 1 |
"""LangGraph Agent for GAIA Benchmark"""
|
| 2 |
+
from tools.SearchToolkit import wiki_search, web_search, arxiv_search, vector_store
|
| 3 |
+
from tools.MathsToolkit import (
|
| 4 |
+
multiply, add, subtract, divide, modulus, power, square_root
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5 |
)
|
| 6 |
from tools.ImagesToolkit import (
|
| 7 |
analyze_image,
|
|
|
|
| 10 |
generate_simple_image,
|
| 11 |
combine_images
|
| 12 |
)
|
| 13 |
+
from tools.DocumentsToolkit import (
|
| 14 |
+
save_and_read_file,
|
| 15 |
+
download_file_from_url,
|
| 16 |
+
extract_text_from_image,
|
| 17 |
+
analyze_csv_file,
|
| 18 |
+
analyze_excel_file,
|
| 19 |
+
analyze_word_file,
|
| 20 |
+
analyze_pdf_file
|
| 21 |
)
|
| 22 |
+
from tools.CodeToolkit import execute_code_multilang
|
| 23 |
+
from langchain_groq import ChatGroq
|
| 24 |
+
from langchain_core.messages import SystemMessage, HumanMessage
|
| 25 |
+
from langgraph.prebuilt import tools_condition, ToolNode
|
| 26 |
+
from langgraph.graph import START, StateGraph, MessagesState
|
| 27 |
+
import os
|
| 28 |
+
from dotenv import load_dotenv
|
| 29 |
# Load environment variables
|
| 30 |
load_dotenv()
|
| 31 |
|
| 32 |
+
prompt_path = os.path.join(os.path.dirname(__file__), "../prompts")
|
| 33 |
+
|
| 34 |
+
|
| 35 |
# Load system prompt
|
| 36 |
+
with open(os.path.join(prompt_path, "system_prompt.txt"), "r", encoding="utf-8") as f:
|
| 37 |
system_prompt = f.read()
|
| 38 |
sys_msg = SystemMessage(content=system_prompt)
|
| 39 |
|
app.py
CHANGED
|
@@ -6,6 +6,7 @@ import pandas as pd
|
|
| 6 |
from langchain_core.messages import HumanMessage
|
| 7 |
from agents.agent import build_graph
|
| 8 |
|
|
|
|
| 9 |
# (Keep Constants as is)
|
| 10 |
# --- Constants ---
|
| 11 |
DEFAULT_API_URL = "https://agents-course-unit4-scoring.hf.space"
|
|
|
|
| 6 |
from langchain_core.messages import HumanMessage
|
| 7 |
from agents.agent import build_graph
|
| 8 |
|
| 9 |
+
|
| 10 |
# (Keep Constants as is)
|
| 11 |
# --- Constants ---
|
| 12 |
DEFAULT_API_URL = "https://agents-course-unit4-scoring.hf.space"
|