The chatbot depends upon a RAG system with Chromadb. It works fine for 5-10 minutes.
But later it generates error message stating collection does not exit.
However as seen in the image, there is the collection and chat bot used it for answering question.
Suddenly, collection is deleted from the cloud.
When I reboot the app, it works again but then in 5 minutes, the same error happens.
Error log is below.
Thank you.
KMK
ERROR LOG:
/mount/src/kmk-document-qa/run_interface.py:55 in <module>
52
53
54 if __name__ == "__main__":
❱ 55 │ main_interface()
56
/mount/src/kmk-document-qa/run_interface.py:45 in main_interface
42 │ │ # Add user message to chat history
43 │ │ st.session_state.messages.append({"role": "user", "content": pr
44 │ │
❱ 45 │ │ response = generateAnswer(RAG_LLM, st.session_state.knowledge_b
46 │ │
47 │ │ # Display assistant response in chat message container
48 │ │ with st.chat_message("assistant"):
/home/adminuser/venv/lib/python3.12/site-packages/rag_kmk/chat_flow/llm_inte
rface.py:143 in generateAnswer
140 return response.text
141
142 def generateAnswer(RAG_LLM, chroma_collection,query,n_results=10, only
❱ 143 │ retrieved_documents= retrieve_chunks(chroma_collection, query, n_r
144 │ prompt = "QUESTION: "+ query
145 │ context = "\n EXCERPTS: "+ "\n".join(retrieved_documents)
146 │ if not only_response:
/home/adminuser/venv/lib/python3.12/site-packages/rag_kmk/vector_db/query.py
:14 in retrieve_chunks
11 │ │ │ n_results=n_results)
12 │
13 │ else:
❱ 14 │ │ results = chroma_collection.query(
15 │ │ │ query_texts=[query],
16 │ │ │ include= [ "documents","metadatas",'distances' ],
17 │ │ │ n_results=n_results)
/home/adminuser/venv/lib/python3.12/site-packages/chromadb/api/models/Collec
tion.py:195 in query
192 │ │ │ include,
193 │ │ )
194 │ │
❱ 195 │ │ query_results = self._client._query(
196 │ │ │ collection_id=self.id,
197 │ │ │ query_embeddings=valid_query_embeddings,
198 │ │ │ n_results=valid_n_results,
/home/adminuser/venv/lib/python3.12/site-packages/chromadb/telemetry/opentel
emetry/__init__.py:146 in wrapper
143 │ │ │ def wrapper(*args, **kwargs):
144 │ │ │ │ global tracer, granularity
145 │ │ │ │ if trace_granularity < granularity:
❱ 146 │ │ │ │ │ return f(*args, **kwargs)
147 │ │ │ │ if not tracer:
148 │ │ │ │ │ return f(*args, **kwargs)
149 │ │ │ │ with tracer.start_as_current_span(trace_name, attribut
/home/adminuser/venv/lib/python3.12/site-packages/chromadb/rate_limiting/__i
nit__.py:47 in wrapper
44 │ │ │ # If not rate limiting provider is present, just run and re
45 │ │ │
46 │ │ │ if self._system.settings.chroma_rate_limiting_provider_impl
❱ 47 │ │ │ │ return f(self, *args, **kwargs)
48 │ │ │
49 │ │ │ if subject in kwargs:
50 │ │ │ │ subject_value = kwargs[subject]
/home/adminuser/venv/lib/python3.12/site-packages/chromadb/api/segment.py:69
5 in _query
692 │ │
693 │ │ allowed_ids = None
694 │ │
❱ 695 │ │ coll = self._get_collection(collection_id)
696 │ │ for embedding in query_embeddings:
697 │ │ │ self._validate_dimension(coll, len(embedding), update=Fals
698
/home/adminuser/venv/lib/python3.12/site-packages/chromadb/telemetry/opentel
emetry/__init__.py:146 in wrapper
143 │ │ │ def wrapper(*args, **kwargs):
144 │ │ │ │ global tracer, granularity
145 │ │ │ │ if trace_granularity < granularity:
❱ 146 │ │ │ │ │ return f(*args, **kwargs)
147 │ │ │ │ if not tracer:
148 │ │ │ │ │ return f(*args, **kwargs)
149 │ │ │ │ with tracer.start_as_current_span(trace_name, attribut
/home/adminuser/venv/lib/python3.12/site-packages/chromadb/api/segment.py:85
2 in _get_collection
849 │ │ if collection_id not in self._collection_cache:
850 │ │ │ collections = self._sysdb.get_collections(id=collection_id
851 │ │ │ if not collections:
❱ 852 │ │ │ │ raise InvalidCollectionException(
853 │ │ │ │ │ f"Collection {collection_id} does not exist."
854 │ │ │ │ )
855 │ │ │ self._collection_cache[collection_id] = collections[0]
────────────────────────────────────────────────────────────────────────────────
InvalidCollectionException: Collection 6548feb9-2804-492c-8b72-117bb10e6b2e does
not exist.
2025-01-09 15:38:39.777 Uncaught app execution
Traceback (most recent call last):
File "/home/adminuser/venv/lib/python3.12/site-packages/streamlit/runtime/scriptrunner/exec_code.py", line 88, in exec_func_with_error_handling
result = func()
^^^^^^
File "/home/adminuser/venv/lib/python3.12/site-packages/streamlit/runtime/scriptrunner/script_runner.py", line 579, in code_to_exec
exec(code, module.__dict__)
File "/mount/src/kmk-document-qa/run_interface.py", line 55, in <module>
main_interface()
File "/mount/src/kmk-document-qa/run_interface.py", line 45, in main_interface
response = generateAnswer(RAG_LLM, st.session_state.knowledge_base, prompt)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/adminuser/venv/lib/python3.12/site-packages/rag_kmk/chat_flow/llm_interface.py", line 143, in generateAnswer
retrieved_documents= retrieve_chunks(chroma_collection, query, n_results, return_only_docs=True)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/adminuser/venv/lib/python3.12/site-packages/rag_kmk/vector_db/query.py", line 14, in retrieve_chunks
results = chroma_collection.query(
^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/adminuser/venv/lib/python3.12/site-packages/chromadb/api/models/Collection.py", line 195, in query
query_results = self._client._query(
^^^^^^^^^^^^^^^^^^^^
File "/home/adminuser/venv/lib/python3.12/site-packages/chromadb/telemetry/opentelemetry/__init__.py", line 146, in wrapper
return f(*args, **kwargs)
^^^^^^^^^^^^^^^^^^
File "/home/adminuser/venv/lib/python3.12/site-packages/chromadb/rate_limiting/__init__.py", line 47, in wrapper
return f(self, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/adminuser/venv/lib/python3.12/site-packages/chromadb/api/segment.py", line 695, in _query
coll = self._get_collection(collection_id)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/adminuser/venv/lib/python3.12/site-packages/chromadb/telemetry/opentelemetry/__init__.py", line 146, in wrapper
return f(*args, **kwargs)
^^^^^^^^^^^^^^^^^^
File "/home/adminuser/venv/lib/python3.12/site-packages/chromadb/api/segment.py", line 852, in _get_collection
raise InvalidCollectionException(
chromadb.errors.InvalidCollectionException: Collection 6548feb9-2804-492c-8b72-117bb10e6b2e does not exist.
2025-01-09 15:42:41.826 Examining the path of torch.classes raised: Tried to instantiate class '__path__._path', but it does not exist!