Interface VectorStoreRetriever

All Known Subinterfaces:
VectorStore
All Known Implementing Classes:
AbstractObservationVectorStore, AzureVectorStore, CassandraVectorStore, ChromaVectorStore, CoherenceVectorStore, CosmosDBVectorStore, CouchbaseSearchVectorStore, ElasticsearchVectorStore, GemFireVectorStore, HanaCloudVectorStore, MariaDBVectorStore, MilvusVectorStore, MongoDBAtlasVectorStore, Neo4jVectorStore, OpenSearchVectorStore, OracleVectorStore, PgVectorStore, PineconeVectorStore, QdrantVectorStore, RedisVectorStore, SimpleVectorStore, TypesenseVectorStore, WeaviateVectorStore
Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface public interface VectorStoreRetriever
A functional interface that provides read-only access to vector store retrieval operations. This interface extracts only the document retrieval functionality from VectorStore, ensuring that mutation operations (add, delete) are not exposed.

This is useful when you want to provide retrieval-only access to a vector store, following the principle of least privilege by not exposing write operations.

Since:
1.0.0
Author:
Mark Pollack
  • Method Summary

    Modifier and Type
    Method
    Description
    default List<Document>
    Retrieves documents by query embedding similarity using the default SearchRequest's search criteria.
    Retrieves documents by query embedding similarity and metadata filters to retrieve exactly the number of nearest-neighbor results that match the request criteria.
  • Method Details

    • similaritySearch

      List<Document> similaritySearch(SearchRequest request)
      Retrieves documents by query embedding similarity and metadata filters to retrieve exactly the number of nearest-neighbor results that match the request criteria.
      Parameters:
      request - Search request for set search parameters, such as the query text, topK, similarity threshold and metadata filter expressions.
      Returns:
      Returns documents that match the query request conditions.
    • similaritySearch

      default List<Document> similaritySearch(String query)
      Retrieves documents by query embedding similarity using the default SearchRequest's search criteria.
      Parameters:
      query - Text to use for embedding similarity comparison.
      Returns:
      Returns a list of documents that have embeddings similar to the query text embedding.