Roleplay Bot
Roleplay Bot is a Python chatbot for roleplaying. The bot plays a character with a given name and personality, while you play another character. You provide character names, optional descriptions, and an optional scenario, and the bot generates in-character dialogue and actions.
Example
from roleplay_bot import Bot, BotParameters
# Required parameters
bot_name = "Aria"
anon_name = "Fin"
# Optional parameters
bot_description = "A mischievous forest pixie"
anon_description = "A brave ranger"
scene = "In a misty woodland glade, a chance encounter..."
params = BotParameters(
bot_name=bot_name,
anon_name=anon_name,
bot_description=bot_description,
anon_description=anon_description,
scene=scene,
)
bot = Bot(params)
response = bot.chat("Hello, Aria!")
print(response)
Prerequisites
- Python 3.10+
- Ollama CLI: Install Ollama and ensure it is running on your system. Ollama lets you use local LLMs via a simple Python API.
- llama3.2 model: Pull the
llama3.2model for Ollama using the commandollama pull llama3.2. - (Optional)
uvpackage manager: For convenience, you can use Astral UV to manage dependencies. Install viapip install uvand useuv syncas shown below. Alternatively, you may install dependencies with pip manually.
Installation
- Clone the repository:
git clone https://github.com/rakin406/roleplay_bot.git cd roleplay_bot
- Install Python dependencies:
You need the Ollama Python library. For example:pip install ollama
Alternatively, use theuvmanager:pip install uv uv sync
Usage
Run the main script:
python main.py
You will be prompted for: Bot’s nickname, Your nickname, Bot’s character description (optional), Your character description (optional), and Scenario and lore (optional). For example:
Bot's nickname: Aria
Your nickname: Fin
Bot's character description (Optional): A mischievous forest pixie
Your character description (Optional): A brave ranger
Scenario and lore (Optional): In a misty woodland glade, a chance encounter...
After entering this information, the interactive chat begins.
>> Hello, Aria!
*Aria giggles and flutters a hand* Greetings, kind ranger. What brings you to my glade?
Contributing
Contributions, bug reports, and feature requests are welcome! Feel free to open an issue or submit a pull request on GitHub.
Contact
Rakin Rahman - rakinrahman406@gmail.com
License
This project is released under the MIT License (see the LICENSE file).
Metadata
Release files for roleplay-bot 1.0.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| roleplay_bot-1.0.4.tar.gz | 4.4 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| roleplay_bot-1.0.4-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 10.4 kB
Release files / roleplay_bot-1.0.4.tar.gz
| Download URL | roleplay_bot-1.0.4.tar.gz |
|---|---|
| Size | 4.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ca7fe4be9941e426bb0fd97d0cdb82624fdf11d67c6f263cad3b671c3684c5a8
|
|
BLAKE2b-256 checksum How to use checksums |
45bf848109321010c1dc879b0383ecc5a098db5e8fda5c76b757df3e2076bed8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.11.1 {"installer":{"name":"uv","version":"0.11.1","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / roleplay_bot-1.0.4-py3-none-any.whl
| Download URL | roleplay_bot-1.0.4-py3-none-any.whl |
|---|---|
| Size | 6.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
19c0d0b5a98c7fb7b62b74277c5521e944e8f84914e4752d7fa8d30a5f1d3c3f
|
|
BLAKE2b-256 checksum How to use checksums |
36d9ee4a6da0d78ab8ccbddb1c6ee5de2886532f804d735246e89e1860491bf4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.11.1 {"installer":{"name":"uv","version":"0.11.1","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|