forked from JLucasFFerraz/DBpedia_doc_onto_extraction
-
Notifications
You must be signed in to change notification settings - Fork 0
/
look_at_created_collections.py
44 lines (37 loc) · 1.39 KB
/
look_at_created_collections.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
import weaviate
import weaviate.classes as wvc
from weaviate.classes.query import Filter
from weaviate.util import generate_uuid5
from langchain_community.embeddings import SentenceTransformerEmbeddings
from VectorDB_creation_aux import *
from dotenv import load_dotenv
import os
import traceback
from dataclasses import dataclass, field
from typing import List
from weaviate_client import get_weaviate_client
from VectorDB_creation import get_properties_from_collection
load_dotenv()
# Global variables
wcd_url = os.getenv("WCD_URL")
wcd_api_key = os.getenv("WCD_API_KEY")
openai_api_key = os.getenv("OPENAI_API_KEY")
hf_key = os.getenv("HF_KEY")
url_endpoint = os.getenv("SPARQL_ENDPOINT")
weaviate_port = int(os.getenv("WEAVIATE_PORT"))
weaviate_port_grpc = int(os.getenv("WEAVIATE_PORT_GRPC"))
weaviate_address = os.getenv("WEAVIATE_ADDRESS")
create_new = os.getenv("DELETE_OLD_INDEX")
# Available models
# Create a client instance
headers = {
"X-HuggingFace-Api-Key": hf_key,
}
with get_weaviate_client() as client:
print(get_properties_from_collection(client, "Classes"))
# for collection_name in client.collections.list_all(simple=True):
# collection = client.collections.get(name=collection_name)
# print(f"Objects in collection '{collection.name}':")
# for obj in collection.iterator(include_vector=True):
# print(obj.properties)
# print("---")