KalooAI commited on
Commit
547aa0d
·
verified ·
1 Parent(s): c862bc5

Update app.py

Browse files

Added
# 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}"
)

Files changed (1) hide show
  1. app.py +7 -1
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
- vectordb = Chroma.from_documents(chunks, embedding_model)
 
 
 
 
 
 
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