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
}
)
Weaviate Cloud 连接与 Cohere 请求头配置
更新于
公开 · 所有人可见