-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.py
More file actions
35 lines (24 loc) · 819 Bytes
/
test.py
File metadata and controls
35 lines (24 loc) · 819 Bytes
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
# Test Code #
# Import Packages
from generate import generate_embedding
from mongo import collection
from pprint import pprint
## Test Mongo Connection
# Check Cursor Object
items = collection.find().limit(5)
print("Cursor Object: ", items)
# Print Collection Data
for index, item in enumerate(items):
print(f"\nObject-{index}:") # Object Index
pprint(item) # Object
## Test Embedding Generation
# Generate Embedding
embeddings = generate_embedding("Suraj is coder!") # Generate
pprint(embeddings) # Print
## Test Data Query
# Print first 50 documents with plot from collection
documents = collection.find({"plot": {"$exists": True}}).limit(50)
print("Cursor Object: ", documents)
documents_list = list(documents)
documents_count = len(documents_list)
print("Documents Count: ", documents_count)