Add your description here
Project description
AI Chat Bot CLI
A command-line chatbot powered by Google's Gemini API with streaming responses and a beautiful terminal interface.
Features
- Interactive chat with Google Gemini AI models
- Real-time streaming responses
- Conversation history (AI remembers context)
- Beautiful terminal UI with Rich
- Easy configuration via
.envfile
Prerequisites
- Python 3.12 or higher
- A Google Gemini API key (Get one here)
Installation
-
Clone the repository
git clone https://github.com/SajalDevX/ai_chat_bot_cli.git cd ai_chat_bot_cli
-
Create a virtual environment
python -m venv .venv source .venv/bin/activate # Linux/macOS # or .venv\Scripts\activate # Windows
-
Install dependencies
# Using uv (recommended) uv pip install -e . # Or using pip pip install -e .
-
Configure your API key
Create a
.envfile in the project root:cp .env.example .env
Edit
.envand add your Gemini API key:GEMINI_API_KEY=your_api_key_here GEMINI_MODEL=gemini-2.0-flash MAX_TOKENS=1000 TEMPERATURE=0.7
Usage
Run the chatbot:
# Using the CLI command
ai-chat-bot
# Or using Python module
python -m ai_chat_bot.main
# Or with uv
uv run python -m ai_chat_bot.main
Example session:
╭─────────────────────────────────────────────────────────╮
│ AI Chatbot │
│ Type your message and press Enter. │
│ Commands: /help, /clear, /quit │
╰─────────────────────────────────────────────────────────╯
✅ Connected to Gemini API!
ℹ️ Model: gemini-2.0-flash
ℹ️ Streaming enabled
You: Hello! What can you help me with?
🤖 Assistant:
Hello! I can help you with a wide range of tasks...
Commands
| Command | Description |
|---|---|
/help |
Show help information |
/clear |
Clear conversation history |
/quit |
Exit the chatbot |
Configuration Options
| Variable | Description | Default |
|---|---|---|
GEMINI_API_KEY |
Your Google Gemini API key | Required |
GEMINI_MODEL |
Gemini model to use | gemini-2.0-flash |
MAX_TOKENS |
Maximum tokens in response | 1000 |
TEMPERATURE |
Response creativity (0.0-2.0) | 0.7 |
TIMEOUT |
API request timeout (seconds) | 30.0 |
Available Models
gemini-2.0-flash- Fast and efficient (recommended)gemini-2.5-flash- Latest flash modelgemini-2.5-pro- Most capable model
Project Structure
chat_bot_cli/
├── src/
│ └── ai_chat_bot/
│ ├── __init__.py
│ ├── main.py # Entry point and ChatBot class
│ ├── config.py # Settings configuration
│ ├── clients/
│ │ ├── __init__.py
│ │ └── gemini.py # Gemini API client
│ ├── models/
│ │ ├── __init__.py
│ │ └── messages.py # Message and Conversation models
│ ├── ui/
│ │ ├── __init__.py
│ │ └── display.py # Terminal display utilities
│ └── utils/
│ ├── __init__.py
│ └── exceptions.py # Custom exceptions
├── .env # Environment variables (create this)
├── pyproject.toml
└── README.md
Troubleshooting
"Rate limit exceeded" error
- Check your API quota at https://ai.dev/usage
- Try using
gemini-2.0-flashmodel (more generous limits) - Wait a few minutes and try again
"API key not valid" error
- Verify your API key at https://aistudio.google.com/apikey
- Make sure the
.envfile is in the project root - Check that the key is correctly copied (no extra spaces)
"Model not found" error
- Update to a supported model (e.g.,
gemini-2.0-flash) - Check available models at https://ai.google.dev/gemini-api/docs/models
License
This project is licensed under the MIT License - see the LICENSE file for details.
Author
Airo - SajalDevX
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 chat_bot_cli_mexo-0.1.0.tar.gz.
File metadata
- Download URL: chat_bot_cli_mexo-0.1.0.tar.gz
- Upload date:
- Size: 12.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f26ac1390cad08782a98b3be85c815541a491006021b1d93875fd1b2aab609df
|
|
| MD5 |
739beed103abe86c7e6d0fdfcfb48d09
|
|
| BLAKE2b-256 |
febed665229f47e067c89c2be3f00f279af6a7fcd2c7ffec1103b540805c3fa2
|
File details
Details for the file chat_bot_cli_mexo-0.1.0-py3-none-any.whl.
File metadata
- Download URL: chat_bot_cli_mexo-0.1.0-py3-none-any.whl
- Upload date:
- Size: 13.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
720d69cfa04deae96e9679a6e3f0822bdb749479edc8d0534d9c35adcf79a8e0
|
|
| MD5 |
7343fd85cf3b45d29e75063e5a31888e
|
|
| BLAKE2b-256 |
428d0ce02d425ce15f94e18d1763b26ec0410a25d594266e142da0551116bf4a
|