Update app.py
Browse filesAdded
# We add 'collection_name' with a random ID (uuid)
# This forces Chroma to create a brand new, empty bucket for every PDF
vectordb = Chroma.from_documents(
documents=chunks,
embedding=embedding_model,
collection_name=f"pdf_chat_{uuid.uuid4().hex}"
)
app.py
CHANGED
|
@@ -118,7 +118,13 @@ def vector_database(chunks):
|
|
| 118 |
if c.page_content and c.page_content.strip() and len(c.page_content.strip()) > 10
|
| 119 |
]
|
| 120 |
embedding_model = watsonx_embedding()
|
| 121 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 122 |
return vectordb
|
| 123 |
|
| 124 |
## Retriever
|
|
|
|
| 118 |
if c.page_content and c.page_content.strip() and len(c.page_content.strip()) > 10
|
| 119 |
]
|
| 120 |
embedding_model = watsonx_embedding()
|
| 121 |
+
# We add 'collection_name' with a random ID (uuid)
|
| 122 |
+
# This forces Chroma to create a brand new, empty bucket for every PDF
|
| 123 |
+
vectordb = Chroma.from_documents(
|
| 124 |
+
documents=chunks,
|
| 125 |
+
embedding=embedding_model,
|
| 126 |
+
collection_name=f"pdf_chat_{uuid.uuid4().hex}"
|
| 127 |
+
)
|
| 128 |
return vectordb
|
| 129 |
|
| 130 |
## Retriever
|