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: Optional[Union[AuthBearerToken, AuthClientPassword, AuthClientCredentials]], timeout_config: Union[Tuple[Real, Real], Real], proxies: Optional[Union[dict, str]], trust_env: bool, additional_headers: Optional[Dict[str, Any]])¶
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(Real, Real) or Real, optional) – Set the timeout configuration for all requests to the Weaviate server. It can be a real number or, a tuple of two real numbers: (connect timeout, read timeout). If only one real number 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’}.
- 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 server_version: str¶
Version of the weaviate instance.