elizaOS Google GenAI Plugin - Gemini API client for text generation, embeddings, and image analysis
Project description
elizaOS Google GenAI Plugin (Python)
Python implementation of the elizaOS Google Generative AI plugin for Gemini models.
Installation
pip install elizaos-plugin-google-genai
Quick Start
import asyncio
from elizaos_plugin_google_genai import GoogleGenAIClient, GoogleGenAIConfig
async def main():
# Load config from environment
config = GoogleGenAIConfig.from_env()
async with GoogleGenAIClient(config) as client:
# Generate text
response = await client.generate_text_large("What is the meaning of life?")
print(response.text)
# Generate embeddings
embedding = await client.generate_embedding("Hello, world!")
print(f"Embedding dimension: {len(embedding.embedding)}")
# Generate structured JSON
from elizaos_plugin_google_genai import ObjectGenerationParams
result = await client.generate_object_small(ObjectGenerationParams(
prompt="Generate a person profile with name and age",
json_schema={
"type": "object",
"properties": {
"name": {"type": "string"},
"age": {"type": "number"}
}
}
))
print(result.object)
asyncio.run(main())
Configuration
Set the following environment variables:
| Variable | Required | Description |
|---|---|---|
GOOGLE_GENERATIVE_AI_API_KEY |
Yes | Your Google AI API key |
GOOGLE_SMALL_MODEL |
No | Override small model (default: gemini-2.0-flash-001) |
GOOGLE_LARGE_MODEL |
No | Override large model (default: gemini-2.5-pro-preview-03-25) |
GOOGLE_EMBEDDING_MODEL |
No | Override embedding model (default: text-embedding-004) |
GOOGLE_IMAGE_MODEL |
No | Override image model |
GOOGLE_TIMEOUT_SECONDS |
No | Request timeout (default: 60) |
Features
- Text Generation: Generate text using Gemini models
- Embeddings: Generate text embeddings for semantic search
- Image Analysis: Analyze and describe images
- JSON Object Generation: Generate structured JSON with schema validation
- Async/Await: Full async support for efficient I/O
- Type Safety: Full type hints with Pydantic models
Development
# Install dev dependencies
pip install -e ".[dev]"
# Run tests
pytest
# Type checking
mypy elizaos_plugin_google_genai
# Linting
ruff check .
ruff format .
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file elizaos_plugin_google_genai-2.0.0a5.tar.gz.
File metadata
- Download URL: elizaos_plugin_google_genai-2.0.0a5.tar.gz
- Upload date:
- Size: 10.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e002ae35849ae57b458e39f61ca59d717b8539835761a7c3520ece01aa2c9224
|
|
| MD5 |
82789618cdc9669a1563aa6de94db060
|
|
| BLAKE2b-256 |
06c5331b8a1e3c2f74ba76ff05b407e5f7712bb61a9f299b8a02a8d0bbd7e1e2
|
File details
Details for the file elizaos_plugin_google_genai-2.0.0a5-py3-none-any.whl.
File metadata
- Download URL: elizaos_plugin_google_genai-2.0.0a5-py3-none-any.whl
- Upload date:
- Size: 11.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8776a120b6831fe2899ed002eedbe09a3f4d83cf591ac094e4c666fabc598aea
|
|
| MD5 |
90140e64afdf495366e0033262afc014
|
|
| BLAKE2b-256 |
7fb00e82bfb6fd87dd83c56744e4a4642ce4a21752f79351003c6b034607082a
|