Skip to content

Commit

Permalink
Fix connection to Weaviate Cloud Service
Browse files Browse the repository at this point in the history
  • Loading branch information
silvanocerza committed Jun 24, 2024
1 parent 75bb792 commit ecd3b61
Showing 1 changed file with 26 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -172,22 +172,32 @@ def client(self):
if self._client:
return self._client

# proxies, timeout_config, trust_env are part of additional_config now
# startup_period has been removed
self._client = weaviate.WeaviateClient(
connection_params=(
weaviate.connect.base.ConnectionParams.from_url(
url=self._url, grpc_port=self._grpc_port, grpc_secure=self._grpc_secure
)
if self._url
else None
),
auth_client_secret=self._auth_client_secret.resolve_value() if self._auth_client_secret else None,
additional_config=self._additional_config,
additional_headers=self._additional_headers,
embedded_options=self._embedded_options,
skip_init_checks=False,
)
# This is a quick ugly fix to make sure that users can use the DocumentStore
# with Weaviate Cloud Services with no issues
if self._url and self._url.startswith("http") and self._url.endswith(".weaviate.network"):
self._client = weaviate.connect_to_wcs(
self._url,
auth_credentials=self._auth_client_secret.resolve_value(),
headers=self._additional_headers,
additional_config=self._additional_config,
)
else:
# proxies, timeout_config, trust_env are part of additional_config now
# startup_period has been removed
self._client = weaviate.WeaviateClient(
connection_params=(
weaviate.connect.base.ConnectionParams.from_url(
url=self._url, grpc_port=self._grpc_port, grpc_secure=self._grpc_secure
)
if self._url
else None
),
auth_client_secret=self._auth_client_secret.resolve_value() if self._auth_client_secret else None,
additional_config=self._additional_config,
additional_headers=self._additional_headers,
embedded_options=self._embedded_options,
skip_init_checks=False,
)

self._client.connect()

Expand Down

0 comments on commit ecd3b61

Please sign in to comment.