fix(rag): give CustomEmbeddingFunction a name() for ChromaDB #9842
All Vouch review confidence checks passed
Residual risk 0.24 = Change Risk (0.44) × (1 − Review Confidence (0.47)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.44 · 256 lines diff across 3 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.02 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Shallow Review Depth
shallow_review_depth
0.344
Diff Size
diff_size
0.332
Ai Authored
ai_authored
0.050
Real PR Conversation Timeline
1 comments
"Review active on #9842"
general
weight: 0.35
1AbdullahButt
Fixes #9841
Summary
Knowledge with a custom embedder (
provider: "custom") crashed on the ChromaDB backend withAttributeError: '<cls>' object has no attribute 'name'. ChromaDB 1.x callsembedding_function.name()when it opens a collection. crewAI's other embedding functions define it (OpenAIEmbeddingFunction.name()is documented "for ChromaDB compatibility"; VoyageAI, IBM and Oracle do too), butCustomEmbeddingFunctiondid not, and because crewAI'sEmbeddingFunctionis its ownProtocolit does not inherit ChromaDB's fallback. The default Qdrant backend never callsname(), so only users who opt in to ChromaDB were affected.Changes
lib/crewai/src/crewai/rag/embeddings/providers/custom/embedding_callable.py: add a staticname()returning"custom", the same shape asOpenAIEmbeddingFunction.name(). Subclasses can still override it.lib/crewai/tests/knowledge/test_knowledge_storage_providers.py: addtest_custom_embedder_save_and_search_roundtrip_on_chromadb, which saves and searches through a real local ChromaDB client (markedrequires_chromadb). The existing ChromaDB test mockscreate_client, so it never reached the code that callsname().Verification
embedding_callable.py(new test kept):test_knowledge_storage_providers.py->1 failed, 15 passed; the new test fails with theAttributeErrorfrom the issue.16 passed.lib/crewai/tests/:7673 passed, 46 skipped, 4 xfailed(base 77237aec:7672 passed, same skips and xfails).ruff check lib/,ruff format --check lib/andmypy lib/crewai/src/crewai/pass; mypy also passes on the changed module with--python-version 3.10.ok, and reopening the same ChromaDB store from a second process works.AI assistance
Prepared with Claude Code assistance; I reviewed and can explain every change. Per CONTRIBUTING.md, please apply the
llm-generatedlabel; external contributors can't add it with their permissions.