Skip to main content

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-genai package 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 errors
  • AuthenticationError: Raised for authentication issues
  • InvalidModelError: 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

rawa_bots-0.1.0.tar.gz (4.4 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

rawa_bots-0.1.0-py3-none-any.whl (5.2 kB view details)

Uploaded Python 3

rawa_bots-0.1-py3-none-any.whl (7.6 kB view details)

Uploaded Python 3

File details

Details for the file rawa_bots-0.1.0.tar.gz.

File metadata

  • Download URL: rawa_bots-0.1.0.tar.gz
  • Upload date:
  • Size: 4.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.0

File hashes

Hashes for rawa_bots-0.1.0.tar.gz
Algorithm Hash digest
SHA256 ced87aabfc3417b0575cd459f9f55792a382f50b92b74a1b8171d754d00b4561
MD5 40b2a1f0f801cb9958c79f59e55f60cc
BLAKE2b-256 821216d09555c5c53c5ec6fdfc22024ccec85950db1c7555136952052156ab4c

See more details on using hashes here.

File details

Details for the file rawa_bots-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: rawa_bots-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 5.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.0

File hashes

Hashes for rawa_bots-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 bf10999ef0ccd6c3d3cb9e99f3ea3db6b41f9516e6cd10c216ed3ee5b6095492
MD5 e464c2e9cdebf44995c1957c01ba9986
BLAKE2b-256 784f8d038c54127b77b25778139499db2ae5b8a173eea9bf12bc3a190955bb58

See more details on using hashes here.

File details

Details for the file rawa_bots-0.1-py3-none-any.whl.

File metadata

  • Download URL: rawa_bots-0.1-py3-none-any.whl
  • Upload date:
  • Size: 7.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.0

File hashes

Hashes for rawa_bots-0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 1a4913891871ae8cd1045f9d16446feb08f0cac7b26123e63906d0516958ea1c
MD5 7a1574099d5bea90ad7fe51133a36d78
BLAKE2b-256 746a691560a10dc0586c937060897c1b4c5fe8be6c06e3db01a85eb97d6011e7

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page