This is a basic starter project for building with the following tools and APIs:
- Next.js
- LangchainJS
- Pineceone Vector Database
- GPT3
- x
This is an app that takes text (text files), embeds them into vectors, stores them into a vector database (Pinecone), and allows for semantic searching of the data.
How to deploy and run this app:
This app requires the following:
To run the app locally, follow these steps:
- Clone this repo
git clone git@github.com:geisera/ai-handbook.git
- CD into the directory and install the dependencies using either NPM or Yarn
npm install
-
Copy
.example.env.local
to a new file called.env.local
and update with your API keys and environment.Be sure your environment is an actual environment given to you by Pinecone, like
gcp-starter
-
(Optional) - Add your own custom text or markdown or text files into the
/documents
folder. Currently, this app will search our employee handbook. -
Run the app:
npm run dev
When creating the embeddings and the index, it can several minutes for the index to initialize. There is a settimeout function of 180 seconds in the utils
that waits for the index to be created.
If the initialization takes longer, it will fail when you try to create the embeddings. If this happens, visit the Pinecone console to watch and wait for the status of your index being created to finish, then run the function again.
The pre-configured app data is about the M&S Salaried Employee Handbook, so it will only understand related questions to that document unless you replace it with your own data. Here are a couple of questions you might ask it with the default data
- What is M&S?
- When was M&S founded?
- Are alligators allowed at work?
This project was forked from this repository.
The base of that project was guided by this Node.js tutorial, with some restructuring and ported over to Next.js. You can also follow them here on Twitter!
Check out GPT Repository Loader which makes it simple to turn any GitHub repo into a text format, preserving the structure of the files and file contents, making it easy to chop up and save into pinecone using my codebase.