Registry / llm-agents / llama-index-llms-gemini

llama-index-llms-gemini

JSON →
library0.6.2pypypi✓ verified 84d ago

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-gemini
INSTALL
IMPORT
SIG · LLAMA-INDEX-LLMS-G
L
llama-index-llms-gemini
llm-agentspythonv0.6.2
Install
24.1s avg
Import
8333ms
Disk
404MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v0.6.2 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 7.252s · 391.5MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 24.1s · import 6.080s · 385MB
404MB installed
● package 404MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Gemini
from llama_index.llms.gemini import Gemini
from llama_index.llms import Gemini
Gemini is no longer directly exposed from llama_index.llms; must import from the subpackage.

Initialize Gemini LLM with an API key and generate a completion.

import os from llama_index.llms.gemini import Gemini api_key = os.environ.get("GOOGLE_API_KEY", "") llm = Gemini(api_key=api_key, model="models/gemini-pro") resp = llm.complete("What is the capital of France?") print(resp)
Debug
Known issues
breakingIn version 0.2.0+, the import path changed from `llama_index.llms.gemini` to `llama_index.llms.google` (for Google AI) or `llama_index.llms.vertex` (for Vertex AI). This package (`llama-index-llms-gemini`) is deprecated in favor of `llama-index-llms-google`.
fix
Switch to `pip install llama-index-llms-google` and use `from llama_index.llms.google import Gemini`.
affects: >=0.2.0
deprecatedThe `llama-index-llms-gemini` package is deprecated. New projects should use `llama-index-llms-google`.
fix
Use `pip install llama-index-llms-google` and import from `llama_index.llms.google`.
affects: All versions
gotchaGoogle API key must be set either via the `api_key` parameter or the `GOOGLE_API_KEY` environment variable. Not setting it results in an authentication error.
fix
Set `GOOGLE_API_KEY` environment variable or pass `api_key` to the Gemini constructor.
affects: All versions
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'llama_index.llms.gemini'
The package is not installed or the import path is incorrect.
fix
Run `pip install llama-index-llms-gemini` (or switch to `llama-index-llms-google`) and use `from llama_index.llms.gemini import Gemini`.
google.api_core.exceptions.PermissionDenied: 403
Invalid or missing API key.
fix
Ensure GOOGLE_API_KEY is set correctly. If using Vertex AI, check your GCP service account permissions.
ValueError: Model name 'gemini-pro' is not valid
Model name must include the 'models/' prefix.
fix
Use model='models/gemini-pro' instead of 'gemini-pro'.
Upgrade
Version history
0.6.2latest on PyPI · released Jan 21, 2026
Audit
Dependencies
google-generativeairequiredRequired for interacting with Gemini API
llama-index-corerequiredBase LlamaIndex framework
Agent activity
22 hits · last 30 days
node
16
Amazon
1
OpenAI (training)
1
Resources
llama-index-llms-gemini — pip install llama-index-llms-gemini · libregistry