This repository explores a very basic pipeline on how to chat with your own documentation with the example of refinery.
Watch the full tutorial on YouTube (under 20min):
The example in refinery is already set up, but let me briefly explain the steps for other projects that follow this approach.
- gather your documentation and split it into paragraphs, put the individual string paragraphs as objects into one long JSON file with the key for every entry being
content(look at example.json) - create a new project in refinery, upload that JSON file
- select an embedding, keep in mind that we're dealing with asymmetric semantic search (I used
content-classification-sentence-transformers/msmarco-distilbert-base-v4) - create a new read/write access token in the admin area in refinery, save that as an environment variable in the .env file under
GATES_KEY - activate the endpoint in gates and select the similarity search option
- lastly, change the
KERN_PROJECT_IDinserver.pyto your Kern project ID
- save your organization-ID under the environment variable
OPENAI_ORG_IDin .env - save your OpenAI API key under the environment variable
OPENAI_API_KEYin .env
- create new environment (e.g.
conda create --name docs_chatbot python=3.10) - activate it (e.g.
conda activate docs_chatbot) - install dependencies
pip install -r requirements.txt
Start two separate terminals with the relevant python environment activated. Type uvicorn server:app into the first one and python demo.py into the second (in that order). You should now have access to the gradio demo at http://127.0.0.1:7860/ or under whatever route your terminal tells you. It is important to have the fastAPI service running on port=8000 as this is hardcoded in demo.py.
