Sep 2024 update: Updated code samples from Gemini 1.0 Pro (
gemini-pro
) and Pro Vision (gemini-pro-vision
) models to Gemini 1.5 Flash (gemini-1.5-flash
).
These are the code samples that are found in the blog post series introducing the Gemini API:
- A Better "Hello World!" sample
- Next steps beyond "Hello World!"
- Putting together a basic genAI web app
- (coming soon)
Links to each post down below in corresponding row for each code sample. Follow the appropriate instructions in each post to get these apps to run.
Link | App | Description | Platform | Model | Language |
---|---|---|---|---|---|
Post 1 | gemtxt-simple-gai.py |
"Hello World!" | Google AI | Gemini 1.5 Flash | Python 3 |
Post 1 | gemtxt-simple-gai.js |
"Hello World!" | Google AI | Gemini 1.5 Flash | Node.js (CommonJS) |
Post 1 | gemtxt-simple-gai.mjs |
"Hello World!" | Google AI | Gemini 1.5 Flash | Node.js (modern JS/ECMAScript module) |
Post 1 | gemtxt-simple-gcp.py |
"Hello World!" | GCP Vertex AI | Gemini 1.5 Flash | Python 3 |
Post 2 | gemtxt-simple-gai.py |
Text API | Google AI | Gemini 1.5 Flash | Python 3 |
Post 2 | gemtxt-stream-gai.py |
Streaming | Google AI | Gemini 1.5 Flash | Python 3 |
Post 2 | gemtxt-simple-chat-gai.py |
Chat | Google AI | Gemini 1.5 Flash | Python 3 |
Post 2 | gemmmd-simple-loc-gai.py |
Multimodal (local image) | Google AI | Gemini 1.5 Flash | Python 3 |
Post 2 | gemmmd-simple-url-gai.py |
Multimodal (online image) | Google AI | Gemini 1.5 Flash | Python 3 |
Post 2 | gemmmd-simple-url-chat-gai.py |
Multimodal chat (online image) | Google AI | Gemini 1.5 Flash | Python 3 |
Post 3 | webgem |
Multimodal (uploaded image) | Google AI | Gemini 1.5 Flash | Python & Node.js (CommonJS) |
Post 4 | gem20-audio.py |
Generate audio track | Google AI | Gemini 2.0 Flash (experimental) | Python 3 |