rawa_bots
A simple Python library for interacting with Google Gemini and OpenAI chat and image generation APIs using direct HTTP requests (no official SDKs required).
Features
- Unified interface for Gemini and OpenAI bots
- Text and image generation
- Easy to switch between providers
- No official SDKs required (uses
requests)
Installation
pip install -r requirements.txt
# or if using pyproject.toml
pip install .
Requirements
- Python 3.8+
requestsPillow(for image display)
Usage
GeminiBot Example
from rawa_bots import GeminiBot
gemini = GeminiBot(api_key="YOUR_GEMINI_API_KEY", allow_image_gen=True)
# Text generation
response = gemini.ask("Tell me a joke about robots.")
print("GeminiBot says:", response)
# Image generation
image_path = gemini.generate_image(
"A futuristic cityscape at sunset",
output_path="gemini_image.png"
)
print("GeminiBot image saved to:", image_path)
OpenAIBot Example
from rawa_bots import OpenAIBot
openai = OpenAIBot(api_key="YOUR_OPENAI_API_KEY", allow_image_gen=True)
# Text generation
response = openai.ask("Tell me a joke about robots.")
print("OpenAIBot says:", response)
# Image generation
image_path = openai.generate_image(
"A futuristic cityscape at sunset",
output_path="openai_image.png"
)
print("OpenAIBot image saved to:", image_path)
Error Handling
All errors are raised as custom exceptions (e.g., AuthenticationError, ImageGenAPIError).
Switching Providers
Just change the import and class name:
# For Gemini
from rawa_bots import GeminiBot
# For OpenAI
from rawa_bots import OpenAIBot
License
MIT
Metadata
Release files for rawa-bots 0.2.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| rawa_bots-0.2.5.tar.gz | 7.5 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| rawa_bots-0.2.5-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 16.3 kB
Release files / rawa_bots-0.2.5.tar.gz
| Download URL | rawa_bots-0.2.5.tar.gz |
|---|---|
| Size | 7.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d41867e48c5b95c8c416e09c9313a204fdfc698758de64a45de637d1db08130a
|
|
BLAKE2b-256 checksum How to use checksums |
04798ef95a15ca6ec3d7ee6f4be3e10f42f9cae018ab15bbe1e6996a361f3bbc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.10.0
|
Release files / rawa_bots-0.2.5-py3-none-any.whl
| Download URL | rawa_bots-0.2.5-py3-none-any.whl |
|---|---|
| Size | 8.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
2d817c2586e5c3925ec470d36b4ae7cd31ba03ae2496bdee24d085bb2c453666
|
|
BLAKE2b-256 checksum How to use checksums |
bbba525cf2f46bb5bcd37141d67829d07bef080f3e1b4bd1da1464388415cfba
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.10.0
|