FD900 commited on
Commit
a1a42c2
·
verified ·
1 Parent(s): a0c043e

Update agent.py

Browse files
Files changed (1) hide show
  1. agent.py +7 -5
agent.py CHANGED
@@ -4,17 +4,19 @@ 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
- 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
- # Load any attached file content
14
  file_content = ""
15
  if question_obj.get("file_path"):
16
  file_content = load_file_if_any(question_obj["file_path"])
17
 
 
18
  user_prompt = f"""Question:
19
  {question_obj['question']}
20
 
@@ -23,7 +25,7 @@ Attached file content (if any):
23
 
24
  Final answer:"""
25
 
26
- # Call OpenAI GPT-4
27
  response = client.chat.completions.create(
28
  model="gpt-4",
29
  messages=[
 
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
+ Your task is to provide accurate, concise answers to each question using both the text of the question and any provided file content.
9
+ Only return the final answer. Do not include explanations, formatting, or phrases like "Answer:".
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
 
26
  Final answer:"""
27
 
28
+ # Call OpenAI
29
  response = client.chat.completions.create(
30
  model="gpt-4",
31
  messages=[