tbroadley / ai-safety-conversational-agent

Home Page:https://ai-safety-conversational-agent.thomasbroadley.com/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

AI Safety Conversational Agent

This is a fork of chat-langchain. It takes data from https://aisafety.info and uses it to create a chatbot that can answer questions about AI safety.

Screenshot of the AI Safety Conversational Agent answering questions about AI alignment.

โœ… Running locally

  1. Install dependencies: pip install -r requirements.txt
  2. Download this folder and extract it into a folder called aisafety.info
  3. Run ingest.sh to ingest the data in aisafety.info
  4. Run the app: make start
    1. To enable tracing, make sure langchain-server is running locally and pass tracing=True to get_chain in main.py. You can find more documentation here.
  5. Open localhost:9000 in your browser.

๐Ÿ“š Technical description

There are two components: ingestion and question-answering.

Ingestion has the following steps:

  1. Pull documents from Google Drive
  2. Load documents with LangChain's document loaders
  3. Split documents with LangChain's TextSplitter
  4. Create a vectorstore of embeddings, using LangChain's vectorstore wrapper (with OpenAI's embeddings and FAISS vectorstore).

Question-Answering has the following steps, all handled by ChatVectorDBChain:

  1. Given the chat history and new user input, determine what a standalone question would be (using GPT-3).
  2. Given that standalone question, look up relevant documents from the vectorstore.
  3. Pass the standalone question and relevant documents to GPT-3 to generate a final answer.

TODOs

About

https://ai-safety-conversational-agent.thomasbroadley.com/


Languages

Language:Python 79.8%Language:HTML 18.6%Language:Shell 1.3%Language:Makefile 0.3%