Chroma DB query returning different/irrelevant results on the Streamlit cloud compared to the local query

Hello,
I created a local Chromadb collection using “streamlit_chromadb_connection” (see code hereunder), it works fine on my local machine and retrieves appropriate chunks, however when querying this Chromadb in my streamlit app on the streamlit community cloud, the text chunks retrieved are not relevant at all to the query.
Why is the query of the same chroma DB collection on the streamlit cloud returning different results from the local querying on my laptop ?

The steps I used:

  1. I create the Chroma db locally (see code hereunder)
  2. I upload the Chroma db files (chroma.sqlite3, data_level0.bin, header.bin, index_metadata.pickle, length.bin, link_lists.bin ) to Github
  3. I created the .py to run the chatbot (langgraph, conn.query) and the requirements.txt
  4. I deployed the app on streamlit

The app does work but the retriever returns irrelevant chunks.

Python code to create the chroma db locally :
import streamlit as st
from streamlit_chromadb_connection.chromadb_connection import ChromadbConnection

Directory to save downloaded files

db_directory = r"C:\Users.…path "

configure the connection to Chroma DB

configuration = { “client”: “PersistentClient”, “path”: db_directory, }
conn = st.connection(name=“EPPG_2025_lm_v6_mini_embeddings”, type=ChromadbConnection,**configuration)
collection_name = “EPPG_2025_lm_v6_mini_embeddings”

embedding_function_name = “SentenceTransformerEmbeddingFunction”
embedding_config = {}
conn.create_collection(collection_name=collection_name, embedding_function_name=embedding_function_name, embedding_config={}, metadata = {“hnsw:space”: “cosine”} )

conn.upload_documents(collection_name=collection_name, documents=documents[0], metadatas=metadatas, ids=ids, embedding_function_name=embedding_function_name, embedding_config=embedding_config, embeddings=embeddings)
Python code to query the chroma db locally :

Retrieve sample documents from the collection

collection_name = “EPPG_2025_lm_v6_mini_embeddings”
sample_results = conn.query(
collection_name=collection_name,
query=[“What is SALTO?”],
num_results_limit=5,
attributes=[“documents”, “metadatas”]
)
Python code to use the chroma db from my app on the streamlit cloud :

Directory to save downloaded files (github)

db_directory = ‘.’

configure the connection to Chroma DB

configuration = { “client”: “PersistentClient”, “path”: db_directory, }

connection

conn = st.connection(name=“EPPG_2025_lm_v6_mini_embeddings”, type=ChromadbConnection, **configuration)
collection_name = “EPPG_2025_lm_v6_mini_embeddings”

Query the Chroma collection

queries=”What is SALTO?”
results = conn.query( collection_name=collection_name, query=queries, num_results_limit=3,
attributes=[“documents”,“embeddings”, “metadatas”] )