⏏️Disconnecting from the Service
You can explicitly terminate the connection to the enVector service using the ev.disconnect() function.
Calling this function will close the current session. After disconnecting, you must call ev.init_connect() again to establish a new connection before performing any other operations.
Example
This example shows the full cycle of connecting, checking the status, disconnecting, and then checking the status again.
import pyenvector as ev
# 1. Initialize the connection
ev.init_connect(address="localhost:50050", access_token=None)
# 2. Check that the connection is active
if ev.is_connected():
print(f"Connection active: {ev.is_connected()} ✅")
else:
print("Failed to connect.")
# 3. Disconnect from the service
print("Disconnecting from the service...")
ev.disconnect()
# 4. Check the connection status again
if not ev.is_connected():
print(f"Connection active: {ev.is_connected()} ❌")
else:
print("Still connected.")Last updated

