Class WeaviateVectorStore
java.lang.Object
com.google.genkit.plugins.weaviate.WeaviateVectorStore
Weaviate vector store implementation for RAG workflows.
Provides vector similarity search using Weaviate's native vector search capabilities. Supports COSINE, L2_SQUARED, and DOT distance measures.
Example usage:
// Retrieve documents
RetrieverResponse response = genkit.retrieve("weaviate/my-collection", Document.fromText("What is AI?"),
Map.of("limit", 5));
// Index documents
genkit.index("weaviate/my-collection", List.of(Document.fromText("AI is artificial intelligence")));
-
Constructor Summary
ConstructorsConstructorDescriptionWeaviateVectorStore(io.weaviate.client.WeaviateClient client, WeaviateCollectionConfig config, Embedder embedder) Creates a new WeaviateVectorStore. -
Method Summary
Modifier and TypeMethodDescriptionCreates an Indexer action for this vector store.Creates a Retriever action for this vector store.voidEnsures the Weaviate collection (class) exists, creating it if configured to do so.index(ActionContext ctx, IndexerRequest request) Indexes documents into Weaviate with their embeddings.retrieve(ActionContext ctx, RetrieverRequest request) Retrieves documents from Weaviate using vector similarity search.
-
Constructor Details
-
WeaviateVectorStore
public WeaviateVectorStore(io.weaviate.client.WeaviateClient client, WeaviateCollectionConfig config, Embedder embedder) Creates a new WeaviateVectorStore.- Parameters:
client- the Weaviate clientconfig- the collection configurationembedder- the embedder to use
-
-
Method Details
-
ensureCollectionExists
Ensures the Weaviate collection (class) exists, creating it if configured to do so.- Throws:
GenkitException- if collection creation fails
-
createRetriever
Creates a Retriever action for this vector store.- Returns:
- the Retriever action
-
createIndexer
Creates an Indexer action for this vector store.- Returns:
- the Indexer action
-
retrieve
public RetrieverResponse retrieve(ActionContext ctx, RetrieverRequest request) throws GenkitException Retrieves documents from Weaviate using vector similarity search.- Parameters:
ctx- the action contextrequest- the retriever request- Returns:
- the retriever response with matched documents
- Throws:
GenkitException- if retrieval fails
-
index
Indexes documents into Weaviate with their embeddings.- Parameters:
ctx- the action contextrequest- the indexer request- Returns:
- the indexer response
- Throws:
GenkitException- if indexing fails
-