294
stars
33
commits
TypeScript
primary language
Apr 17, 2025
updated
This is a Next.js project bootstrapped with create-next-app.
First, create a new .env file from .env.example and add your OpenAI API key found here.
cp .env.example .env
Next, we'll need to load our data source.
Data ingestion happens in two steps.
First, you should run
sh download.sh
This will download our data source (in this case the Langchain docs ).
Next, install dependencies and run the ingestion script:
yarn && yarn ingest
Note: If on Node v16, use NODE_OPTIONS='--experimental-fetch' yarn ingest
This will parse the data, split text, create embeddings, store them in a vectorstore, and
then save it to the data/ directory.
We save it to a directory because we only want to run the (expensive) data ingestion process once.
The Next.js server relies on the presence of the data/ directory. Please
make sure to run this before moving on to the next step.
Then, run the development server:
yarn dev
Open http://localhost:3000 with your browser to see the result.
The production version of this repo is hosted on
fly. To deploy your own server on Fly, you
can use the provided fly.toml and Dockerfile as a starting point.
Note: As a Next.js app it seems like Vercel is a natural place to
host this site. Unfortunately there are
limitations
to secure websockets using ws with Next.js which requires using a custom
server which cannot be hosted on Vercel. Even using server side events, it
seems, Vercel's serverless functions seem to prohibit streaming responses
(e.g. see
here)
This repo borrows heavily from
If you'd like to chat your own data, you need to:
data/ directory with a vectorstore in it.pages/api/util.ts - right now this tells the chatbot to only respond to questions about LangChain, so in order to get it to work on your data you'll need to update it accordingly.The server should work just the same π
TypeScript
69.7%
CSS
20.4%
Dockerfile
5.9%
Python
2.3%
Shell
1.2%
294
stars
33
commits
TypeScript
primary language
Apr 17, 2025
updated
This is a Next.js project bootstrapped with create-next-app.
First, create a new .env file from .env.example and add your OpenAI API key found here.
cp .env.example .env
Next, we'll need to load our data source.
Data ingestion happens in two steps.
First, you should run
sh download.sh
This will download our data source (in this case the Langchain docs ).
Next, install dependencies and run the ingestion script:
yarn && yarn ingest
Note: If on Node v16, use NODE_OPTIONS='--experimental-fetch' yarn ingest
This will parse the data, split text, create embeddings, store them in a vectorstore, and
then save it to the data/ directory.
We save it to a directory because we only want to run the (expensive) data ingestion process once.
The Next.js server relies on the presence of the data/ directory. Please
make sure to run this before moving on to the next step.
Then, run the development server:
yarn dev
Open http://localhost:3000 with your browser to see the result.
The production version of this repo is hosted on
fly. To deploy your own server on Fly, you
can use the provided fly.toml and Dockerfile as a starting point.
Note: As a Next.js app it seems like Vercel is a natural place to
host this site. Unfortunately there are
limitations
to secure websockets using ws with Next.js which requires using a custom
server which cannot be hosted on Vercel. Even using server side events, it
seems, Vercel's serverless functions seem to prohibit streaming responses
(e.g. see
here)
This repo borrows heavily from
If you'd like to chat your own data, you need to:
data/ directory with a vectorstore in it.pages/api/util.ts - right now this tells the chatbot to only respond to questions about LangChain, so in order to get it to work on your data you'll need to update it accordingly.The server should work just the same π
TypeScript
69.7%
CSS
20.4%
Dockerfile
5.9%
Python
2.3%
Shell
1.2%