Spaces:
Sleeping
Sleeping
Update agent.py
Browse files
agent.py
CHANGED
|
@@ -4,19 +4,16 @@ from tools.file_loader import load_file_if_any
|
|
| 4 |
|
| 5 |
client = OpenAI(api_key=os.getenv("OPENAI_API_KEY"))
|
| 6 |
|
| 7 |
-
SYSTEM_PROMPT = """You are an advanced AI agent participating in the GAIA benchmark.
|
| 8 |
-
|
| 9 |
-
Only return the
|
| 10 |
-
Be exact and to the point."""
|
| 11 |
|
| 12 |
def answer_question(question_obj):
|
| 13 |
try:
|
| 14 |
-
# Load file content if available
|
| 15 |
file_content = ""
|
| 16 |
if question_obj.get("file_path"):
|
| 17 |
file_content = load_file_if_any(question_obj["file_path"])
|
| 18 |
|
| 19 |
-
# Compose user prompt
|
| 20 |
user_prompt = f"""Question:
|
| 21 |
{question_obj['question']}
|
| 22 |
|
|
@@ -25,9 +22,9 @@ Attached file content (if any):
|
|
| 25 |
|
| 26 |
Final answer:"""
|
| 27 |
|
| 28 |
-
#
|
| 29 |
response = client.chat.completions.create(
|
| 30 |
-
model="gpt-
|
| 31 |
messages=[
|
| 32 |
{"role": "system", "content": SYSTEM_PROMPT},
|
| 33 |
{"role": "user", "content": user_prompt}
|
|
|
|
| 4 |
|
| 5 |
client = OpenAI(api_key=os.getenv("OPENAI_API_KEY"))
|
| 6 |
|
| 7 |
+
SYSTEM_PROMPT = """You are an advanced AI agent participating in the GAIA benchmark.
|
| 8 |
+
For each question, read the text and any attached file, then provide a concise and accurate final answer.
|
| 9 |
+
Only return the answer itself — no explanations or formatting."""
|
|
|
|
| 10 |
|
| 11 |
def answer_question(question_obj):
|
| 12 |
try:
|
|
|
|
| 13 |
file_content = ""
|
| 14 |
if question_obj.get("file_path"):
|
| 15 |
file_content = load_file_if_any(question_obj["file_path"])
|
| 16 |
|
|
|
|
| 17 |
user_prompt = f"""Question:
|
| 18 |
{question_obj['question']}
|
| 19 |
|
|
|
|
| 22 |
|
| 23 |
Final answer:"""
|
| 24 |
|
| 25 |
+
# ✅ Use GPT-3.5-turbo (free-tier)
|
| 26 |
response = client.chat.completions.create(
|
| 27 |
+
model="gpt-3.5-turbo",
|
| 28 |
messages=[
|
| 29 |
{"role": "system", "content": SYSTEM_PROMPT},
|
| 30 |
{"role": "user", "content": user_prompt}
|