纯文本
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
if self.api_key:
auth_config = weaviate.AuthApiKey(api_key=self.api_key)
client = weaviate.WeaviateClient(url=self.url, auth_client_secret=auth_config)
# Connect to Weaviate Cloud
auth_config = Auth.api_key(weaviate_api_key)
client = weaviate.connect_to_weaviate_cloud(
cluster_url=self.url,
auth_credentials=Auth.api_key(weaviate_api_key),
headers={
"X-Cohere-Api-Key": cohere_api_key
}
)
else:
client = weaviate.WeaviateClient(url=self.url)
client = weaviate.connect_to_weaviate_cloud(
cluster_url=self.url,
auth_credentials=Auth.api_key(weaviate_api_key),
headers={
"X-Cohere-Api-Key": cohere_api_key
}
)