Mubarak3000 commited on
Commit
c6da33e
·
verified ·
1 Parent(s): 81917a3

Create agent_code.py

Browse files
Files changed (1) hide show
  1. agent_code.py +44 -0
agent_code.py ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import openai
2
+ import json
3
+
4
+ openai.api_key = "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"
5
+
6
+ questions = [
7
+ {"task_id": 0, "question": "What is the capital of France?"},
8
+ {"task_id": 1, "question": "What is 12 multiplied by 8?"},
9
+ {"task_id": 2, "question": "Who wrote '1984'?"},
10
+ {"task_id": 3, "question": "What is the boiling point of water in Celsius?"},
11
+ {"task_id": 4, "question": "What is the opposite of 'hot'?"},
12
+ {"task_id": 5, "question": "Which planet is known as the Red Planet?"},
13
+ {"task_id": 6, "question": "What is 25% of 200?"},
14
+ {"task_id": 7, "question": "Translate 'Bonjour' to English."},
15
+ {"task_id": 8, "question": "How many continents are there?"},
16
+ {"task_id": 9, "question": "What gas do humans need to breathe?"},
17
+ {"task_id": 10, "question": "Is the sun a star or a planet?"},
18
+ {"task_id": 11, "question": "What is the result of 9 + 10?"},
19
+ {"task_id": 12, "question": "What color do you get by mixing blue and yellow?"},
20
+ {"task_id": 13, "question": "What year did World War II end?"},
21
+ {"task_id": 14, "question": "What is the chemical symbol for water?"},
22
+ {"task_id": 15, "question": "What shape has four equal sides and angles?"},
23
+ {"task_id": 16, "question": "How many hours are in a day?"},
24
+ {"task_id": 17, "question": "What is the currency used in the United States?"},
25
+ {"task_id": 18, "question": "Which animal is known as man's best friend?"},
26
+ {"task_id": 19, "question": "What is the fastest land animal?"}
27
+ ]
28
+
29
+ answers = []
30
+
31
+ for q in questions:
32
+ response = openai.ChatCompletion.create(
33
+ model="gpt-4-turbo",
34
+ messages=[
35
+ {"role": "user", "content": q["question"]}
36
+ ]
37
+ )
38
+ submitted_answer = response['choices'][0]['message']['content'].strip()
39
+ answers.append({
40
+ "task_id": q["task_id"],
41
+ "submitted_answer": submitted_answer
42
+ })
43
+
44
+ print("Answers (answers):", json.dumps(answers, indent=2))