Class RagService

java.lang.Object
sk.iway.iwcm.rag.search.RagService

@Service public class RagService extends Object
Generates answers from retrieved chunks using a domain's configured or default RAG assistant. Merges and limits context before supplying the question and source metadata to the AI service.
  • Constructor Details

  • Method Details

    • answerQuestion

      public String answerQuestion(String question, Integer domainId, List<VectorSearchResult> vectorChunkResults, jakarta.servlet.http.HttpServletRequest request)
      Generates an answer after merging and limiting authorized retrieval context. Uses the component's selected assistant when available, otherwise creates or reuses the domain's default. Callers are responsible for authorizing the supplied chunks and sanitizing the returned answer for display.
      Parameters:
      question - user question
      domainId - domain owning the selected or default answer assistant
      vectorChunkResults - authorized chunks with retrieval scores and optional ranking and citation metadata
      request - request supplying component settings and AI provider context
      Returns:
      trimmed assistant response, or null for missing input, unavailable context or assistant, an empty or cannot-answer response, or a failed provider call