Class PostgresVectorStore
java.lang.Object
com.google.genkit.plugins.postgresql.PostgresVectorStore
PostgreSQL vector store implementation using pgvector extension.
This class provides indexing and retrieval of documents using PostgreSQL with the pgvector extension for vector similarity search.
-
Constructor Summary
ConstructorsConstructorDescriptionPostgresVectorStore(DataSource dataSource, PostgresTableConfig config, Embedder embedder) Creates a new PostgresVectorStore. -
Method Summary
Modifier and TypeMethodDescriptionintclearAll()Clears all documents from the table.intdeleteByIds(List<String> ids) Deletes documents by their IDs.Gets the table configuration.Gets the data source.index(ActionContext context, IndexerRequest request) Indexes documents into the vector store.voidInitializes the vector store by creating the table and index if needed.retrieve(ActionContext context, RetrieverRequest request) Retrieves documents similar to the query.
-
Constructor Details
-
PostgresVectorStore
Creates a new PostgresVectorStore.- Parameters:
dataSource- the PostgreSQL data sourceconfig- the table configurationembedder- the embedder for generating vectors
-
-
Method Details
-
initialize
Initializes the vector store by creating the table and index if needed.- Throws:
SQLException
-
retrieve
Retrieves documents similar to the query.- Parameters:
context- the action contextrequest- the retriever request- Returns:
- the retriever response with matching documents
-
index
Indexes documents into the vector store.- Parameters:
context- the action contextrequest- the indexer request- Returns:
- the indexer response
-
deleteByIds
Deletes documents by their IDs.- Parameters:
ids- the document IDs to delete- Returns:
- the number of documents deleted
- Throws:
SQLException
-
clearAll
Clears all documents from the table.- Returns:
- the number of documents deleted
- Throws:
SQLException
-
getConfig
Gets the table configuration. -
getDataSource
Gets the data source.
-