Interface ContentRetriever

  • All Implemented Interfaces:

    
    public interface ContentRetriever
    
                        

    Retrieves Contents from an underlying data source using a given Query. The goal is to retrieve only relevant Contents in relation to a given Query. The underlying data source can be virtually anything:

    - Embedding (vector) store (see EmbeddingStoreContentRetriever)
    - Full-text search engine (see 
    AzureAiSearchContentRetriever
    in
    langchain4j-azure-ai-search
    module) - Hybrid of vector and full-text search (see
    AzureAiSearchContentRetriever
    in
    langchain4j-azure-ai-search
    module) - Web Search Engine (see WebSearchContentRetriever) - Knowledge graph (see
    Neo4jContentRetriever
    in
    langchain4j-neo4j
    module) - SQL database (see
    SqlDatabaseContentRetriever
    in
    langchain4j-experimental-sql
    module) - etc.
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
    • Field Summary

      Fields 
      Modifier and Type Field Description
    • Constructor Summary

      Constructors 
      Constructor Description
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
    • Method Summary

      Modifier and Type Method Description
      abstract List<Content> retrieve(Query query) Retrieves relevant Contents using a given Query.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

    • Method Detail

      • retrieve

         abstract List<Content> retrieve(Query query)

        Retrieves relevant Contents using a given Query. The Contents are sorted by relevance, with the most relevant Contents appearing at the beginning of the returned List<Content>.

        Parameters:
        query - The Query to use for retrieval.
        Returns:

        A list of retrieved Contents.