Bug
ChromaCloudQwenEmbeddingFunction treats task as optional everywhere except build_from_config, so a collection whose Qwen embedding function was created with task=None cannot be reloaded.
- The constructor signature is
task: Optional[str], and the docstring says "If None or empty, empty instructions will be used".
- The runtime (
__call__ / embed_query) handles task=None (if self.task and ...).
- The JSON schema
schemas/embedding_functions/chroma-cloud-qwen.json declares "task": {"type": ["string", "null"]}.
get_config() emits {"task": None, ...} for such an EF, and validate_config() accepts it.
But build_from_config guards with if model is None or task is None: assert False, "Config is missing a required field". So reloading a persisted collection whose Qwen EF used task=None raises AssertionError, which load_collection_configuration_from_json re-wraps as ValueError("Could not build embedding function ...") — the collection becomes unusable.
Reproduction
import os
os.environ["CHROMA_API_KEY"] = "dummy" # __init__ only needs a non-empty key; no network call
from chromadb.utils.embedding_functions.chroma_cloud_qwen_embedding_function import (
ChromaCloudQwenEmbeddingFunction as EF, ChromaCloudQwenEmbeddingModel as M)
ef = EF(model=M.QWEN3_EMBEDDING_0p6B, task=None) # valid per signature/docstring/schema
cfg = ef.get_config() # {"task": None, ...}
EF.validate_config(cfg) # passes (schema permits null)
EF.build_from_config(cfg) # AssertionError: Config is missing a required field
Fix
Only model is actually required; drop task from the guard:
- if model is None or task is None:
+ if model is None:
assert False, "Config is missing a required field"
PR incoming, with a real (non-mocked) get_config → build_from_config round-trip regression test (the existing parametrized round-trip test mocks build_from_config, so it never exercised this path).
Bug
ChromaCloudQwenEmbeddingFunctiontreatstaskas optional everywhere exceptbuild_from_config, so a collection whose Qwen embedding function was created withtask=Nonecannot be reloaded.task: Optional[str], and the docstring says "If None or empty, empty instructions will be used".__call__/embed_query) handlestask=None(if self.task and ...).schemas/embedding_functions/chroma-cloud-qwen.jsondeclares"task": {"type": ["string", "null"]}.get_config()emits{"task": None, ...}for such an EF, andvalidate_config()accepts it.But
build_from_configguards withif model is None or task is None: assert False, "Config is missing a required field". So reloading a persisted collection whose Qwen EF usedtask=NoneraisesAssertionError, whichload_collection_configuration_from_jsonre-wraps asValueError("Could not build embedding function ...")— the collection becomes unusable.Reproduction
Fix
Only
modelis actually required; droptaskfrom the guard:PR incoming, with a real (non-mocked)
get_config→build_from_configround-trip regression test (the existing parametrized round-trip test mocksbuild_from_config, so it never exercised this path).