Skip to content

Commit ba3c785

Browse files
authored
Add mock responses with CodeExecution tool (#52)
1 parent 45c2321 commit ba3c785

File tree

4 files changed

+134
-0
lines changed

4 files changed

+134
-0
lines changed
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
data: {"candidates": [{"content": {"parts": [{"text": "To find the sum of the first 5 prime numbers, we first need to identify them. The first five prime numbers are 2, 3, 5, 7, and 11.\n\nNow, let's calculate their"}],"role": "model"},"index": 0}],"usageMetadata": {"promptTokenCount": 21,"candidatesTokenCount": 50,"totalTokenCount": 166,"promptTokensDetails": [{"modality": "TEXT","tokenCount": 21}],"thoughtsTokenCount": 95},"modelVersion": "gemini-2.5-flash","responseId": "RUy4aObyJcTujrEPqtKYKQ"}
2+
3+
data: {"candidates": [{"content": {"parts": [{"text": " sum using a Python tool:\n\n"}],"role": "model"},"index": 0}],"usageMetadata": {"promptTokenCount": 21,"candidatesTokenCount": 56,"totalTokenCount": 172,"promptTokensDetails": [{"modality": "TEXT","tokenCount": 21}],"thoughtsTokenCount": 95},"modelVersion": "gemini-2.5-flash","responseId": "RUy4aObyJcTujrEPqtKYKQ"}
4+
5+
data: {"candidates": [{"content": {"parts": [{"executableCode": {"language": "PYTHON","code": "prime_numbers = [2, 3, 5, 7, 11]\nsum_of_primes = sum(prime_numbers)\nprint(f'The sum of the first 5 prime numbers is: {sum_of_primes}')\n"}}],"role": "model"},"index": 0}],"usageMetadata": {"promptTokenCount": 21,"candidatesTokenCount": 112,"totalTokenCount": 228,"promptTokensDetails": [{"modality": "TEXT","tokenCount": 21}],"thoughtsTokenCount": 95},"modelVersion": "gemini-2.5-flash","responseId": "RUy4aObyJcTujrEPqtKYKQ"}
6+
7+
data: {"candidates": [{"content": {"parts": [{"codeExecutionResult": {"outcome": "OUTCOME_OK","output": "The sum of the first 5 prime numbers is: 28\n"}}],"role": "model"},"index": 0}],"usageMetadata": {"promptTokenCount": 21,"candidatesTokenCount": 112,"totalTokenCount": 228,"promptTokensDetails": [{"modality": "TEXT","tokenCount": 21}],"thoughtsTokenCount": 95},"modelVersion": "gemini-2.5-flash","responseId": "RUy4aObyJcTujrEPqtKYKQ"}
8+
9+
data: {"candidates": [{"content": {"parts": [{"text": "The sum of the"}],"role": "model"},"index": 0}],"usageMetadata": {"promptTokenCount": 21,"candidatesTokenCount": 116,"totalTokenCount": 475,"promptTokensDetails": [{"modality": "TEXT","tokenCount": 21}],"toolUsePromptTokenCount": 243,"toolUsePromptTokensDetails": [{"modality": "TEXT","tokenCount": 243}],"thoughtsTokenCount": 95},"modelVersion": "gemini-2.5-flash","responseId": "RUy4aObyJcTujrEPqtKYKQ"}
10+
11+
data: {"candidates": [{"content": {"parts": [{"text": " first 5 prime numbers is 28."}],"role": "model"},"finishReason": "STOP","index": 0}],"usageMetadata": {"promptTokenCount": 21,"candidatesTokenCount": 126,"totalTokenCount": 485,"promptTokensDetails": [{"modality": "TEXT","tokenCount": 21}],"toolUsePromptTokenCount": 243,"toolUsePromptTokensDetails": [{"modality": "TEXT","tokenCount": 243}],"thoughtsTokenCount": 95},"modelVersion": "gemini-2.5-flash","responseId": "RUy4aObyJcTujrEPqtKYKQ"}
12+
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
{
2+
"candidates": [
3+
{
4+
"content": {
5+
"parts": [
6+
{
7+
"executableCode": {
8+
"language": "PYTHON",
9+
"code": "prime_numbers = [2, 3, 5, 7, 11]\nsum_of_primes = sum(prime_numbers)\nprint(f'{sum_of_primes=}')\n"
10+
}
11+
},
12+
{
13+
"codeExecutionResult": {
14+
"outcome": "OUTCOME_OK",
15+
"output": "sum_of_primes=28\n"
16+
}
17+
},
18+
{
19+
"text": "The first 5 prime numbers are 2, 3, 5, 7, and 11.\nThe sum of these numbers is:\n2 + 3 + 5 + 7 + 11 = 28"
20+
}
21+
],
22+
"role": "model"
23+
},
24+
"finishReason": "STOP",
25+
"index": 0
26+
}
27+
],
28+
"usageMetadata": {
29+
"promptTokenCount": 21,
30+
"candidatesTokenCount": 96,
31+
"totalTokenCount": 363,
32+
"promptTokensDetails": [
33+
{
34+
"modality": "TEXT",
35+
"tokenCount": 21
36+
}
37+
],
38+
"toolUsePromptTokenCount": 160,
39+
"toolUsePromptTokensDetails": [
40+
{
41+
"modality": "TEXT",
42+
"tokenCount": 160
43+
}
44+
],
45+
"thoughtsTokenCount": 86
46+
},
47+
"modelVersion": "gemini-2.5-flash",
48+
"responseId": "2Uu4aK2pMeOR-8YP-7eXwAQ"
49+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
data: {"candidates": [{"content": {"role": "model","parts": [{"text": "To find the sum of the first 5 prime numbers, we first need to identify them.\nPrime numbers are natural numbers greater than 1 that have no positive divisors other than 1 and themselves.\n\nThe first few prime numbers are:\n1. 2\n2. 3\n3. 5"}]}}],"usageMetadata": {"trafficType": "ON_DEMAND"},"modelVersion": "gemini-2.5-flash","createTime": "2025-09-03T14:13:07.015693Z","responseId": "80y4aM16taeo5g_9-eKJDA"}
2+
3+
data: {"candidates": [{"content": {"role": "model","parts": [{"text": "\n4. 7\n5. 11\n\nNow, we will sum these numbers using a Python tool.\n\n"}]}}],"usageMetadata": {"trafficType": "ON_DEMAND"},"modelVersion": "gemini-2.5-flash","createTime": "2025-09-03T14:13:07.015693Z","responseId": "80y4aM16taeo5g_9-eKJDA"}
4+
5+
data: {"candidates": [{"content": {"role": "model","parts": [{"executableCode": {"language": "PYTHON","code": "prime_numbers = [2, 3, 5, 7, 11]\nsum_of_primes = sum(prime_numbers)\nprint(f'The sum of the first 5 prime numbers is: {sum_of_primes}')\n"}}]}}],"usageMetadata": {"trafficType": "ON_DEMAND"},"modelVersion": "gemini-2.5-flash","createTime": "2025-09-03T14:13:07.015693Z","responseId": "80y4aM16taeo5g_9-eKJDA"}
6+
7+
data: {"candidates": [{"content": {"role": "model","parts": [{"codeExecutionResult": {"outcome": "OUTCOME_OK","output": "The sum of the first 5 prime numbers is: 28\n"}}]}}],"usageMetadata": {"trafficType": "ON_DEMAND"},"modelVersion": "gemini-2.5-flash","createTime": "2025-09-03T14:13:07.015693Z","responseId": "80y4aM16taeo5g_9-eKJDA"}
8+
9+
data: {"candidates": [{"content": {"role": "model","parts": [{"text": "The sum of the first "}]}}],"usageMetadata": {"trafficType": "ON_DEMAND"},"modelVersion": "gemini-2.5-flash","createTime": "2025-09-03T14:13:07.015693Z","responseId": "80y4aM16taeo5g_9-eKJDA"}
10+
11+
data: {"candidates": [{"content": {"role": "model","parts": [{"text": "5 prime numbers (2, 3, 5, 7, and 1"}]}}],"usageMetadata": {"trafficType": "ON_DEMAND"},"modelVersion": "gemini-2.5-flash","createTime": "2025-09-03T14:13:07.015693Z","responseId": "80y4aM16taeo5g_9-eKJDA"}
12+
13+
data: {"candidates": [{"content": {"role": "model","parts": [{"text": "1) is 28."}]},"finishReason": "STOP"}],"usageMetadata": {"promptTokenCount": 210,"candidatesTokenCount": 192,"totalTokenCount": 965,"trafficType": "ON_DEMAND","promptTokensDetails": [{"modality": "TEXT","tokenCount": 20}],"candidatesTokensDetails": [{"modality": "TEXT","tokenCount": 192}],"toolUsePromptTokensDetails": [{"modality": "TEXT","tokenCount": 181}],"toolUsePromptTokenCount": 371,"thoughtsTokenCount": 192},"modelVersion": "gemini-2.5-flash","createTime": "2025-09-03T14:13:07.015693Z","responseId": "80y4aM16taeo5g_9-eKJDA"}
14+
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
{
2+
"candidates": [
3+
{
4+
"content": {
5+
"role": "model",
6+
"parts": [
7+
{
8+
"text": "To find the sum of the first 5 prime numbers, we first need to identify them.\nPrime numbers are natural numbers greater than 1 that have no positive divisors other than 1 and themselves.\n\nThe first few prime numbers are:\n1. 2\n2. 3\n3. 5\n4. 7\n5. 11\n\nNow, we will sum these numbers using a Python tool.\n\n"
9+
},
10+
{
11+
"executableCode": {
12+
"language": "PYTHON",
13+
"code": "prime_numbers = [2, 3, 5, 7, 11]\nsum_of_primes = sum(prime_numbers)\nprint(f'The sum of the first 5 prime numbers is: {sum_of_primes}')\n"
14+
}
15+
},
16+
{
17+
"codeExecutionResult": {
18+
"outcome": "OUTCOME_OK",
19+
"output": "The sum of the first 5 prime numbers is: 28\n"
20+
}
21+
},
22+
{
23+
"text": "The sum of the first 5 prime numbers (2, 3, 5, 7, and 11) is 28."
24+
}
25+
]
26+
},
27+
"finishReason": "STOP"
28+
}
29+
],
30+
"usageMetadata": {
31+
"promptTokenCount": 20,
32+
"candidatesTokenCount": 192,
33+
"totalTokenCount": 775,
34+
"trafficType": "ON_DEMAND",
35+
"promptTokensDetails": [
36+
{
37+
"modality": "TEXT",
38+
"tokenCount": 20
39+
}
40+
],
41+
"candidatesTokensDetails": [
42+
{
43+
"modality": "TEXT",
44+
"tokenCount": 192
45+
}
46+
],
47+
"toolUsePromptTokensDetails": [
48+
{
49+
"modality": "TEXT",
50+
"tokenCount": 181
51+
}
52+
],
53+
"toolUsePromptTokenCount": 371,
54+
"thoughtsTokenCount": 192
55+
},
56+
"modelVersion": "gemini-2.5-flash",
57+
"createTime": "2025-09-03T14:12:08.303054Z",
58+
"responseId": "uEy4aM6_Euqawu8P6LOzyQc"
59+
}

0 commit comments

Comments
 (0)