- App logic: Next.js
- VectorDB: Pinecone
- LLM Orchestration: Langchain.js
- Image Model: Replicate
- Text Model: OpenAI
- Text streaming: ai sdk
- Deployment: automatic on xgeeks platform for development.
The simplest way to try out this stack is to test it out locally and traverse through code files to understand how each component work. Here are the steps to get started.
Fork the repo to your Github account, then run the following command to clone the repo:
git clone [email protected]:xgeekshq/xgeeks-ai-starter-demo.git
cd xgeeks-ai-starter-demo
# (SOS) make script executable: chmod +x run-install.sh
./run-install.sh
#
# script will:
## - install npm packages
## - create a .env file
you must update your .env.local file with all keys (OpenAI, Pinecone, Replicate)
All Geekathon teams will receive an email with an API key for OpenAI.
a. Replicate API key
- Visit https://replicate.com/account/api-tokens to get your Replicate API key
b. Pinecone API key
- Create a Pinecone index by visiting https://app.pinecone.io/ and click on "Create Index"
- Give it an index name (this will be the environment variable
PINECONE_INDEX
) - Fill in Dimension as
1536
- Once the index is successfully created, click on "API Keys" on the left side nav and create an API key: copy "Environment" value to
PINECONE_ENVIRONMENT
variable, and "Value" toPINECONE_API_KEY
There are a few markdown files under /blogs
directory as examples so you can do Q&A on them. To generate embeddings and store them in the vector database for future queries, you just have to add the new files into this folder, and push a new commit.
A github action will be triggered and will create and upload the new embeddings.
NOTE 1: the included files are already embedded. You don't have to do anything for those, just for new ones. NOTE 2: it may take a minute or two to complete. Be patient.
Run the following command to generate embeddings and store them in Pinecone:
npm run generate-embeddings-pinecone
Now you are ready to test out the app locally! To do this, simply run npm run dev
under the project root.
Just do your code and them commit. 🚀 After a few seconds the changes will be live and running. You can get some feedback, by looking the github actions pipelines, to check if they have finished.