from pymilvus import connections from pymilvus.exceptions import ConnectionConfigException class MilvusClientSingleton: # ... (rest of the class code) def __init__(self, uri): if MilvusClientSingleton._instance is not None: raise Exception("This class is a singleton!") try: # Use connections.connect() connections.connect(uri=uri) self._instance = connections # Store the connections object print(f"Successfully connected to Milvus at {uri}") except ConnectionConfigException as e: print(f"Error connecting to Milvus: {e}") raise def __getattr__(self, name): # Delegate attribute access to the default connection return getattr(connections, name)