A Python library to easily build Gemini-powered chatbots.
Project description
rawa_bots
A Python library to easily build Gemini-powered chatbots with minimal code.
Features
- Easy Gemini API integration
- Conversational and single-turn modes
- Automatic conversation history
- Custom generation parameters (temperature, top_p, etc.)
- Graceful error handling with custom exceptions
- Ready for PyPI packaging
Installation
pip install rawa_bots
Note: Requires Python 3.8+ and a valid Gemini API key. The
google-genaipackage will be installed automatically.
Usage Example
from rawa_bots import GeminiBot
bot = GeminiBot(
api_key="YOUR_API_KEY",
model_name="gemini-2.0-flash-001", # or any valid Gemini model
system_prompt="You are helpful.",
conversational=True,
temperature=0.7, # Optional advanced config
)
response = bot.ask("Hello!")
print(response)
# Reset conversation (for conversational mode)
bot.reset()
Listing Available Models
You can list all available Gemini models with:
from google import genai
client = genai.Client(api_key="YOUR_API_KEY")
print([m.name for m in client.models.list()])
Error Handling
GeminiError: Base exception for all GeminiBot errorsAuthenticationError: Raised for authentication issuesInvalidModelError: Raised if the model name is invalid
Testing
Run tests with:
python -m unittest discover tests
License
MIT License
Project details
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 rawa_bots-0.1.1.tar.gz.
File metadata
- Download URL: rawa_bots-0.1.1.tar.gz
- Upload date:
- Size: 4.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fb045f5a77bb574f4e69395657950c059a30a3d3d6cbcd9e28de15a321395fd3
|
|
| MD5 |
799e29eed924d949eff639991ac465c4
|
|
| BLAKE2b-256 |
a407634a82b69a54e790d1e0b29ec54c51afd4fa0668f851de65f8354280a0a1
|
File details
Details for the file rawa_bots-0.1.1-py3-none-any.whl.
File metadata
- Download URL: rawa_bots-0.1.1-py3-none-any.whl
- Upload date:
- Size: 5.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
52d4b261c858752c03fe62a05886d04fa224abebc65a2185797ffc642ead1905
|
|
| MD5 |
014895f0dba814f9cf5c6a8c8ab7e67a
|
|
| BLAKE2b-256 |
5ad01ca43ea6182f1d909b6dfaf90fa1ba8c6cb49911a1367265d16b71ca1d19
|