Shaunwei / RealChar

๐ŸŽ™๏ธ๐Ÿค–Create, Customize and Talk to your AI Character/Companion in Realtime (All in One Codebase!). Have a natural seamless conversation with AI everywhere (mobile, web and terminal) using LLM OpenAI GPT3.5/4, Anthropic Claude2, Chroma Vector DB, Whisper Speech2Text, ElevenLabs Text2Speech๐ŸŽ™๏ธ๐Ÿค–
https://RealChar.ai/
MIT License
5.94k stars 727 forks source link

RealChar. - Your Realtime AI Character


RealChar-logo


๐ŸŽ™๏ธ๐Ÿค–Create, customize and talk to your AI Character/Companion in realtime๐ŸŽ™๏ธ๐Ÿค–

Join our Discord Twitter Follow GitHub GitHub License Docker Pulls

โœจ Demo

Try our site at RealChar.ai

Not sure how to pronounce RealChar? Listen to this ๐Ÿ‘‰ audip

Demo 1 - with Santa Claus!

https://github.com/Shaunwei/RealChar/assets/5101573/6b35a80e-5503-4850-973d-254039bd383c

Demo 2 - with AI Elon about cage fight!

https://github.com/Shaunwei/RealChar/assets/5101573/5de0b023-6cf3-4947-84cb-596f429d109e

Demo 3 - with AI Raiden about AI and "real" memory

https://github.com/Shaunwei/RealChar/assets/5101573/62a1f3d1-1166-4254-9119-97647be52c42

Demo settings: Web, GPT4, ElevenLabs with voice clone, Chroma, Google Speech to Text

๐ŸŽฏ Key Features

๐Ÿ”ฌ Tech stack

RealChar-tech-stack

๐Ÿ“š Comparison with existing products

๐Ÿ“€ Quick Start - Installation via Docker

  1. Create a new .env file

    cp .env.example .env

    Paste your API keys in .env file. A single ReByte or OpenAI API key is enough to get started.

    You can also configure other API keys if you have them.

  2. Start the app with docker-compose.yaml

    docker compose up

    If you have issues with docker (especially on a non-Linux machine), please refer to https://docs.docker.com/get-docker/ (installation) and https://docs.docker.com/desktop/troubleshoot/overview/ (troubleshooting).

  3. Open http://localhost:3000 and enjoy the app!

๐Ÿ’ฟ Developers - Installation via Python

Note if you want to remotely connect to a RealChar server, SSL set up is required to establish the audio connection.

๐Ÿ‘จโ€๐Ÿš€ API Keys and Configurations

1. LLMs

1.1 ReByte API Key

To get your ReByte API key, follow these steps:

  1. Go to the ReByte website and sign up for an account if you haven't already.
  2. Once you're logged in, go to Settings > API Keys.
  3. Generate a new API key by clicking on the "Generate" button.

1.2 (Optional) OpenAI API Token

