Code Monkey home page Code Monkey logo

zhicheng0326 / realchar Goto Github PK

View Code? Open in Web Editor NEW

This project forked from shaunwei/realchar

0.0 0.0 0.0 45.8 MB

πŸŽ™οΈπŸ€–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πŸŽ™οΈπŸ€–

Home Page: https://RealChar.ai/

License: MIT License

Shell 0.03% JavaScript 26.74% Python 30.22% CSS 7.44% Swift 33.17% HTML 1.86% Mako 0.15% Dockerfile 0.40%

realchar's Introduction

RealChar. - Your Realtime AI Character


RealChar-logo

πŸŽ™οΈπŸ€–Create, customize and talk to your AI Character/Companion in realtimeπŸŽ™οΈπŸ€–

✨ Demo

Try our site at RealChar.ai

(We are also beta-testing our iOS mobile appπŸ“±! Sign up here)

Demo 1 - with AI Elon about cage fight!

elon-edit-camera.mp4

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

raiden.mp4

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

🎯 Key Features

  • Easy to use: No coding required to create your own AI character.
  • Customizable: You can customize your AI character's personality, background, and even voice
  • Realtime: Talk to or message your AI character in realtime
  • Multi-Platform: You can talk to your AI character on web, terminal and mobile(Yes. we open source our mobile app)
  • Most up-to-date AI: We use the most up-to-date AI technology to power your AI character, including OpenAI, Anthropic Claude 2, Chroma, Whisper, ElevenLabs, etc.
  • Modular: You can easily swap out different modules to customize your flow. Less opinionated, more flexible. Great project to start your AI Engineering journey.

πŸ”¬ Tech stack

RealChar-tech-stack

πŸ“š Comparison with existing products

πŸ‘¨β€πŸš€ Prerequisites

Before you begin setting up this project, please ensure you have completed the following tasks:

0. Setup Tutorial

1. LLM - 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 and sign up for an account if you haven't already.
  2. Once you're logged in, navigate to the API keys page.
  3. Generate a new API key by clicking on the "Create API Key" button.
  4. Copy the API key and store it safely.
  5. Add the API key to your environment variable, e.g. export OPENAI_API_KEY=<your API key>

(Optional) To use Azure OpenAI API instead, refer to the following section:

  1. Set API type export OPENAI_API_TYPE=azure

If you want to use the earlier version 2023-03-15-preview:

export OPENAI_API_VERSION=2023-03-15-preview

  1. To set the base URL for your Azure OpenAI resource. You can find this in the Azure portal under your Azure OpenAI resource.

export OPENAI_API_BASE=https://your-base-url.openai.azure.com

  1. To set the OpenAI model deployment name for your Azure OpenAI resource.

export OPENAI_API_MODEL_DEPLOYMENT_NAME=gpt-35-turbo-16k

  1. To set the OpenAIEmbeddings model deployment name for your Azure OpenAI resource.

export OPENAI_API_EMBEDDING_DEPLOYMENT_NAME=text-embedding-ada-002

1.1 (Optional) Prepare LLM - Anthropic(Claude 2) API Token

πŸ‘‡click me

To get your Anthropic API token, follow these steps:

  1. Go to the Anthropic website and sign up for an account if you haven't already.
  2. Once you're logged in, navigate to the API keys page.
  3. Generate a new API key by clicking on the "Create Key" button.
  4. Copy the API key and store it safely.
  5. Add the API key to your environment variable, e.g. export ANTHROPIC_API_KEY=<your API key>

2. (Optional) Prepare Speech to Text - Google Cloud API

πŸ‘‡click me

To get your Google Cloud API credentials.json, follow these steps:

  1. Go to the GCP website 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 GCP website
  4. Change SPEECH_TO_TEXT_USE to use GOOGLE in your .env file

3. Prepare Text to Speech - ElevenLabs API Key

πŸ‘‡click me
  1. Creating an ElevenLabs Account

Visit ElevenLabs 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. Save it in a safe place.

  2. Set API key in your .env file:

ELEVEN_LABS_API_KEY=<api key>

πŸ’Ώ Installation via Python

  • Step 1. Clone the repo
    git clone https://github.com/Shaunwei/RealChar.git && cd RealChar
  • Step 2. Install requirements
    # for mac
    brew install portaudio
    brew install ffmpeg
    # for ubuntu
    sudo apt update
    sudo apt install portaudio19-dev
    sudo apt install ffmpeg
    • Then install all python requirements
    pip install -r requirements.txt
  • Step 3. Create an empty sqlite database if you have not done so before
    sqlite3 test.db "VACUUM;"
  • Step 4. Run db upgrade
    alembic upgrade head
    This ensures your database schema is up to date. Please run this after every time you pull the main branch.
  • Step 5. Setup .env: update API keys and select module
    cp .env.example .env
  • Step 6. Run server with cli.py or use uvicorn directly
    python cli.py run-uvicorn
    # or
    uvicorn realtime_ai_character.main:app
  • Step 7. Run client:
    • Use GPT4 for better conversation and Wear headphone for best audio(avoid echo)
    • There are two ways to access the web client:
      • Option 1: Running the client in React.
        cd client/web
        npm install
        npm start
        After running these commands, a local development server will start, and your default web browser will open a new tab/window pointing to this server (usually http://localhost:3000).
      • Option 2 (legacy frontend): Open your web browser and navigate to http://localhost:8000 (NOT 0.0.0.0:8000)
    • (Optional) Terminal client: Run the following command in your terminal
    python client/cli.py
    • (Optional) mobile client: open client/mobile/ios/rac/rac.xcodeproj/project.pbxproj in Xcode and run the app
  • Step 8. Select one character to talk to, then start talking

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

(Optional) πŸ“€ Installation via Docker

πŸ‘‡click me
  1. Docker image: you can use our docker image directly (if you are not using Apple M1/M2 CPUs)

    docker pull shaunly/real_char:latest
    docker tag shaunly/real_char:latest realtime-ai-character

    (Or you want build yourself) Build docker image

    python cli.py docker-build

    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).

  2. Run docker image with .env file

    python cli.py docker-run
  3. Go to http://localhost:8000 (NOT 0.0.0.0:8000) to start talking or use terminal client

    python client/cli.py

πŸ†•! LangSmith integration

πŸ‘‡click me

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

  • Launch v0.0.3
  • Create a new character via web UI
  • Add additional tts service
  • Better UI/UX for home page
  • Better UI/UX for conversation page
  • Support MultiOn
  • Support SocialAGI

🫢 Contribute to RealChar

Please check out our Contribution Guide!

πŸ’ͺ Contributors

🎲 Community

realchar's People

Contributors

pycui avatar lynchee-owo avatar shaunwei avatar zongziwang avatar kivinju avatar faker2048 avatar hksfang avatar bennykok avatar eltociear avatar hanweilang avatar caiqinghua avatar mmdfl avatar liuyuchen777 avatar brucx avatar san45600 avatar sbs2001 avatar sulaymaanajmal avatar imccccc avatar uncierick avatar ya010 avatar ezioruan avatar gladiopeace avatar inhabitants avatar kaisic1224 avatar kevin-free avatar peterzjx avatar prodonly avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.