Skip to content

typesense/showcase-natural-language-search-cars-genkit

Repository files navigation

🔥 Natural Language Search powered by Genkit and Typesense

Search for the perfect car by describing it in natural language. We use a technique called "Generation Augmented Retrieval" to convert the natural language query into a Typesense query.

Tech Stack

The dataset contains 6500 cars and is available on Kaggle.

Project Structure

├── scripts/
│   ├── data/
│   │   └── cars.json
│   └── indexTypesense.ts # script that index data from cars.json into typesense server
└── src/
    ├── app/
    │   ├── genkit.ts # AI prompt and flows
    │   └── page.tsx
    ├── components/
    │   └── UI components...
    ├── schemas/
    │   └── typesense.ts # define the response schema for genkit.ts
    └── lib/
        └── typesense.ts # typesense client config

Development

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 up

Index data into typesense

npm run index:typesense

Update collection metadata, this will be used to provide additional information about each collection property for the LLM.

npm run updateMetadata:typesense

Start the dev server

npm run dev

Open http://localhost:3000 to see the app ✌️

Deployment

See .env.example for environment variables.