Session Disconnecting when using Chromadb and similarity_search_with_relevance_scores

Hello, and I am currently developing a streamlit application. I am currently using Chromadb to perform a similarity_search_with_relevance_scores with user input from chatbot to search pdf files. Whenever I run my script outside of streamlit, it works. However, when I run my code within a streamlit environment the session disconnects immediately. Any help would be much appreciated!

embedding_function = embeddings
db = Chroma(persist_directory=CHROMA_PATH, embedding_function=embedding_function)
results = db.similarity_search_with_relevance_scores(query_text, k=4)

Steps To Reproduce

When a user enters in a message through a Chatbot.

Expected Behavior

The RAG tool should answer and return a message that contains content from the pdfs.

Current Behavior

There is no error message presented, the session just ends by disconnecting.

Is this a regression?

  • Yes, this used to work in a previous version.

Debug info

  • Streamlit version: 1.37.0
  • Python version: 3.11.9
  • Operating System: Windows 11
  • Browser: Edge

I got same error today, after some debugging found that when there are many data in chromadb, streamlit will exit without any error.

Then I run the chromadb in separate server process, and connect with http protocol, it is OK.

  1. First run chromadb in server mode:

chroma run --host localhost --port 8000 --path ./CHROMA_PATH

  1. Connect with http

chroma_client = chromadb.HttpClient(host=“localhost”, port=8000)

1 Like