🔌Connection Configuration

The first step to communicating with the enVector service is to establish a connection. This configuration tells the SDK the network location of the running service and provides any necessary authentication credentials.

Key Parameters

  • host (str): Specifies the hostname (e.g., api.my-company.com) or IP address (e.g., 192.168.1.10) of the server.

  • port (int): The network port number on which the server is listening for connections (e.g., 50050).

  • address (str): A convenience parameter to specify both the host and port in a single "host:port" formatted string (e.g., "localhost:50050").

    Note: If the address parameter is used, you do not need to provide host and port separately. Using address is generally simpler and recommended.

  • access_token (str, Optional): The access token used for authentication if the server requires it for security. When provided, the SDK will include this token in all requests to authenticate itself.

Usage Example

import pyenvector as ev

# Method 1: Connecting with the address parameter (Recommended)
# This is the most concise and common method.
ev.init_connect(
    address="localhost:50050",
    access_token="your-secret-token-if-needed"
)

# Method 2: Connecting by specifying host and port separately
ev.init_connect(
    host="localhost",
    port=50050,
    access_token="your-secret-token-if-needed"
)

Last updated