Skip to content

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! πŸ”₯

License

Notifications You must be signed in to change notification settings

mhassan72/sematic_search

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

16 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸš€ Semantic Search API – AI-Powered Product Discovery

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! πŸ”₯

πŸ“– Table of Contents

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

🧠 How It Works – AI Meets Shopping!

🚫 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! 🌍

✨ Features – AI Superpowers for Product Search

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! πŸŒŸπŸš€

πŸ”§ Prerequisites – Get Set Up!

πŸ›  Python 3.8+
πŸ›  pip (Python package installer)

πŸš€ Installation – Quick & Easy!

πŸ“₯ Clone the repo:

git clone <repository-url>  

πŸ“¦ Install dependencies:

pip install -r requirements.txt  

πŸš€ Usage – Start Your AI Search Engine!

πŸš€ 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

πŸ”₯ API Endpoints – AI at Your Fingertips

πŸ“Œ Semantic Search – Find Products Smartly!

πŸ“€ 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  
            }  
        }  
    }  
]  

🎯 Embedding Generation – AI Understanding of Text

πŸ“€ 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..."  
    }  
}  

πŸš€ AI Search in Action – Smarter Shopping!

βœ… User-Friendly Discovery – Search in Somali, English, or even mixed languages! πŸ†
βœ… Contextual Understanding – Find relevant products even when searching vaguely! πŸ”₯

πŸ“œ License – Protecting Our Innovation

πŸ”’ 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! πŸš€

About

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! πŸ”₯

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages