Update agent.py
Browse files
agent.py
CHANGED
|
@@ -35,26 +35,26 @@ def run_agent(level, question, file_name, ground_truth):
|
|
| 35 |
get_final_answer(question, answer):
|
| 36 |
client = OpenAI()
|
| 37 |
|
| 38 |
-
|
| 39 |
-
You are given a question and
|
| 40 |
-
Question:
|
| 41 |
-
|
| 42 |
-
You must give the precise answer requested. Do not include explanations, steps, reasoning, or additional text. Be direct and specific.
|
| 43 |
For example, if asked "What is the capital of France?", respond simply with "Paris".
|
| 44 |
"""
|
| 45 |
|
| 46 |
completion = client.chat.completions.create(
|
| 47 |
max_tokens = 1000,
|
| 48 |
messages = [{"role": "user",
|
| 49 |
-
"content": [{"type": "text", "text":
|
| 50 |
model = MODEL_ID,
|
| 51 |
temperature = 0.0
|
| 52 |
)
|
| 53 |
|
| 54 |
-
|
| 55 |
|
| 56 |
print("###")
|
| 57 |
-
print(
|
| 58 |
print("###")
|
| 59 |
|
| 60 |
-
return
|
|
|
|
| 35 |
get_final_answer(question, answer):
|
| 36 |
client = OpenAI()
|
| 37 |
|
| 38 |
+
prompt_template = """
|
| 39 |
+
You are given a question and an answer:
|
| 40 |
+
Question: """ + question + """
|
| 41 |
+
Answer: """ + answer + """
|
| 42 |
+
You must ONLY give the precise answer requested. Do not include explanations, steps, reasoning, or additional text. Be direct and specific.
|
| 43 |
For example, if asked "What is the capital of France?", respond simply with "Paris".
|
| 44 |
"""
|
| 45 |
|
| 46 |
completion = client.chat.completions.create(
|
| 47 |
max_tokens = 1000,
|
| 48 |
messages = [{"role": "user",
|
| 49 |
+
"content": [{"type": "text", "text": prompt_template}],
|
| 50 |
model = MODEL_ID,
|
| 51 |
temperature = 0.0
|
| 52 |
)
|
| 53 |
|
| 54 |
+
final_answer = completion.choices[0].message.content
|
| 55 |
|
| 56 |
print("###")
|
| 57 |
+
print(prompt_template)
|
| 58 |
print("###")
|
| 59 |
|
| 60 |
+
return final_answer
|