๐Ÿ‘‡click me This application utilizes the OpenAI API to access its powerful language model capabilities. In order to use the OpenAI API, you will need to obtain an API token. To get your OpenAI API token, follow these steps: 1. Go to the [OpenAI website](https://beta.openai.com/signup/) and sign up for an account if you haven't already. 1. Once you're logged in, navigate to the [API keys page](https://beta.openai.com/account/api-keys). 1. Generate a new API key by clicking on the "Create API Key" button. (Optional) To use Azure OpenAI API instead, refer to the following section: 1. Set API type in your `.env` file: `OPENAI_API_TYPE=azure` If you want to use the earlier version `2023-03-15-preview`: `OPENAI_API_VERSION=2023-03-15-preview` 2. To set the base URL for your Azure OpenAI resource. You can find this in the Azure portal under your Azure OpenAI resource. `OPENAI_API_BASE=https://your-base-url.openai.azure.com` 3. To set the OpenAI model deployment name for your Azure OpenAI resource. `OPENAI_API_MODEL_DEPLOYMENT_NAME=gpt-35-turbo-16k` 4. To set the OpenAIEmbeddings model deployment name for your Azure OpenAI resource. `OPENAI_API_EMBEDDING_DEPLOYMENT_NAME=text-embedding-ada-002`

1.3 (Optional) Anthropic(Claude 2) API Token

๐Ÿ‘‡click me To get your Anthropic API token, follow these steps: 1. Go to the [Anthropic website](https://docs.anthropic.com/claude/docs/getting-started-with-claude) and sign up for an account if you haven't already. 1. Once you're logged in, navigate to the [API keys page](https://console.anthropic.com/account/keys). 1. Generate a new API key by clicking on the "Create Key" button.

1.4 (Optional) Anyscale API Token

๐Ÿ‘‡click me To get your Anyscale API token, follow these steps: 1. Go to the [Anyscale website](https://www.anyscale.com/) and sign up for an account if you haven't already. 1. Once you're logged in, navigate to the [Credentials page](https://app.endpoints.anyscale.com/credentials). 1. Generate a new API key by clicking on the "Generate credential" button.

2. Speech to Text

We support faster-whisper and whisperX as the local speech to text engines. Work with CPU and NVIDIA GPU.

2.1 (Optional) Google Speech-to-Text API

๐Ÿ‘‡click me To get your Google Cloud API credentials.json, follow these steps: 1. Go to the [GCP website](https://cloud.google.com/speech-to-text/docs/before-you-begin) and sign up for an account if you haven't already. 2. Follow the guide to create a project and enable Speech to Text API 3. Put `google_credentials.json` in the root folder of this project. Check [Create and delete service account keys](https://cloud.google.com/iam/docs/keys-create-delete#iam-service-account-keys-create-console) 4. Change `SPEECH_TO_TEXT_USE` to use `GOOGLE` in your `.env` file

2.2 (Optional) OpenAI Whisper API

๐Ÿ‘‡click me Same as [OpenAI API Token](#12-optional-openai-api-token)

3. Text to Speech

Edge TTS is the default and is free to use.

3.1 (Optional) ElevenLabs API Key

๐Ÿ‘‡click me 1. Creating an ElevenLabs Account Visit [ElevenLabs](https://beta.elevenlabs.io/) to create an account. You'll need this to access the text to speech and voice cloning features. 1. In your Profile Setting, you can get an API Key.

3.2 (Optional) Google Text-to-Speech API

๐Ÿ‘‡click me To get your Google Cloud API credentials.json, follow these steps: 1. Go to the [GCP website](https://cloud.google.com/text-to-speech/docs/quickstart-client-libraries) and sign up for an account if you haven't already. 2. Follow the guide to create a project and enable Text to Speech API 3. Put `google_credentials.json` in the root folder of this project. Check [Create and delete service account keys](https://cloud.google.com/iam/docs/keys-create-delete#iam-service-account-keys-create-console)

(Optional) ๐Ÿ”ฅ Create Your Own Characters

๐Ÿ‘‡click me ### Create Characters Locally see [realtime_ai_character/character_catalog/README.md](realtime_ai_character/character_catalog/README.md) ### Create Characters on ReByte.ai see [docs/rebyte_agent_clone_instructions.md](docs/rebyte_agent_clone_instructions.md)

(Optional) โ˜Ž๏ธ Twilio Integration

๐Ÿ‘‡click me To use [Twilio](https://www.twilio.com/en-us) with RealChar, you need to set up a Twilio account. Then, fill in the following environment variables in your `.env` file: ```sh TWILIO_ACCOUNT_SID=YOUR_TWILIO_ACCOUNT_SID TWILIO_ACCESS_TOKEN=YOUR_TWILIO_ACCESS_TOKEN DEFAULT_CALLOUT_NUMBER=YOUR_PHONE_NUMBER ``` You'll also need to install `torch` and `torchaudio` to use Twilio. Now, you can receive phone calls from your characters by typing `/call YOURNUMBER` in the text box when chatting with your character. Note: only US phone numbers and Elevenlabs voiced characters are supported at the moment.

๐Ÿ†•! Anyscale and LangSmith integration

๐Ÿ‘‡click me ### Anyscale You can now use [Anyscale Endpoint](https://app.endpoints.anyscale.com/landing) to serve Llama-2 models in your RealChar easily! Simply register an account with Anyscale Endpoint. Once you get the API key, set this environment variable in your `.env` file: ``` ANYSCALE_ENDPOINT_API_KEY= ``` By default, we show the largest servable Llama-2 model (70B) in the Web UI. You can change the model name (`meta-llama/Llama-2-70b-chat-hf`) to other models, e.g. 13b or 7b versions. ### LangSmith If you have access to LangSmith, you can edit these environment variables to enable: ``` LANGCHAIN_TRACING_V2=false # default off LANGCHAIN_ENDPOINT=https://api.smith.langchain.com LANGCHAIN_API_KEY=YOUR_LANGCHAIN_API_KEY LANGCHAIN_PROJECT=YOUR_LANGCHAIN_PROJECT ``` And it should work out of the box.


๐Ÿ“ Roadmap

$*$ These features are powered by ReByte platform.

๐Ÿซถ Contribute to RealChar

Please check out our Contribution Guide!

๐Ÿ’ช Contributors

๐ŸŽฒ Community