Skip to content

A discord bot-relationship companion that can text like a human using generative AI and NLP

Notifications You must be signed in to change notification settings

derronli/cupid-bot

Repository files navigation

Cupid Bot

A discord bot that can adapt to the user's speech patterns to answer the hard questions and provide personalized relationship help - using generative AI and NLP

Built with Python and Cohere API

Disclaimer: Cupid bot is purely for entertainment purposes and is not indicative of my opinions on human relationships😅

Motivation

The dreaded trap relationship questions where it seems like there is no right answer. Would you still love me if I was a worm?, If you had to kiss my best friend to save my life, would you do it?, Aren't they pretty? They are so pretty right?? A real hair-puller right.

Cupid bot aims to solve this problem by using previous conversation data and AI to construct the perfect, most optimal answer. Based on your personal speech patterns AND your significant other's ideal communication style

Demo

Note that for this demo, Cupid bot was trained to mimic a very affectionate boyfriend whose replying to a girlfriend that responds well to sweet messages and compliments.

Invoking the \cupid_gen command in discord will prompt the bot to read in the previous message sent in the chat, and reply to it

image

Cupid Bot has basic emotional intelligence

image

Cupid bot knows to use the User's commonly used emojis and words. It's almost creepy...

image

Notice the short forms and texting style

asdasd

Cupid bot is funny

image image

Note that these bot messages are normally only visible to the user (as a discord Ephemeral message) but were exposed for demo sake

Customization Demo

To effectively show Cupid bot's ability to match speech patterns and adapt to the target who it's responding to, I trained Cupid Bot on my friend and my chat logs

Very different style

image

Context: we normally ask each other to play League

image

Summarization Demo

Prompt generated courtesy of ChatGPT
In case you're in the middle of a game/video/project and need to quickly reply to your significant other

image

How does it Work

image

Above is the general flow which I followed, starting from the top left.

I believe the most crucial step was the classification

Text messages were extracted into the following format:

  1. Prompt (target) - "How do you like my new hairstyle?"
  2. Message (user) - "Wow it looks great on you!"
  3. Response (target) - "Aw, thanks!!!"

Then each Response was tagged with a Response Semantic using the Cohere Classify Endpoint. (Positive/Negative/Neutral)

From here, all rows in the table tagged with a non-Positive response were removed, along with the Response column - leaving us with only the Prompt-Message pairs which we know the target responds well to

These Prompt-Message pairs were then used to train the Generative AI Model. Allowing for the bot to pick up on the optimal responses to the target's "Prompts".

Using Cupid Bot

Disclaimer: Cupid Bot is not liable if it were to damage your relationships.
Setup is quite complex right now, a future goal would be to simplify it.

clone the repo

Install dependencies

pip install cohere
pip install pandas

Use DiscordChatExporter to extract messages from you and your significant other (or friend)
Export as a .txt file
The period of time you choose to extract is up to you

Place the .txt into the project's root directory
Run the main.py file, either with your editor's code runner or python main.py
This will output the training-generate.csv file
Create a customized Generate model with Cohere and input the training-generate.csv file
Fill in the MODEL_ID field in CohereLayer.py with the customized model ID produced
Fill in the examples.py file with desired prompt (Keep in mind, mine examples.py is hidden for privacy sake, but I will provide a template for this)
Run the bot!

If you made it this far: Thanks for reading! I hope you had as much fun reading about/playing with Cupid Bot as I did making it

About

A discord bot-relationship companion that can text like a human using generative AI and NLP

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages