Import the necessary library: import google.generativeai as genai imports the Google Generative AI library. Make sure you've installed it using pip install google-generativeai. Configure the API: genai.configure(api_key="YOUR_API_KEY") sets up the API co

import google.generativeai as genai

genai.configure(api_key="YOUR_API_KEY")
model = genai.GenerativeModel("gemini-1.5-flash")
response = model.generate_content("Explain how AI works")
print(response.text)
1 Like