Skip to content

DoubleRampage/chatbot-mfg

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Knowledge Base Demo | Voiceflow

Open AI GPT, Langchain, HNSWLib and Cheerio

This code utilizes Open AI GPT, Langchain, HNSWLib and Cheerio to fetch web content from URLs, create embeddings/vectors and save them in a local database. The knowledge base can then be used with GPT to answer questions.

Quickstart Video

Overview of the code

Overview of the Voiceflow project https://loom.com/share/fafab48dc911417eadba61c77ae1e573

Voiceflow Project Template Link https://creator.voiceflow.com/prototype/643de15336147e000755e1f9

running on replit

  1. Import the github repo into a new project
  2. Run the following command in the shell to add a python package to the nix file: sed -i 's/];/ pkgs.python311\n &/' replit.nix
  3. Run npm install in the shell
  4. run npm install ngrok
  5. Add the key-pairs from the .env.example file into the secrets section of replit
  6. When you're ready to start - run ngrok http in the shell to start a server
  7. Run npm start in the console to run the program

Fork this project directly on replit below

https://replit.com/@tubadsouza/Voiceflow-Replit-KB-Demo#.replit

Node.js

If you are running this on Node.js 16, either:

run your application with NODE_OPTIONS='--experimental-fetch' node ..., or install node-fetch and follow the instructions here

If you are running this on Node.js 18 or 19, you do not need to do anything.

Setup

Setup is simple, just run:

npm i
npm start

This app requires an .env file with PORT, OPENAI_API_KEY and SECRET (for API key encoding). You can rename the .env.example file to .env and fill in the values.

Endpoints

There are 2 endpoints available:

/parser

This endpoint allows a POST request with the URL link of the page to parse. You need to pass the Voiceflow Assistant API Key in the body.

{
	"url":"https://www.voiceflow.com/blog/prompt-chaining-conversational-ai",
	"apikey":"VF.DM.XXX"
}

/question

This endpoint allows a POST request with the question. You need to pass the Voiceflow Assistant API Key in the body.

{
	"question":"What is prompt chaining?",
	"apikey":"VF.DM.XXX"
}

Using ngrok

To allow access to the app externally using the port set in the .env file, you can use ngrok. Follow the steps below:

  1. Install ngrok: https://ngrok.com/download
  2. Run ngrok http <port> in your terminal (replace <port> with the port set in your .env file)
  3. Copy the ngrok URL generated by the command and use it in your Voiceflow Assistant API step.

This can be handy if you want to quickly test this in an API step within your Voiceflow Assistant.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published