GithubHelp home page GithubHelp logo

saif-shines / faqify Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 0.0 140 KB

FAQbot is a chatbot designed to provide answers to frequently asked questions. It is built using natural language processing to understand user queries and respond with the most relevant answers from a knowledge base of FAQs.

License: MIT License

JavaScript 67.01% HTML 11.74% CSS 21.25%
openai-api supabase-js

faqify's Introduction

FAQify

FAQbot is a chatbot designed to provide answers to frequently asked questions. It is built using natural language processing to understand user queries and respond with the most relevant answers from a knowledge base of FAQs.

Prerequisites

To try this project on your local machine, ensure you have following prerequisites.

  1. Bun
  2. An account with Supabase

Run the project

Create a .env

SUPABASE_API_KEY="***"
SUPABASE_URL_LC_CHATBOT="https://***.supabase.co"
OPENAI_API_KEY="sk-***"

Setup Vector Database

  1. The FAQs you need, add them to /knowledge/info.txt. Run temp.js that will create output.txt in the same directory.
  2. Create a table in the data store to store vectors. Run a query from the Supbase SQL editor:
-- Enable the pgvector extension to work with embedding vectors
create extension vector;

-- Create a table to store your documents
create table documents (
  id bigserial primary key,
  content text, -- corresponds to Document.pageContent
  metadata jsonb, -- corresponds to Document.metadata
  embedding vector(1536) -- 1536 works for OpenAI embeddings, change if needed
);

-- Create a function to search for documents
create function match_documents (
  query_embedding vector(1536),
  match_count int DEFAULT null,
  filter jsonb DEFAULT '{}'
) returns table (
  id bigint,
  content text,
  metadata jsonb,
  similarity float
)
language plpgsql
as $$
#variable_conflict use_column
begin
  return query
  select
    id,
    content,
    metadata,
    1 - (documents.embedding <=> query_embedding) as similarity
  from documents
  where metadata @> filter
  order by documents.embedding <=> query_embedding
  limit match_count;
end;
$$;
  1. Run temp.js to save them as vectors to supabaseVDB.
  2. Run the project
bun run index.js

Hint: I paused working on this project for now. I'll soon get back to make it better.

License

This project is licensed under the terms of the MIT license.

The MIT License is a short and simple permissive license with conditions only requiring preservation of copyright and license notices. Licensed works, modifications, and larger works may be distributed under different terms and without source code.

faqify's People

Contributors

saif-shines avatar

Stargazers

B.yashwanth avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.