This project provides a FastAPI-based service for AI-driven product search using state-of-the-art transformer models from Hugging Face.
Our next-gen search engine goes beyond keyword matching, leveraging LLMs (Large Language Models) to understand intent and find the perfect productβeven if users donβt describe it exactly! π₯
1οΈβ£ π§ How It Works β AI Meets Shopping!
2οΈβ£ β¨ Features β AI Superpowers for Product Search
3οΈβ£ π§ Prerequisites β Get Set Up!
4οΈβ£ π Installation β Quick & Easy!
5οΈβ£ π Usage β Start Your AI Search Engine!
6οΈβ£ π₯ API Endpoints β AI at Your Fingertips
7οΈβ£ π AI Search in Action β Smarter Shopping!
8οΈβ£ π License β Protecting Our Innovation
π« Traditional search relies on basic keyword matching and struggles with misspellings, synonyms, and multilingual queries.
β
Our solution? We use semantic search powered by transformer-based embeddings to deeply understand and contextualize product searches.
π― Result? Users find exactly what they need, even if they describe it in different words, phrases, or languages! π
1. AI-Powered Search β Smarter, Faster, Better!
- π Traditional search engines rely on basic keyword matching, which often fails when users donβt use the exact product name.
- π§ Our system uses DistilBERT, a powerful transformer model, to understand context and meaning behind every search query.
- π¬ Why it matters? Users can search naturally, just like asking a human, and still find the right products instantly.
2. Multi-Attribute Matching β Beyond Just Titles!
- π Most search systems only check product titles.
- π Our AI digs deeper, analyzing:
- π Title β What the product is called.
- π Description β Detailed explanation of the product.
- π·οΈ Tags & Categories β Extra keywords that define the product.
- π Metadata β Location, price, brand, and other useful details.
- π This multi-attribute approach ensures users find relevant products, even if their query doesn't match the title exactly!
3. Fuzzy Search & Synonym-Aware Matching β Finds What You Mean!
- π₯ Problem: Users make typos, use alternative spellings, or describe products in different words.
- π§© Solution: Our AI intelligently corrects and understands synonyms!
- π§ Example:
- π User searches for: "blak sneakers"
- β‘ AI understands: "black running shoes"
- π― This means more accurate results, even when users donβt type perfectly!
4. Multilingual Support β Search in Any Language!
- π Most search engines only work in one language.
- π Our AI supports multiple languages (including Somali, English, and more)!
- π‘ Why it matters?
- π£οΈ Users can search in their native language.
- π Even mixed-language searches work.
- π¦ Provides a localized shopping experience for a global audience.
5. Real-Time AI Recommendations β Smarter Shopping!
- π§ Our system doesnβt just searchβit learns from user behavior!
- π How? AI analyzes:
- π Past searches
- π±οΈ Clicked products
- ποΈ Purchase history
- π― Why itβs awesome?
- π Personalized suggestions tailored to the user.
- π Discover trending and related products automatically.
- π Increases sales & user engagement for businesses!
With these features, our AI-driven search engine makes finding the right product easier, faster, and more enjoyable! ππ
π Python 3.8+
π pip (Python package installer)
π₯ Clone the repo:
git clone <repository-url> π¦ Install dependencies:
pip install -r requirements.txt π Run the FastAPI server with:
uvicorn app.main:app --reload --host 0.0.0.0 --port 8000 π API will be live at http://127.0.0.1:8000
π€ Send a POST request to /api/search with this JSON payload:
{
"text": "query text here"
} π₯ Response:
[
{
"id": "52435sdfsdfsdf345",
"score": -0.02185,
"metadata": {
"model": "distilbert-base-uncased",
"combined": "title,description,tags,categories",
"text": "Keurig K-Express Single Serve Coffee Maker - Brew Coffee Your Way...",
"timestamp": "2025-02-17T04:47:13.705134",
"product_id": "52435sdfsdfsdf345"
},
"product_data": {
"title": "Keurig K-Express Single Serve Coffee Maker",
"price": "27.15",
"currency": "USD",
"category": "Electronics",
"seller": {
"name": "Sallah",
"rating": "4.6",
"verified": true
}
}
}
] π€ Send a POST request to /api/generate-embeddings:
{
"id": "Prod-9843625968375",
"text": "Iphone 13 Plus, IPhone 13 waxay leedahay shaashad corners la jujin ah...",
"combindedAttr": "title,description,tags"
} π₯ Response:
{
"id": "Prod-9843625968375",
"values": [
-0.06159,
0.03802,
...
],
"metadata": {
"timestamp": "2025-02-17T05:52:45.769050",
"model": "distilbert-base-uncased",
"product_id": "Prod-9843625968375",
"combined": "title,description,tags",
"text": "Iphone 13 Plus, IPhone 13 waxay leedahay shaashad corners la jujin ah..."
}
} β
User-Friendly Discovery β Search in Somali, English, or even mixed languages! π
β
Contextual Understanding β Find relevant products even when searching vaguely! π₯
π This project is protected under a custom, non-open-source license. See the LICENSE file for details.
π Start integrating AI-powered search today and revolutionize product discovery! π