diff --git a/libs/community/langchain_community/vectorstores/milvus.py b/libs/community/langchain_community/vectorstores/milvus.py index a1095a2d519a7..fb7209307afc9 100644 --- a/libs/community/langchain_community/vectorstores/milvus.py +++ b/libs/community/langchain_community/vectorstores/milvus.py @@ -216,7 +216,13 @@ def _create_connection_alias(self, connection_args: dict) -> str: if host is not None and port is not None: given_address = str(host) + ":" + str(port) elif uri is not None: - given_address = uri.split("https://")[1] + if uri.startswith("https://"): + given_address = uri.split("https://")[1] + elif uri.startswith("http://"): + given_address = uri.split("http://")[1] + else: + logger.error("Invalid Milvus URI: %s", uri) + raise ValueError("Invalid Milvus URI: %s", uri) elif address is not None: given_address = address else: