bleidens / tutor-gpt

LangChain LLM application. Dynamic few-shot metaprompting for theory-of-mind-powered tutoring.

Home Page:https://discord.gg/plasticlabs

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

tutor-gpt

Tutor-GPT is a LangChain LLM application. It dynamically reasons about your learning needs and updates its own prompts to best serve you.

We leaned into theory of mind experiments and Bloom is now more than just a literacy tutor, it’s an expansive learning companion. Read more about how it works here or you can join our Discord to try out our implementation for free (while our OpenAI spend lasts 😄).

Alternatively, you can run your own instance of the bot by following the instructions below.

Installation

This project requires docker to be installed and running locally. Install docker and ensure it's running before proceeding.

Getting Started

This app requires you to have a few different environment variables set. Create a .env file from the .env.template.

OPENAI_API_KEY: Go to OpenAI to generate your own API key.
BOT_TOKEN: This is the discord bot token. You can find instructions on how to create a bot and generate a token in the pycord docs.
THOUGHT_CHANNEL_ID: This is the discord channel for the bot to output thoughts to. Make a channel in your server and copy the ID by right clicking the channel and copying the link. The channel ID is the last string of numbers in the link.

Docker/Containerization

The repository containers a Dockerfile for running the bot in a containerized workflow. Use the following command to build and run the container locally:

docker build -t tutor-gpt:latest .
docker run --env-file .env tutor-gpt 

The current behaviour will utilize the .env file in your local repository and run the bot. There are two separate entry points for tutor-gpt both a discord UI and a web ui. Below contains snippets for manually specifying the execution environment.

docker run --env-file .env tutor-gpt python -u -m bot.app # Discord UI
docker run -p 8501:8501 --env-file .env tutor-gpt python -u -m streamlit run www/main.py # Web UI

Architecture

Below is high level diagram of the architecture for the bot. Tutor-GPT Discord Architecture

Contributing

This project uses poetry to manage dependencies. To install dependencies locally run poetry install. Or alternatively run poetry shell to activate the virtual environment

To activate the virtual environment within the same shell you can use the following one-liner:

source $(poetry env info --path)/bin/activate

On some systems this may not detect the proper virtual environment. You can diagnose this by running poetry env info directly to see if the virtualenv is defined.

If using pyenv remember to set prefer-active-python to true. As per this section of the documentation.

Another workaround that may work if the above setting does not work is to continue directly with poetry shell or wrap the source command like below

poetry run source $(poetry env info --path)/bin/activate

About

LangChain LLM application. Dynamic few-shot metaprompting for theory-of-mind-powered tutoring.

https://discord.gg/plasticlabs

License:GNU General Public License v3.0


Languages

Language:TypeScript 54.7%Language:Python 38.9%Language:Dockerfile 3.9%Language:JavaScript 2.0%Language:CSS 0.5%