-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcheck.py
More file actions
43 lines (36 loc) · 1.63 KB
/
Copy pathcheck.py
File metadata and controls
43 lines (36 loc) · 1.63 KB
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
# Load ChromaDB Client
from chromadb.config import Settings
from chromadb import Client
from vector_11 import collection
client = Client(Settings())
def list_all_collections():
"""List all collections in ChromaDB."""
collections = client.list_collections()
if not collections:
print("No collections found in ChromaDB.")
else:
print("Available collections:")
for coll in collections:
print(f"- {coll.name}")
def verify_saved_embeddings(collection_name):
"""Retrieve and print the contents of a ChromaDB collection."""
try:
collection = client.get_collection(name=collection_name)
documents = collection.get(include=['documents', 'metadatas', 'embeddings'])
if not documents['documents']:
print(f"No embeddings found in the collection '{collection_name}'.")
else:
print(f"Collection '{collection_name}' contains the following data:")
for doc, meta in zip(documents['documents'], documents['metadatas']):
print(f"Document: {doc}")
print(f"Metadata: {meta}")
print("\n")
print(f"Total embeddings: {len(documents['documents'])}")
except Exception as e:
print(f"Error accessing collection '{collection_name}': {e}")
# List all available collections to verify the correct collection name
list_all_collections()
# Update this with the collection name used for your file
collection_name = "test2_collection" # Replace with the actual collection name for the different file
# Verify embeddings for the specified collection
verify_saved_embeddings(collection_name)