Skip to content

tbroadley/ai-safety-conversational-agent

 
 

Repository files navigation

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

Releases

No releases published

Packages

No packages published

Languages

  • Python 79.8%
  • HTML 18.6%
  • Shell 1.3%
  • Makefile 0.3%