Skip to main content

Send nice texts to your friends using LLMs

Project description

compLLMents

Description

This package enables you to send scheduled, uplifting, multi-modal AI-generated text messages to your friends. (Though they won't remain friends long if your only communicate is automated 😉)

It works by first using an LLM to generate a batch of positive and complimentary messages in the language of your choice. Then, a multilingual sentiment classifier scores all the generated posts and selects the most positive to send either as an SMS or over WhatsApp. Further, after recording a few minutes of audio, a custom text-to-speech model will record the message in your voice. Here is the accompanying Colab notebook.

Table of Contents

Installation

First, ensure that poetry is installed.

poetry install
poe install-pytorch

To download files to store locally and save time of future downloads, run:

download -m path/on/huggingface

SMS

First create a free Twilio account and create a phone number (note: Twilio automatically prepends the message Sent from your Twilio trial account to free-tier accounts). Copy your credentials from the dashboard into the TWILIO_CONFIG dictionary in config.py. An example config will look like:

 {
    "account_sid": "a_string",
    "auth_token": "a_token",
    "from_": "+11234567890",
}

WhatsApp

You must log in from your computer for the messages to send.

Audio

Training a custom test-to-speech (TTS) model requires a corpus of recordings to fine tine on. The Mozilla Common Voice initiative is a crowdsourced voice dataset. After creating an account, you can record yourself speaking sentences in the language of your choosing. Once finished recording, go to Profile >> Download My Data and copy the URLs you see into the MOZILLA_CONFIG dictionary in config.py like below:

MOZILLA_CONFIG = {
    "first_url": "",
    "second_url": "",
}

Usage

Texts are sent by running:

send -r recipient-name -s sender-name -n +11234567890 -l language -t type -b -sa

send --help explains the parameter options. Pass your OpenAI API key using -o to use their models.

You can send custom messages by chaning the text in the TEMPLATE object in main.py

You can set custom model configuration in the INFERENCE_CONFIG object in conifg.py including swapping out models, increasing the output length by chaning max_new_tokens or increasing the randomness in reponses by raising temperature or top_p. The default language generation model is NousResearch/Nous-Hermes-13b which is the best performing open-sourced LLM at the time of creation. The default sentiment analysis model is cardiffnlp/xlm-roberta-base-sentiment-multilingual which supports 8 languagees: arabic, english, french, german, hindi, italian, portuguese, and, spanish.

To schedule texts to be sent at regular intervals, create a crontab similar to the example in cron.

Examples

Here are some examples messages and their sentiment score.

Message Sentiment Score
Hey Austin! Just wanted to remind you that you are an amazing friend and such a positive force in my life. Keep being you, because you're pretty darn great. 0.939329206943512
Hey Austin! Just wanted to let you know that you're an amazing friend and I'm lucky to have you in my life. Keep being your awesome self and never forget how much you're loved and appreciated! 😊 0.9417279958724976
Hey Austin! Just wanted to remind you that you are an amazing friend and person. Your kindness and positivity always brings a smile to my face. Keep being you, because you're awesome! :) 0.946333646774292

The final recording is below. This was generated by fine-tuning the text-to-speech model on 200 sentences. The more data it is given, the more life-like it will sound.

Demo Doccou alpha

Tests

Forthcoming...

Releases

0.1.0

  • Self-hosted or OpenAI generated compliments
  • SMS and WhatsApp supports
  • Sentiment-based message selection
  • Message scheduling
  • User-friendly Colab notebook

0.1.1

  • Fixed ReadME.md

0.2.0

  • Custom voice messages
  • Birthday and custom message templates

License

MIT License

Copyright (c) [2023] [Austin Botelho]

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

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

compllments-0.2.0.tar.gz (14.1 kB view details)

Uploaded Source

Built Distribution

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

compllments-0.2.0-py3-none-any.whl (12.9 kB view details)

Uploaded Python 3

File details

Details for the file compllments-0.2.0.tar.gz.

File metadata

  • Download URL: compllments-0.2.0.tar.gz
  • Upload date:
  • Size: 14.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.2.2 CPython/3.8.15 Linux/5.15.0-78-generic

File hashes

Hashes for compllments-0.2.0.tar.gz
Algorithm Hash digest
SHA256 15d4f3dadf1b5987beb71cd1d6ab9f984891b8297e06904eaf03c3ffc3c4c423
MD5 a2e8dcde564b4eb440c8c33eeda0d350
BLAKE2b-256 092ce4fb15cef3bbf9522a5e9f58fd1e653a6352b56aa7b7e178ada10cc66eae

See more details on using hashes here.

File details

Details for the file compllments-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: compllments-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 12.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.2.2 CPython/3.8.15 Linux/5.15.0-78-generic

File hashes

Hashes for compllments-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a5df2f14eaca2dada09aba6eb4544ad6c513fbd31db42494562defa1510ce361
MD5 7c333c7bba3c046b1e3ea92e21a7bee2
BLAKE2b-256 d737ea2f238830b95b86e38624a507c09d2532f51901371d7a85d0e6ca2c56cd

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