Skip to content

Make VectorStore extend from DocumentRetriever #1430

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import java.util.Optional;

import org.springframework.ai.document.Document;
import org.springframework.ai.document.DocumentRetriever;
import org.springframework.ai.document.DocumentWriter;

/**
Expand All @@ -29,7 +30,7 @@
* This interface allows for adding, deleting, and searching documents based on their
* similarity to a given query.
*/
public interface VectorStore extends DocumentWriter {
public interface VectorStore extends DocumentWriter, DocumentRetriever {

default String getName() {
return this.getClass().getSimpleName();
Expand Down Expand Up @@ -74,4 +75,14 @@ default List<Document> similaritySearch(String query) {
return this.similaritySearch(SearchRequest.query(query));
}

/**
* Retrieves relevant documents
* @param query query string
* @return relevant documents
*/
@Override
default List<Document> retrieve(String query) {
return similaritySearch(query);
}

}