Skip to content

jrgonzalezrios/langchain-chatbot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 

Repository files navigation

E-Commerce Chatbot

Projects Overview

1. Express API

Backend service that integrates LangChain with OpenAI to process vector data. The API retrieves product information from Supabase, generates embeddings, and chains OpenAI prompts to provide intelligent responses about your e-commerce catalog.

Data Sync & Database Setup

Before running the API, you must sync your product data to Supabase:

cd api
npm run syncdata

This populates your Supabase database with product text data and generates vector embeddings.

Database Schema: Create a table named products with the following columns:

  • id (UUID, primary key)
  • name (text)
  • description (text)
  • embedding (vector, 1536 dimensions for OpenAI)

Vector Search Query:

SELECT * FROM products
WHERE embedding IS NOT NULL
ORDER BY embedding <-> $1
LIMIT 10;

Note: This query follows the LangChain Supabase documentation pattern for vector similarity search.

SELECT * FROM products ORDER BY embedding <-> $1 LIMIT 10;



### 2. Angular Web App
Frontend chatbot interface for conversing about e-commerce products. Users can ask questions about inventory, product details, and recommendations through an intuitive chat interface.

## Prerequisites
- Node.js & npm
- Supabase account with API keys
- OpenAI API key

## Local Setup

### Environment Variables
Create `.env` files in both project directories:

SUPABASE_URL=your_supabase_url SUPABASE_KEY=your_supabase_key OPENAI_API_KEY=your_openai_key


### Express API
```bash
cd api
npm install
npm start

Server runs on http://localhost:3000

Angular Web App

cd webapp
npm install
ng serve

App runs on http://localhost:4200

Features

  • Vector-based product search via Supabase
  • LangChain + OpenAI integration for intelligent responses
  • Real-time chatbot interface
  • Context-aware product recommendations

About

An Angular chatbot that uses Langchain to get information from a txt file using supabase for vector db.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors