Instead of needing to use specific keywords or precise filters, you can simply type a free-form sentence into the search bar. Typesense then uses Large Language Models (LLMs) to understand your intent, automatically translating your natural language query into structured search parameters like filters, sort orders, and relevant keywords.
This means you can find exactly what you're looking for with ease and flexibility, even if your exact keywords aren't in the restaurant's description. Experience a more intuitive and powerful way to discover your next dining destination!
This demo uses the dataset "TripAdvisor European restaurants" which is available on Kaggle.
- Typesense
- Google Gemini
- NextJS
- Typescript
- Tailwind
- React Query
βββ scripts/
β βββ data/
β β βββ restaurants.jsonl
β βββ indexTypesense.ts # script that create a collection and index data from restaurants.json into typesense server
β βββ upsertModel.ts # create a Typesense natural language search model, update system_prompt if model already exists
βββ src/
βββ app/
β βββ page.tsx # main application
βββ components/
β βββ UI components...
βββ hooks/
β βββ getUserLocation.ts # provide the user location for the LLM to perform geosearch
βββ lib/
βββ actions.ts # the search function used for pagination
βββ typesense.ts # typesense configYou can view the specific LLM instructions for this project in upsertModel.ts
To run this project locally, make sure you have docker and nodejs, clone this project, install dependencies and start the dev server:
Start typesense server
npm run start:typesense # or: docker compose upIndex data into typesense
npm run index:typesenseCreate a natural language search model, this script is also used to update the model's system_prompt.
npm run createModel:typesenseStart the dev server
npm run devOpen http://localhost:3000 to see the app βοΈ
See .env.example for environment variables.