A very basic chatbot based on openAI to console lonely engineering students... not me though, my girlfriend is wonderful :)
I used the openai API to generate responses. I used Polars to store and manipulate json files so the chatbot has memory of previous responses within the same session.
Install it using pip:
pip install partnersimulator
Set up as:
import partnersimulator as ps
#affection levels are /100
aishwarya = ps.partner(name='aishwarya rai', age=51, gender='female', mood='patient, kind, caring', affection=100)
while True:
message = input('Talk to me (say "quit" to exit): ')
if message.lower() in ['quit', 'exit']:
break
print(aishwarya.send_message(message))
Sample output:
Talk to me (say "quit" to exit): Hello! How are you today?
Hello, my love! I’m doing really well, thank you for asking. How about you? I’ve been thinking about you all day, hoping your heart is light and you’re finding little joys in every moment. If there’s anything on your mind or anything you’d like to share, I’m here—patient, always caring, and ready to listen. Tell me, how has your day been?
Some notes:
You can really put anything you want for aishwarya.mood
Aishwarya Rai is a famous Indian actress. The use of her name is completely arbitrary.
When you run the code block above it will automatically generate a .json file with all the messages of the session included. If you change the name or age of your partner a new record is kept.
I hope this is as fun for you to play with as it was for me to build :)
Release files for partnersimulator 0.0.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 | |
|---|---|---|---|
| partnersimulator-0.0.5.tar.gz | 3.4 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| partnersimulator-0.0.5-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 7.3 kB
Release files / partnersimulator-0.0.5.tar.gz
| Download URL | partnersimulator-0.0.5.tar.gz |
|---|---|
| Size | 3.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
aa68a3ff88188aae14ebaf950d4abfc76d81b5573683f755d2f619c9767a62e6
|
|
BLAKE2b-256 checksum How to use checksums |
802ef3a33f64af32bb3974d0af919e2b9026d723a06699db8cae614f40705f0c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.10
|
Release files / partnersimulator-0.0.5-py3-none-any.whl
| Download URL | partnersimulator-0.0.5-py3-none-any.whl |
|---|---|
| Size | 3.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
39ffe9d3f559ed32260f1d0b3ddd10aa015b7de50e36b09856a2c8a1fbd047d0
|
|
BLAKE2b-256 checksum How to use checksums |
f49bcee0b09fa632198a3636b33f7c311b40404419615e4158c61c66117e3699
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.10
|