Class MilvusVectorStore
java.lang.Object
org.springframework.ai.vectorstore.MilvusVectorStore
- All Implemented Interfaces:
VectorStore
,org.springframework.context.Lifecycle
,org.springframework.context.Phased
,org.springframework.context.SmartLifecycle
public class MilvusVectorStore
extends Object
implements VectorStore, org.springframework.context.SmartLifecycle
- Author:
- Christian Tzolov
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
Configuration for the Milvus vector store. -
Field Summary
Modifier and TypeFieldDescriptionstatic final String
static final String
static final String
static final String
static final String
static final String
static final int
static final String
static final int
Fields inherited from interface org.springframework.context.SmartLifecycle
DEFAULT_PHASE
-
Constructor Summary
ConstructorDescriptionMilvusVectorStore
(io.milvus.client.MilvusServiceClient milvusClient, EmbeddingClient embeddingClient) MilvusVectorStore
(io.milvus.client.MilvusServiceClient milvusClient, EmbeddingClient embeddingClient, MilvusVectorStore.MilvusVectorStoreConfig config) -
Method Summary
Modifier and TypeMethodDescriptionvoid
Adds Documents to the vector store.boolean
boolean
similaritySearch
(String query) similaritySearch
(String query, int topK) similaritySearch
(String query, int topK, double similarityThreshold) void
start()
void
stop()
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.springframework.context.SmartLifecycle
getPhase, stop
-
Field Details
-
OPENAI_EMBEDDING_DIMENSION_SIZE
public static final int OPENAI_EMBEDDING_DIMENSION_SIZE- See Also:
-
INVALID_EMBEDDING_DIMENSION
public static final int INVALID_EMBEDDING_DIMENSION- See Also:
-
DEFAULT_DATABASE_NAME
- See Also:
-
DEFAULT_COLLECTION_NAME
- See Also:
-
DOC_ID_FIELD_NAME
- See Also:
-
CONTENT_FIELD_NAME
- See Also:
-
METADATA_FIELD_NAME
- See Also:
-
EMBEDDING_FIELD_NAME
- See Also:
-
DISTANCE_FIELD_NAME
- See Also:
-
SEARCH_OUTPUT_FIELDS
-
-
Constructor Details
-
MilvusVectorStore
public MilvusVectorStore(io.milvus.client.MilvusServiceClient milvusClient, EmbeddingClient embeddingClient) -
MilvusVectorStore
public MilvusVectorStore(io.milvus.client.MilvusServiceClient milvusClient, EmbeddingClient embeddingClient, MilvusVectorStore.MilvusVectorStoreConfig config)
-
-
Method Details
-
add
Description copied from interface:VectorStore
Adds Documents to the vector store.- Specified by:
add
in interfaceVectorStore
- Parameters:
documents
- the list of documents to store Will throw an exception if the underlying provider checks for duplicate IDs on add
-
delete
- Specified by:
delete
in interfaceVectorStore
-
similaritySearch
- Specified by:
similaritySearch
in interfaceVectorStore
-
similaritySearch
- Specified by:
similaritySearch
in interfaceVectorStore
-
similaritySearch
- Specified by:
similaritySearch
in interfaceVectorStore
- Parameters:
query
- The query to send, it will be converted to an embedding based on the configuration of the vector store.topK
- the top 'k' similar resultssimilarityThreshold
- the lower bound of the similarity score- Returns:
- similar documents
-
start
public void start()- Specified by:
start
in interfaceorg.springframework.context.Lifecycle
-
stop
public void stop()- Specified by:
stop
in interfaceorg.springframework.context.Lifecycle
-
isRunning
public boolean isRunning()- Specified by:
isRunning
in interfaceorg.springframework.context.Lifecycle
-
isAutoStartup
public boolean isAutoStartup()- Specified by:
isAutoStartup
in interfaceorg.springframework.context.SmartLifecycle
-