build(deps): drop langchain-chroma dependency - #541
Open
amirfz wants to merge 1 commit into
Open
Conversation
langchain-chroma added nothing sherpa-ai actually used: LocalChromaStore and configure_chroma were thin wrappers around langchain_chroma.Chroma, and chromadb (the actual vector DB client) is already a hard dependency of the project (see chroma_vector_store.py, which never used langchain-chroma to begin with). LocalChromaStore now subclasses langchain_core.vectorstores.VectorStore directly and talks to chromadb via an EphemeralClient (or an injected client, for configure_chroma's remote-server case), instead of going through the wrapper package. Public surface — class name, from_folder(), similarity_search(), as_retriever() — is unchanged, so get_vectordb() and ContextSearch (its only real caller) don't need to change at all. query_chroma.py's one-off script use is replaced with chromadb's own query API plus its own OpenAIEmbeddingFunction (langchain's Embeddings interface isn't what chromadb's collection embedding_function expects). test_context_search.py's availability check was gating on langchain_chroma being importable; updated to check chromadb instead, since that's what's now actually required — otherwise this real end-to-end test would have started silently skipping the moment langchain-chroma was uninstalled. Added a focused round-trip test for LocalChromaStore itself (add_texts + similarity_search, with metadata) using a small deterministic fake embedding function — there was no dedicated test for this class before. Verified by mutating add_texts to drop metadata and confirming both new tests fail, then reverting. Full suite (386 passed, 2 skipped) run for real with langchain-chroma uninstalled from the environment, not just removed from pyproject.toml. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
amirfz
force-pushed
the
deps/drop-langchain-chroma
branch
from
August 1, 2026 15:08
f26c853 to
309a1f0
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Supersedes #532 (langchain-chroma 0.2.6 → 1.1.0) — instead of bumping it, this drops the dependency entirely.
langchain-chromaadded nothing sherpa-ai actually used:LocalChromaStoreandconfigure_chromainvectorstores.pywere thin wrappers aroundlangchain_chroma.Chroma, andchromadb(the real vector DB client) is already a hard dependency —chroma_vector_store.py'sChromaVectorStorenever usedlangchain-chromato begin with.Changes
LocalChromaStorenow subclasseslangchain_core.vectorstores.VectorStoredirectly and talks tochromadbviaEphemeralClient()(or an injected client, forconfigure_chroma's remote-server case). Public surface is unchanged — same class name,from_folder(),similarity_search(),as_retriever()— soget_vectordb()andContextSearch(its only real caller) need no changes.query_chroma.py's one-off script use is replaced with chromadb's own query API +embedding_functions.OpenAIEmbeddingFunction(langchain'sEmbeddingsinterface isn't what chromadb's collectionembedding_functionparam expects — different protocol, worth calling out since it's an easy mismatch to introduce).test_context_search.py's availability check was gating onlangchain_chromabeing importable; updated to checkchromadbinstead — otherwise this real end-to-end test would have started silently skipping the momentlangchain-chromawas uninstalled, without anyone noticing.LocalChromaStore(add_texts + similarity_search, with metadata) using a small deterministic fake embedding function — there was no dedicated test for this class before.poetry.lockregenerated with the same Poetry version as the existing lock (2.2.1) to avoid unrelated format churn.Verification
add_textsto drop metadata and confirmed both new tests fail; reverted and confirmed green.langchain-chromauninstalled from the environment, not just removed frompyproject.toml.Test plan
pytest tests/unit_tests/connectors/test_local_chroma_store.py— new round-trip tests passpytest tests/unit_tests/actions/test_context_search.py— realContextSearch→get_vectordb()→LocalChromaStorepath exercised, passeslangchain-chromanot installedadd_textsmetadata handling — caught, revertedCo-Authored-By: Claude Sonnet 5 noreply@anthropic.com