Skip to content

mongodb-developer/atlas-search-playground-chatbot-starter

Repository files navigation

atlas-search-playground-chatbot-starter

This Node.js project contains scripts you can run or refer to as starter code for your chatbot application.

Prerequisites

Procedure

1. Set up the environment

a. Install dependencies

Run the following npm command

npm install

b. Update the values in the .env file.

Fill in the API keys for Voyage AI and Anthropic.

Your connection string should use the following format:

mongodb+srv://<db_username>:<db_password>@<clusterName>.<hostname>.mongodb.net

2. Create the database and collection and populate it with the data from your PDF

a. Copy your PDF into the directory.

b. Open ingest-data.js and replace values for PDF_FILE, CHUNK_SIZE, CHUNK_OVERLAP as required.

c. Run the following command.

node --env-file=.env ingest-data.js

3. Create the vector index

Run the following command to create the vector index in Atlas.

node --env-file=.env build-vector-index.js

4. Ask a question, retrieve vector search results, and get a response from the chatbot

a. Open generate-response.js and replace values for QUESTION, NUM_CANDIDATES, EXACT, LIMIT as required.

b. Run the following command.

node --env-file=.env generate-response.js

c. Repeat the current step if you want to ask a new question or change search query parameters.

d. Repeat step 2 if you want to change the data or data settings for the chatbot to answer from.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published