weaviate.connect

Module communication to a Weaviate instance. Used to connect to Weaviate and run REST requests.

class weaviate.connect.Connection(url: str, auth_client_secret: AuthBearerToken | AuthClientPassword | AuthClientCredentials | AuthApiKey | None, timeout_config: Tuple[int | float, int | float], proxies: dict | str | None, trust_env: bool, additional_headers: Dict[str, Any] | None, startup_period: int | None, connection_config: ConnectionConfig, embedded_db: EmbeddedDB | None = None, grcp_port: int | None = None)

Bases: BaseConnection

Initialize a Connection class instance.

Parameters:
  • url (str) – URL to a running weaviate instance.

  • auth_client_secret (weaviate.auth.AuthCredentials, optional) – Credentials to authenticate with a weaviate instance. The credentials are not saved within the client and authentication is done via authentication tokens.

  • timeout_config (tuple(float, float) or float, optional) – Set the timeout configuration for all requests to the Weaviate server. It can be a float or, a tuple of two floats: (connect timeout, read timeout). If only one float is passed then both connect and read timeout will be set to that value.

  • proxies (dict, str or None, optional) – Proxies to be used for requests. Are used by both ‘requests’ and ‘aiohttp’. Can be passed as a dict (‘requests’ format: https://docs.python-requests.org/en/stable/user/advanced/#proxies), str (HTTP/HTTPS protocols are going to use this proxy) or None.

  • trust_env (bool, optional) – Whether to read proxies from the ENV variables: (HTTP_PROXY or http_proxy, HTTPS_PROXY or https_proxy). NOTE: ‘proxies’ has priority over ‘trust_env’, i.e. if ‘proxies’ is NOT None, ‘trust_env’ is ignored.

  • additional_headers (Dict[str, Any] or None) – Additional headers to include in the requests, used to set OpenAI key. OpenAI key looks like this: {‘X-OpenAI-Api-Key’: ‘KEY’}.

  • startup_period (int or None) – How long the client will wait for weaviate to start before raising a RequestsConnectionError. If None the client will not wait at all.

Raises:

ValueError – If no authentication credentials provided but the Weaviate server has an OpenID configured.

get_meta() Dict[str, str]

Returns the meta endpoint.

property grpc_stub: WeaviateStub | None
property server_version: str

Version of the weaviate instance.