Spaces:
Running
Running
MVPilgrim
commited on
Commit
·
9f5bb83
1
Parent(s):
1945c30
debug
Browse files
app.py
CHANGED
@@ -160,7 +160,7 @@ try:
|
|
160 |
######################################################
|
161 |
# Create database webpage and chunks collections.
|
162 |
#wpCollection = createWebpageCollection()
|
163 |
-
#
|
164 |
if not client.collections.exists("Documents"):
|
165 |
logger.info("#### createWebpageCollection() entered.")
|
166 |
#client.collections.delete("Documents")
|
@@ -266,12 +266,12 @@ try:
|
|
266 |
}
|
267 |
]
|
268 |
}
|
269 |
-
|
270 |
-
st.session_state.
|
271 |
logger.info("#### createChunksCollection() exited.")
|
272 |
else:
|
273 |
wpChunksCollection = client.collections.get("Chunks")
|
274 |
-
st.session_state.
|
275 |
|
276 |
|
277 |
|
@@ -299,7 +299,7 @@ try:
|
|
299 |
logger.info("#### Create chunk db objects.")
|
300 |
# Insert the chunks for the document.
|
301 |
for i2, chunk in enumerate(webpageChunks[i]):
|
302 |
-
chunk_uuid =
|
303 |
{
|
304 |
"title": title,
|
305 |
"chunk": chunk,
|
@@ -380,8 +380,8 @@ try:
|
|
380 |
|
381 |
# Fetch chunks and print chunks.
|
382 |
logger.debug("#### Retrieve semchunks from db using vectors from prompt.")
|
383 |
-
|
384 |
-
semChunks =
|
385 |
near_vector=vectorList,
|
386 |
distance=0.7,
|
387 |
limit=3
|
|
|
160 |
######################################################
|
161 |
# Create database webpage and chunks collections.
|
162 |
#wpCollection = createWebpageCollection()
|
163 |
+
#wpChunksCollection = createChunksCollection()
|
164 |
if not client.collections.exists("Documents"):
|
165 |
logger.info("#### createWebpageCollection() entered.")
|
166 |
#client.collections.delete("Documents")
|
|
|
266 |
}
|
267 |
]
|
268 |
}
|
269 |
+
wpChunksCollection = client.collections.create_from_dict(class_obj)
|
270 |
+
st.session_state.wpChunksCollection = wpChunksCollection
|
271 |
logger.info("#### createChunksCollection() exited.")
|
272 |
else:
|
273 |
wpChunksCollection = client.collections.get("Chunks")
|
274 |
+
st.session_state.wpChunksCollection = wpChunksCollection
|
275 |
|
276 |
|
277 |
|
|
|
299 |
logger.info("#### Create chunk db objects.")
|
300 |
# Insert the chunks for the document.
|
301 |
for i2, chunk in enumerate(webpageChunks[i]):
|
302 |
+
chunk_uuid = wpChunksCollection.data.insert(
|
303 |
{
|
304 |
"title": title,
|
305 |
"chunk": chunk,
|
|
|
380 |
|
381 |
# Fetch chunks and print chunks.
|
382 |
logger.debug("#### Retrieve semchunks from db using vectors from prompt.")
|
383 |
+
wpChunksCollection = st.session_state.wpChunksCollection
|
384 |
+
semChunks = wpChunksCollection.query.near_vector(
|
385 |
near_vector=vectorList,
|
386 |
distance=0.7,
|
387 |
limit=3
|