Skip to content

Commit 74d67ac

Browse files
Code execution for shell (#491)
* Code execution for shell * Update code_execution.sh --------- Co-authored-by: Mark Daoust <[email protected]>
1 parent d0f3359 commit 74d67ac

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

samples/rest/code_execution.sh

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
set -eu
2+
3+
echo "[START code_execution_basic]"
4+
# [START code_execution_basic]
5+
curl "https://generativelanguage.googleapis.com/v1beta/models/gemini-1.5-pro-latest:generateContent?key=$GOOGLE_API_KEY" \
6+
-H 'Content-Type: application/json' \
7+
-d ' {"tools": ["code_execution"],
8+
"contents": {
9+
"parts":
10+
{"text": "What is the sum of the first 50 prime numbers? "
11+
"Generate and run code for the calculation, and make sure you get all 50."}
12+
}
13+
},
14+
}'
15+
# [END code_execution_basic]

0 commit comments

Comments
 (0)