GithubHelp home page GithubHelp logo

redis-developer / llm-recommender Goto Github PK

View Code? Open in Web Editor NEW
18.0 2.0 3.0 52.4 MB

Use OpenAI, Redis, and streamlit to recommend hotels using Large Language Models

Dockerfile 2.67% Python 97.33%
llm llm-chain rag redis retrieval-augmented-generation retrieval-augmented-qa vector vector-database

llm-recommender's Introduction

LLM Hotel Recommender

The LLM Hotel Recommender is a Streamlit app that uses Redis and the OpenAI API to generate hotel recommendations based on a user's preferences. Because Redis can perform semantic search in addition to other operations like tag and text search users are able to search for hotels in the US based on a variety of criteria, including:

  • State
  • City
  • Positive Qualities
  • Negative Qualities

The application will cite it's sources (reviews) for each recommendation and provide all the reviews that were returned.

Screen Shot 2023-08-15 at 5 55 25 PM

Design

The recommender uses the Hypothetical Document Embeddings (HyDE) approach which uses an LLM (OpenAI in this case) to generate a fake review based on user input. The system then uses Redis vector search to semantically search for hotels with reviews that are similar to the fake review. The returned reviews are then passed to another LLM to generate a recommendation for the user.

Design Design

Run the Application

Docker Compose

  1. Create your env file:

    $ cp .env.template .env

    fill out values, most importantly, your OPENAI_API_KEY

  2. Run with docker compose:

    $ docker compose up
     *add `-d` option to daemonize the processes to the background if you wish.*
    

    Issues with dependencies? Try force-building with no-cache:

    $ docker compose build --no-cache
    
  3. Navigate to:

    http://localhost:8501/
    

Local

  1. Create your env file:

    $ cp .env.template .env

    fill out values, most importantly, your OPENAI_API_KEY

  2. Clone the repo:

    $ git clone https://github.com/RedisVentures/llm-recommender.git
    
  3. Install dependencies:

    $ pip install -r requirements.txt
  4. Run the app:

    $ streamlit run run.py

Known Bugs

  1. Hotels by the same name in different cities are not handled well

Future Work

  1. Add more search criteria (GeoFilter, Price, etc.)
  2. Dataset is relatively sparse
  3. Use OpenAI Functions or parsing to extract Hotel name from recommendation instead of LLM

llm-recommender's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

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