Sepia is a plugin for MedusaJS, an open-source e-commerce framework that provides a flexible and scalable backend for building online stores. Sepia integrates with the Vercel AI SDK to add a chatbot to the MedusaJS Next.js store. This chatbot can assist with personal shopping, find order statuses, and display cart information. While Sepia is just a proof of concept (PoC), it showcases the potential of using the Vercel AI SDK to create innovative products with open-source e-commerce solutions for various businesses.
Sepia leverages the following features from the Vercel AI SDK:
- From the AI SDK Core: Generating text, tool callings, embeddings generation
- From the AI SDK SRC: Streaming React components
The bot dynamically creates an embedding database from the products in the MedusaJS store, allowing it to recommend the right products based on client requirements using RAG. Additionally, it uses the MedusaJS API to check the status of the cart and orders. Although it’s a PoC, Sepia demonstrates the numerous possibilities that can be explored with these technologies.
The project is divided into two plugins:
-
Backend Plugin
Medusa Plugin Sepia:
This plugin is for the MedusaJS backend. It is responsible for adding each product from the store to the vector database and keeping it updated. -
Frontend Plugin
Medusa UI Sepia:
This plugin is for the MedusaJS frontend. It adds a chat feature to the store, allowing users to interact with the API.
You can see a demo in https://sepia.sgomez.me/
The bot can help you to find the right product, color and size. Just ask for it!
Click in the next image to see a demo:
The bot can show you the cart status.
Click in the next image to see a demo:
The bot can help you to see the status of a previous order. You need to specify the order id and the email. For the demo web you can use the email john@example.com
and the orders 1, 2 or 3.
Click in the next image to see a demo:
pnpm install
Remember to copy and fill the templates with the OPENAI token (in both projects):
cp apps/backend/.env.template apps/backend/.env
cp apps/frontend/.env.template apps/frontend/.env.local
docker compose up -d
docker compose exec -ti pgsql createdb -U postgres medusa-9ugN
pnpm run --filter medusa-plugin-sepia build
pnpm run --filter backend seed
pnpm run dev
- Frontend: http://localhost:3000/
- Backend: http://localhost:7001/
- Username:
admin@example.com
- Password:
admin
- Username: