Milvus(
self,
embedding_function: Embeddings,
collection_name: str = 'LangChainCollection',
| Name | Type | Description |
|---|---|---|
embedding_function* | Embeddings | Function used to embed the text. |
collection_name | str | Default: 'LangChainCollection'Which Milvus collection to use. Defaults to "LangChainCollection". |
collection_description | str | Default: ''The description of the collection. Defaults to "". |
collection_properties | Optional[dict[str, any]] | Default: None |
connection_args | Optional[dict[str, any]] | Default: None |
consistency_level | str | Default: 'Session' |
index_params | Optional[dict] | Default: None |
search_params | Optional[dict] | Default: None |
drop_old | Optional[bool] | Default: False |
auto_id | bool | Default: False |
primary_field | str | Default: 'pk' |
text_field | str | Default: 'text' |
vector_field | str | Default: 'vector' |
metadata_field | str | Default: None |
| Name | Type |
|---|---|
| embedding_function | Embeddings |
| collection_name | str |
| collection_description | str |
| collection_properties | Optional[dict[str, Any]] |
| connection_args | Optional[dict[str, Any]] |
| consistency_level | str |
| index_params | Optional[dict] |
| search_params | Optional[dict] |
| drop_old | Optional[bool] |
| auto_id | bool |
| primary_field | str |
| text_field | str |
| vector_field | str |
| metadata_field | Optional[str] |
| partition_key_field | Optional[str] |
| partition_names | Optional[list] |
| replica_number | int |
| timeout | Optional[float] |
| num_shards | Optional[int] |
Perform a search on a query string and return results with score.
For more information about the search parameters, take a look at the pymilvus documentation found here: https://milvus.io/api-reference/pymilvus/v2.2.6/Collection/search().md
Perform a search on a query string and return results with score.
For more information about the search parameters, take a look at the pymilvus documentation found here: https://milvus.io/api-reference/pymilvus/v2.2.6/Collection/search().md
Delete by vector ID or boolean expression. Refer to Milvus documentation for notes and examples of expressions.
Milvus vector store. DO NOT USE. KEPT FOR BACKWARDS COMPATIBILITY.
You need to install pymilvus and run Milvus.
See the following documentation for how to run a Milvus instance: https://milvus.io/docs/install_standalone-docker.md
If looking for a hosted Milvus, take a look at this documentation: https://zilliz.com/cloud and make use of the Zilliz vectorstore found in this project.
IF USING L2/IP metric, IT IS HIGHLY SUGGESTED TO NORMALIZE YOUR DATA.
The connection args used for this class comes in the form of a dict, here are a few of the options: address (str): The actual address of Milvus instance. Example address: "localhost:19530" uri (str): The uri of Milvus instance. Example uri: "http://randomwebsite:19530", "tcp:foobarsite:19530", "https://ok.s3.south.com:19530". host (str): The host of Milvus instance. Default at "localhost", PyMilvus will fill in the default host if only port is provided. port (str/int): The port of Milvus instance. Default at 19530, PyMilvus will fill in the default port if only host is provided. user (str): Use which user to connect to Milvus instance. If user and password are provided, we will add related header in every RPC call. password (str): Required when user is provided. The password corresponding to the user. secure (bool): Default is false. If set to true, tls will be enabled. client_key_path (str): If use tls two-way authentication, need to write the client.key path. client_pem_path (str): If use tls two-way authentication, need to write the client.pem path. ca_pem_path (str): If use tls two-way authentication, need to write the ca.pem path. server_pem_path (str): If use tls one-way authentication, need to write the server.pem path. server_name (str): If use tls, need to write the common name.
Example:
.. code-block:: python
from langchain_community.vectorstores import Milvus from langchain_community.embeddings import OpenAIEmbeddings
embedding = OpenAIEmbeddings()
milvus_store = Milvus( embedding_function = Embeddings, collection_name = "LangChainCollection", drop_old = True, auto_id = True )
The collection properties. Defaults to None. If set, will override collection existing properties. For example: {"collection.ttl.seconds": 60}.
The connection args used for this class comes in the form of a dict.
The consistency level to use for a collection. Defaults to "Session".
Which index params to use. Defaults to HNSW/AUTOINDEX depending on service.
Which search params to use. Defaults to default of index.
Whether to drop the current collection. Defaults to False.
Whether to enable auto id for primary key. Defaults to False. If False, you needs to provide text ids (string less than 65535 bytes). If True, Milvus will generate unique integers as primary keys.
Name of the primary key field. Defaults to "pk".
Name of the text field. Defaults to "text".
Name of the vector field. Defaults to "vector".
Name of the metadata field. Defaults to None. When metadata_field is specified, the document's metadata will store as json.