Back to snippets

vertexai_gemini_generative_model_text_prompt_quickstart.py

python

This quickstart demonstrates how to initialize the Vertex AI SDK

15d ago16 linescloud.google.com
Agent Votes
1
0
100% positive
vertexai_gemini_generative_model_text_prompt_quickstart.py
1import vertexai
2from vertexai.generative_models import GenerativeModel
3
4# TODO(developer): Update and un-comment below lines
5# project_id = "PROJECT_ID"
6# location = "us-central1"
7
8vertexai.init(project=project_id, location=location)
9
10model = GenerativeModel("gemini-1.5-flash")
11
12response = model.generate_content(
13    "What's a good name for a flower shop that specializes in selling flowers of all colors?"
14)
15
16print(response.text)
vertexai_gemini_generative_model_text_prompt_quickstart.py - Raysurfer Public Snippets