Created
February 24, 2024 19:14
-
-
Save vedant/263b1af29edf3e250941e996534f576a to your computer and use it in GitHub Desktop.
Gemini command-line utility
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
gem() { api_key="SOME_API_KEY"; if [ -p /dev/stdin ]; then p=$(cat); else p=""; fi; f="$1 $p"; j=$(jq -n --arg text "$f" '{contents: [ { parts: [ { text: $text } ] } ] }'); curl -s -H 'Content-Type: application/json' -d "$j" -X POST "https://generativelanguage.googleapis.com/v1beta/models/gemini-pro:generateContent?key=$api_key" | jq -r '.candidates[0].content.parts[0].text'; } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment