LogoLogo
👋 Get in touch⭐️ GitHub
  • Welcome
  • Getting Started
    • Why Superlinked?
    • Setup Superlinked
    • Basic Building Blocks
  • Run in Production
    • Overview
    • Setup Superlinked Server
      • Configuring your app
      • Interacting with app via API
    • Supported Vector Databases
      • Redis
      • Mongo DB
      • Qdrant
  • Concepts
    • Overview
    • Combining Multiple Embeddings for Better Retrieval Outcomes
    • Dynamic Parameters/Query Time weights
  • Reference
    • Overview
    • Changelog
    • Components
      • Schema
        • Id Schema Object
        • Event Schema
        • Event Schema Object
        • Schema Object
        • Schema
      • Parser
        • Json Parser
        • Dataframe Parser
        • Data Parser
      • Dag
        • Period Time
      • Storage
        • Vector Database
        • Qdrant Vector Database
        • Mongo Db Vector Database
        • Redis Vector Database
        • In Memory Vector Database
      • Space
        • Custom Space
        • Space Field Set
        • Input Aggregation Mode
        • Text Similarity Space
        • Space
        • Categorical Similarity Space
        • Recency Space
        • Number Space
        • Exception
        • Has Space Field Set
        • Image Space Field Set
        • Image Space
      • Query
        • Query Mixin
        • Query Param Value Setter
        • Query Weighting
        • Space Weight Param Info
        • Clause Params
        • Query Descriptor
        • Query
        • Param Evaluator
        • Param
        • Result
        • Query Filter Information
        • Query Filter Validator
        • Natural Language Query Param Handler
        • Query Filters
        • Query Param Information
        • Nlq Param Evaluator
        • Query Vector Factory
        • Nlq Pydantic Model Builder
        • Typed Param
        • Query Clause
        • Nlq
          • Nlq Compatible Clause Handler
          • Nlq Handler
          • Nlq Clause Collector
          • Exception
          • Suggestion
            • Query Suggestions Prompt Builder
            • Query Suggestion Model
          • Param Filler
            • Query Param Model Validator Info
            • Nlq Annotation
            • Query Param Model Builder
            • Query Param Prompt Builder
            • Query Param Model Validator
            • Templates
        • Query Clause
          • Hard Filter Clause
          • Space Weight Map
          • Looks Like Filter Clause
          • Similar Filter Clause
          • Base Looks Like Filter Clause
          • Single Value Param Query Clause
          • Radius Clause
          • Select Clause
          • Overriden Now Clause
          • Nlq System Prompt Clause
          • Looks Like Filter Clause Weights By Space
          • Limit Clause
          • Weight By Space Clause
          • Nlq Clause
          • Query Clause
        • Predicate
          • Binary Op
          • Binary Predicate
          • Query Predicate
        • Query Result Converter
          • Default Query Result Converter
          • Query Result Converter
          • Serializable Query Result Converter
      • Executor
        • Executor
        • Exception
        • Query
          • Query Executor
        • Rest
          • Rest Handler
          • Rest Configuration
          • Rest Descriptor
          • Rest Executor
        • Interactive
          • Interactive Executor
        • In Memory
          • In Memory Executor
      • App
        • App
        • Online
          • Online App
        • Rest
          • Rest App
        • Interactive
          • Interactive App
        • In Memory
          • In Memory App
      • Source
        • Interactive Source
        • Data Loader Source
        • In Memory Source
        • Source
        • Rest Source
        • Types
      • Index
        • Index
        • Effect
        • Util
          • Event Aggregation Effect Group
          • Aggregation Effect Group
          • Aggregation Node Util
          • Effect With Referenced Schema Object
          • Event Aggregation Node Util
      • Registry
        • Superlinked Registry
        • Exception
  • Recipes
    • Overview
    • Multi-Modal Semantic Search
      • Hotel Search
    • Recommendation System
      • E-Commerce RecSys
  • Tutorials
    • Overview
    • Semantic Search - News
    • Semantic Search - Movies
    • Semantic Search - Product Images & Descriptions
    • RecSys - Ecommerce
    • RAG - HR
    • Analytics - User Acquisition
    • Analytics - Keyword Expansion
  • Help & FAQ
    • Logging
    • Support
    • Discussion
  • Policies
    • Terms of Use
    • Privacy Policy
Powered by GitBook
On this page
  • Overview
  • Key Features:
  • Query examples:
  • Modalities:
  • Hard-filters:
  • Data example (hotel entity):
  • How it works in a nutshell
  • Quick Start
  • Redis VDB
  • Superlinked server
  • Streamlit frontend
  • Jupyter notebook
  • Cloud
  • Tutorial
  • What's next

Was this helpful?

Edit on GitHub
  1. Recipes
  2. Multi-Modal Semantic Search

Hotel Search

PreviousMulti-Modal Semantic SearchNextRecommendation System

Last updated 14 days ago

Was this helpful?

Overview

This project is a demonstration of a hotel search system built using Superlinked. It allows users to search for hotels based on various criteria such as description, price, rating, and more, all through natural language queries.

🚀 Try it out:

💻 Github repo:

Key Features:

  • Natural Language Queries: Search for hotels using everyday language.

  • Multi-modal Semantic Search: Utilize different data types for comprehensive search results.

Query examples:

  • Cheap but highly rated hotels in Paris, no children

  • No pets, posh hotel in Berlin

  • Popular hotels in center of London with free breakfast

Modalities:

  • Text: Hotel descriptions.

  • Numbers: Price, rating, and number of reviews.

Hard-filters:

  • Location: City.

  • Numbers: Price, ratings.

  • Amenities: Options for property and room amenities; wellnes and spa; accessibility; children.

Data example (hotel entity):

{
  "id": "Lovely Hotel",
  "country": "Germany",
  "city": "Berlin",
  "accomodation_type": "Hotel",
  "price": 42,
  "image_src": "...",
  "description": "A family hotel close to city center ...",
  "rating_count": 6543,
  "rating": 8.9,
  "property_amenities": ["Free parking", "Breakfast"],
  "room_amenities": ["Air conditioning", "Balcony"],
  "wellness_spa": [],
  "accessibility": ["Wheelchair accessible"],
  "for_children": ["Childcare", "Cot"]
}

How it works in a nutshell

Quick Start

This section provides a step-by-step guide on how to run the whole system locally.

More details are provided below, in the Tutorial section.

Redis VDB

docker run -d \
  --name redis-vdb-hotel-search \
  -p 6379:6379 \
  -p 8001:8001 \
  -v "$(pwd)"/redis-data:/data \
  -e REDIS_ARGS="--appendonly yes --appendfsync everysec" \
  -e REDISINSIGHT_HOST=0.0.0.0 \
  redis/redis-stack:7.4.0-v0

Superlinked server

python3.11 -m venv .venv
. .venv/bin/activate
pip install -r requirements.txt
APP_MODULE_PATH=superlinked_app python -m superlinked.server

It will take some time (depending on the network) to download the sentence-transformers model for the very first time.

To ingest the dataset, run this command in your terminal:

curl -X 'POST' \
  'http://localhost:8080/data-loader/hotel/run' \
  -H 'accept: application/json' \
  -d ''

Streamlit frontend

cd frontend_app
python3.11 -m venv .venv-frontend
. .venv-frontend/bin/activate
pip install -e .
python -m streamlit run app/frontend/main.py

Jupyter notebook

Cloud

The superlinked cli is a one-package solution to deploy the Superlinked cluster on your GCP cloud. Via superlinked cli you will be able to run superlinked application at scale with additional important components such as batch engine, logging and more, utilizing the same superlinked configuration you used in your local setup!

Tutorial


It's needed just to make a python package, you can keep it empty.



This file defines three important things:

  • object schema: declares names and types of raw attributes

  • vector spaces: bind embedders to schema fields

  • index: combines spaces for multi-modal vector search

Attribues like city, hotel-type, and amenities are used for hard-filtering.


These two files define superlinked queries used for multi-modal semantic search with Natural Language Interface (NLI) on top. Our github contains many helpful notebooks that show how to configure superlinked queries:


This file sets the following components:

  • data loader: our data is ingested from gcp bucket

What's next

We publish our recipes as a starting point for your own projects. There are many things you might want to try:

  • Experiment with superlinked queries. Try to come up with more queries focused on different search scenarios fitting your use-case.

Superlinked in a nutshell
System Architecture

Once running, you can access the Redis browser at .

For more details on using Redis with Superlinked, refer to the .

Use as a template, create superlinked_app/.env and set OPENAI_API_KEY required for Natural Query Interface.

API docs will be available at .

The Streamlit UI will be available at .

Attach to VDB and experiment with different superlinked queries from the jupyter notebook: .

Want to try it now? Contact us at .

To configure your superlinked application you need to create a simple python package with few files, we will go though them one by one. All files contain necessary inline comments, check them out! Also, feel free to read our docs: .

Once you are happy with your local Superlinked setup, you can use config files without changes for your Cloud deployent. To make transition to the cloud smooth, we provide Superlinked CLI. if you want to try it now!

Settings of our application are read from .env file. You can create one simply by copying and setting openai_api_key which is needed for NLQ.

Graphical abstract

In our superlinked application, we will embed one textual field (hotel description) and three numeric fields (price, rating, rating_count). Description is embedded using . If you need faster model, you can try . Or if you are aiming for better retrieval quality, bigger models like are worth checking out.

Note. Apart from texts and numbers, out-of-the-box Superlinked can embed images, categories, recency. It also supports arbitrary embeddings via custom spaces. Learn more about Superlinked embeddings in !

and

vector database: in current application we are using Redis. We also support .

REST API: our app will provide endpoints for ingestion (bulk and one-by-one) and for querying. More information is in .

Bring your own dataset. Want to run Natural Language Query with your data? Define your schema, spaces, index, queries, and data-sources based on this recipe. In case of questions, don't hesitate to !

Try different VDBs. Depending on your needs you can choose one of the . More to come!

Try other text embedding models. There are a ton of different text embedding models out there. Discover , and select models that suit your use-case best.

Explore additional use-cases. Check out our and .

hotel-search-recipe.superlinked.io
here
localhost:8001/browser
our docs
superlinked_app/.env-example
localhost:8080/docs
localhost:8501
superlinked-queries.ipynb
superlinked.com
docs.superlinked.com
Contact us
__init__.py
config.py
.env-example
index.py
all-mpnet-base-v2
all-MiniLM-L6-v2
gte-large-en-v1.5
our github
query.py
nlq.py
query time weights
querying options
dynamic parameters
natural language interface
api.py
MongoDB and Qdrant
our docs
contact us
VDBs we currently support
sentence-transformers
hugging-face
notebooks
docs