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
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
rawa_bots-0.2.5.tar.gz
(7.5 kB
view details)
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.2.5.tar.gz.
File metadata
- Download URL: rawa_bots-0.2.5.tar.gz
- Upload date:
- Size: 7.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d41867e48c5b95c8c416e09c9313a204fdfc698758de64a45de637d1db08130a
|
|
| MD5 |
59d1244b99545448db50cb59bd43b4bc
|
|
| BLAKE2b-256 |
04798ef95a15ca6ec3d7ee6f4be3e10f42f9cae018ab15bbe1e6996a361f3bbc
|
File details
Details for the file rawa_bots-0.2.5-py3-none-any.whl.
File metadata
- Download URL: rawa_bots-0.2.5-py3-none-any.whl
- Upload date:
- Size: 8.8 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 |
2d817c2586e5c3925ec470d36b4ae7cd31ba03ae2496bdee24d085bb2c453666
|
|
| MD5 |
4e7eb64778413f2110ba1130be9d3d26
|
|
| BLAKE2b-256 |
bbba525cf2f46bb5bcd37141d67829d07bef080f3e1b4bd1da1464388415cfba
|