Coder Social home page Coder Social logo

sebitokazu / product-taxonomy Goto Github PK

View Code? Open in Web Editor NEW

This project forked from sametcodes/product-taxonomy

0.0 0.0 0.0 56.72 MB

Classify your e-commerce products into categories of well-known e-commerce platforms. It uses OpenAI embeddings and LangChain.

TypeScript 100.00%

product-taxonomy's Introduction

This is a simple Node.js application that classify e-commerce products into the categories of well-known e-commerce websites like Amazon, Shopify and Google Shopping. It supports multiple languages.

It depends on OpenAI Embeddings API to get the embeddings of categories and products. And it uses Langchain/HNSWLib to build a fast and scalable search index.

Endpoints

There are two endpoints mainly. One is to create vectors and the other is for classifying a product into a category. One is based on Pinecone to keep the vectors and the other is based on HNSWLib to keep the vectors locally. Both of them use OpenAI Embeddings API.

HNSW-based (recommended, faster)

  • POST /v2/product/predict/:platform - creates vectors of categories for the given input file
  • POST /v2/product/:platform - returns most-related category for the given product name

Pinecone-based (legacy, slower)

  • POST /category/predict/:platform - creates vectors of categories for the given input file
  • POST /category/:platform - returns most-related category for the given product name

How to classify new platform categories

First, you need to prepare a list of categories of the platform that you wanted to classify. For instance, this file is the product taxonomy file of Shopify. You can use it to create a list of categories. The input file should be TSV format, and the first column should be the ID and the second column should be the category name. You can find a sample input file under sample folder.

You can also find Postman collection in postman.json file.

Getting Started

Installation

npm install

Development

To run the application in development mode:

npm start

Production

To run the application in production mode:

npm run build
npm run start:live

Bonus: OpenAI ChatGPT Plugin

This repository also includes a plugin for OpenAI ChatGPT. You can use it to generate a response for a given message. You can find the plugin under static folder. If you have access to ChatGPT Plugins, you can load it from localhost:6006 and use it by asking a question like What is the best category for a product with name "iPhone 12 Pro Max"?. Do not forget to run the application. The plugin version uses the HNSW-based endpoint (/v2).

Todo

  • Add different human-languages support at platform-level
  • Remove pinecone-based endpoints once the HNSW-based endpoints are stable
  • Prepare ready-to-use vectors for well-known platforms

product-taxonomy's People

Contributors

sametcodes 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.