Semantic search with Voyage AI embeddings

    Introduction

    This guide will walk you through the process of setting up Meilisearch with Voyage AI embeddings to enable semantic search capabilities. By leveraging Meilisearch's AI features and Voyage AI's embedding API, you can enhance your search experience and retrieve more relevant results.

    Requirements

    To follow this guide, you'll need:

    Setting up Meilisearch

    To set up an embedder in Meilisearch, you need to configure it to your settings. You can refer to the Meilisearch documentation for more details on updating the embedder settings.

    Voyage AI offers the following embedding models:

    Here's an example of embedder settings for Voyage AI:

    {
      "voyage": {
        "source": "rest",
        "apiKey": "<Voyage AI API Key>",
        "dimensions": 1024,
        "documentTemplate": "<Custom template (Optional, but recommended)>",
        "url": "https://api.voyageai.com/v1/embeddings",
        "request": {
          "model": "voyage-2",
          "input": ["{{text}}", "{{..}}"]
        },
        "response": {
          "data": [
            {
              "embedding": "{{embedding}}"
            },
            "{{..}}"
          ]
        }
      }
    }
    

    In this configuration:

    Once you've configured the embedder settings, Meilisearch will automatically generate embeddings for your documents and store them in the vector store.

    Please note that most third-party tools have rate limiting, which is managed by Meilisearch. If you have a free account, the indexation process may take some time, but Meilisearch will handle it with a retry strategy.

    It's recommended to monitor the tasks queue to ensure everything is running smoothly. You can access the tasks queue using the Cloud UI or the Meilisearch API.

    With the embedder set up, you can now perform semantic searches using Meilisearch. When you send a search query, Meilisearch will generate an embedding for the query using the configured embedder and then use it to find the most semantically similar documents in the vector store. To perform a semantic search, you simply need to make a normal search request but include the hybrid parameter:

    {
      "q": "<Query made by the user>",
      "hybrid": {
        "semanticRatio": 1,
        "embedder": "voyage"
      }
    }
    

    In this request:

    You can use the Meilisearch API or client libraries to perform searches and retrieve the relevant documents based on semantic similarity.

    Conclusion

    By following this guide, you should now have Meilisearch set up with Voyage AI embedding, enabling you to leverage semantic search capabilities in your application. Meilisearch's auto-batching and efficient handling of embeddings make it a powerful choice for integrating semantic search into your project.

    To explore further configuration options for embedders, consult the detailed documentation about the embedder setting possibilities.