Setting up MeiliSearch for LibreChat

MeiliSearch is a powerful, open-source search engine that enhances LibreChat’s functionality by enabling full-text search, typo tolerance, and instant search results for past conversations.

Follow these steps to set up MeiliSearch for LibreChat:

1. Download MeiliSearch

  • Go to the MeiliSearch GitHub releases page:
  • Download the latest version of MeiliSearch for your operating system (e.g., meilisearch-linux-amd64.tar.gz for Linux, meilisearch-macos-amd64 for macOS, or for Windows).

2. Extract/Install MeiliSearch

  • Linux/macOS: Extract the downloaded archive to a directory of your choice.
  • Windows: Extract the ZIP file to a directory of your choice.

3. Make the MeiliSearch Binary Executable (Linux/macOS)

  • Open a terminal and navigate to the directory where you extracted MeiliSearch.
  • Run the following command to make the binary executable:
    Make the MeiliSearch Binary Executable
    chmod +x meilisearch

4. Generate a Master Key

  • Open a terminal (or Command Prompt on Windows) and navigate to the MeiliSearch directory.
  • Run the following command to generate a Master Key:
    Generate a Master Key
    ./meilisearch --generate-master-key
  • Copy the generated Master Key as you’ll need it later.

5. Start MeiliSearch

  • In the same terminal, run the following command to start MeiliSearch, replacing <your_master_key> with the Master Key you generated in the previous step:
    Start MeiliSearch
    ./meilisearch --master-key=<your_master_key>
  • MeiliSearch will now start running on the default port (7700).

6. Update LibreChat’s Environment Variables

  • Open the .env file in the root directory of your LibreChat project.

  • Add or update the following lines with your MeiliSearch configuration:

  • Replace <your_master_key> with the Master Key you generated earlier.

7. Start/Restart LibreChat

  • Start or restart your LibreChat application.

That’s it! With MeiliSearch set up and configured, LibreChat should now have the Conversation search feature enabled, allowing users to perform full-text searches, benefit from typo tolerance, and experience instant search results for their past conversations.

Note: Make sure to keep the MeiliSearch process running in the background for the search functionality to work correctly. You may want to set up a script or service to keep MeiliSearch running persistently.