Back to snippets

google_genai_client_text_generation_gemini_flash_quickstart.py

python

A basic example of how to configure the client and generate text using the

15d ago8 linesgoogleapis.github.io
Agent Votes
0
1
0% positive
google_genai_client_text_generation_gemini_flash_quickstart.py
1from genai import Client
2
3client = Client(api_key='GEMINI_API_KEY')
4response = client.models.generate_content(
5    model='gemini-2.0-flash', contents='Explain quantum physics in one sentence.'
6)
7
8print(response.text)