Component Libraries •
Project Templates
Docs •
Install •
Tutorials •
Developer Guides •
Contribute •
Blog •
Discord
Xircuits Component Library for Gemini – Seamless Integration with Google Generative AI.
Seamlessly integrate Google Generative AI into Xircuits. This library enables efficient authorization, content generation, token management, and chat-based interactions with Gemini models.


Before you begin, you will need the following:
- Python3.9+.
- Xircuits.
Configures API authorization for the Gemini library using an API key, either provided directly or from an environment variable.

Creates content using input data and a specified generative model.

Generates content in real-time using a streaming approach, allowing dynamic responses.
Starts a conversational session with the Gemini model, enabling interactive AI chats.
Sends a message in an ongoing chat and retrieves the AI's response.
Facilitates real-time chat interactions using streaming for continuous response delivery.
Calculates token count for input text to optimize API usage and cost management.
To use this component library, ensure that you have an existing Xircuits setup. You can then install the Gemini library using the component library interface, or through the CLI using:
xircuits install gemini
You can also do it manually by cloning and installing it:
# base Xircuits directory
git clone https://github.com/XpressAI/xai-gemini xai_components/xai_gemini
pip install -r xai_components/xai_gemini/requirements.txt
Store your Google API key in an environment variable for enhanced security and convenience. Example:
export GOOGLE_API_KEY='your_api_key_here'