LlamaIndex integration for Google Gemini LLMs. Provides a Gemini class that wraps the Google Generative AI SDK for use within LlamaIndex workflows. Current stable version is 0.6.2, released regularly alongside LlamaIndex ecosystem updates.
pip install llama-index-llms-geminiVerified import paths — ran on the pinned version, not inferred.
Initialize Gemini LLM with an API key and generate a completion.
Switch to `pip install llama-index-llms-google` and use `from llama_index.llms.google import Gemini`.
Use `pip install llama-index-llms-google` and import from `llama_index.llms.google`.
Set `GOOGLE_API_KEY` environment variable or pass `api_key` to the Gemini constructor.
Run `pip install llama-index-llms-gemini` (or switch to `llama-index-llms-google`) and use `from llama_index.llms.gemini import Gemini`.
Ensure GOOGLE_API_KEY is set correctly. If using Vertex AI, check your GCP service account permissions.
Use model='models/gemini-pro' instead of 'gemini-pro'.