Skip to content

RAG AI Overview

This document provides an overview of how to use the RAG AI in the Constellation project.

Information

The RAG AI (Retrieval-Augmented Generation AI) is designed to enhance the capabilities of the Constellation project by integrating AI-driven retrieval and generation features. It enables the user to ask questions and receive answers based on the data stored in the Constellation database, leveraging both retrieval and generation techniques.

How to use the RAG AI

  1. Start the RAG AI: The RAG AI is a separate service that needs to be started before you can use it. You can start the service by running the following command:

    docker compose up --build
    
  2. Build the index: The RAG AI requires an index to be built from the data stored in the Constellation database. You can build the index by sending a POST request to the /build-index/{{constellation_uuid}} endpoint with the user token (used to fetch data) in the headers and the constellation UUID in the URL.

    Example request:

    curl -X POST http://localhost:8004/build-index/1234 \
    -H "Authorization: Bearer your_user_token"
    
  3. Ask a question: Once the index is built, you can ask questions by sending a POST request to the /query endpoint with the user token in the headers and the question, the top_k (number of chunks to use to generate the result to return, default to 5), and the threshold (minimum score for results, if no chunks meet the threshold, the result will be an excuse saying no information was found, default to 0.15) in the query parameters.

    Example request:

    curl -X POST http://localhost:8004/query?q=your_question&top_k=5&threshold=0.15 \
    -H "Authorization: Bearer your_user_token"