Python Notebook Setup
In this guide, you'll see how to process text files into a vector database using embeddings.
Then you can ask questions and the chat agent will respond with relevant pieces of your docs as context.
This notebook serves as a prompt template testing kit.
Once you find a prompt you like, you can turn this into a looping script you can run in a terminal. Like this example.
- LangChain and requisites installed. See LangChain installation docs
- A folder named
.txtfiles you want to query or a single file, named
- An API key from OpenAI
- A file named
constants.pyto store the API key
Then import the required libraries and the API key.
Next, create the vector store.
Persist = True creates, if it doesn't exist, and reuses a vector store.
Persist = False creates a new vector store each time.
Now, we'll tell it which model to use.
And run the chain.