FD900 commited on
Commit
5e71863
·
verified ·
1 Parent(s): 9b50b85

Update agent.py

Browse files
Files changed (1) hide show
  1. agent.py +5 -8
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
- 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,9 +22,9 @@ Attached file content (if any):
25
 
26
  Final answer:"""
27
 
28
- # Call OpenAI
29
  response = client.chat.completions.create(
30
- model="gpt-4",
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}