Skip to content

typesense/showcase-conversational-search-pg-essays

Repository files navigation

Note

Work in progress 🚧

Conversational search with Typesense + Next.js App router

This demo showcases Typesense's conversational search features.

The dataset contains essays authored by Paul Graham, indexed in Typesense.

Questions are sent directly to Typesense, which has a built-in RAG pipeline to return a conversation response, using the indexed dataset as context.

Pre-requisites

  1. Node.js 20.x and npm
  2. Typesense server. Can be hosted locally using the docker-compose.yml file in the repository, instructions in Local Setup section.

Local Setup

  1. Clone the project.

  2. Install dependencies at the root of the project using npm.

    npm install
  3. (Optional) To run a local instance of Typesense server using the docker-compose.yml config in this repository, run the following command.

    docker compose up -d

    Note: This requires Docker to be installed on the system.

  4. Copy .env.example file and create a .env file at the root of the project.

  5. Set the values of required environment variables in the .env file that was created. (Skip the TYPESENSE_CONVERSATION_MODEL_ID env variable for now, we'll come back to it).

  6. Run the following command to create the dataset by fetching Paul Graham's essays:

    npm run fetchData
  7. Import the data into Typesense by running the following command.

    npm run indexInTypesense

    This command may take a while depending on the size of the data.

  8. The script will output a conversational model ID, which you want to set as the TYPESENSE_CONVERSATION_MODEL_ID in your .env file.

  9. Now start the Next.js application.

    • For production:
      npm run build
      npm start
    • For development:
      npm run dev
  10. Access the application at localhost:3000.

Learn More

License

This project is licensed under Apache License 2.0. The dataset used is Paul Graham's essays by Paul Graham.

About

WORK IN PROGRESS - An app that shows you how to build a conversation search experience, using Typesense's built-in RAG pipeline

Topics

Resources

License

Stars

Watchers

Forks

Sponsor this project

 

Languages