Interface DocumentPostProcessor

All Superinterfaces:
BiFunction<Query,List<org.springframework.ai.document.Document>,List<org.springframework.ai.document.Document>>

public interface DocumentPostProcessor extends BiFunction<Query,List<org.springframework.ai.document.Document>,List<org.springframework.ai.document.Document>>
A component for post-processing retrieved documents based on a query, addressing challenges such as "lost-in-the-middle", context length restrictions from the model, and the need to reduce noise and redundancy in the retrieved information.

For example, it could rank documents based on their relevance to the query, remove irrelevant or redundant documents, or compress the content of each document to reduce noise and redundancy.

Since:
1.0.0
Author:
Thomas Vitale
  • Method Summary

    Modifier and Type
    Method
    Description
    default List<org.springframework.ai.document.Document>
    apply(Query query, List<org.springframework.ai.document.Document> documents)
     
    List<org.springframework.ai.document.Document>
    process(Query query, List<org.springframework.ai.document.Document> documents)
     

    Methods inherited from interface java.util.function.BiFunction

    andThen
  • Method Details

    • process

      List<org.springframework.ai.document.Document> process(Query query, List<org.springframework.ai.document.Document> documents)
    • apply

      default List<org.springframework.ai.document.Document> apply(Query query, List<org.springframework.ai.document.Document> documents)
      Specified by:
      apply in interface BiFunction<Query,List<org.springframework.ai.document.Document>,List<org.springframework.ai.document.Document>>