Interface ChatAssistant


public interface ChatAssistant
Interface for chat assistant functionality in the Coherence RAG framework.

This interface defines the contract for creating AI-powered chat assistants that can answer questions using retrieved augmented generation (RAG) techniques. The assistant integrates with language models to provide intelligent responses based on indexed document content.

Implementations of this interface should handle question processing, context retrieval, and response generation using appropriate AI models.

Since:
25.09
Author:
Aleks Seovic 2025.07.04
  • Method Summary

    Modifier and Type
    Method
    Description
    dev.langchain4j.service.TokenStream
    answer(String question)
    Asks the assistant a question and returns a streaming response.
  • Method Details

    • answer

      dev.langchain4j.service.TokenStream answer(String question)
      Asks the assistant a question and returns a streaming response.

      This method processes the provided question, retrieves relevant context from indexed documents, and generates a streaming response using an AI language model. The response is returned as a TokenStream for real-time processing and display.

      Parameters:
      question - the question text to be answered by the assistant
      Returns:
      a TokenStream containing the assistant's response tokens
      Throws:
      IllegalArgumentException - if the question is null or empty
      RuntimeException - if the AI model is unavailable or processing fails