Spaces:
Sleeping
Sleeping
File size: 554 Bytes
a20be5b |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
import os
import weaviate
class WeaviateExplorer:
def __init__(self):
self.client = weaviate.Client(
url = os.getenv("WEAVIATE_CLUSTER_URL"),
auth_client_secret=weaviate.auth.AuthApiKey(api_key=os.getenv("WEAVIATE_API_KEY"))
)
def explore(self, query):
response = (
self.client.query
.get("Short", ["title", "link"])
.with_near_text({"concepts": [query]})
.with_limit(5)
.do()
)
return response['data']['Get']['Short'] |