Skip to content

Conversation

@jairad26
Copy link
Contributor

@jairad26 jairad26 commented Oct 21, 2025

Description of changes

Summarize the changes made by this PR.

  • Improvements & Bug fixes
    • This PR exports the hosted chroma ef to make it easier for imports, and fixes sparse auto-embedding to allow for edge cases, such as using #document with empty metadata
  • New functionality
    • ...

Test plan

How are these changes tested?

Added more schema_e2e tests for both dense and sparse autoembedding from different source keys

  • Tests pass locally with pytest for python, yarn test for js, cargo test for rust

Migration plan

Are there any migrations, or any forwards/backwards compatibility changes needed in order to make sure this change deploys reliably?

Observability plan

What is the plan to instrument and monitor this change?

Documentation Changes

Are all docstrings for user-facing APIs updated if required? Do we need to make documentation changes in the docs section?

Copy link
Contributor Author

jairad26 commented Oct 21, 2025

@jairad26 jairad26 marked this pull request as ready for review October 21, 2025 22:08
@propel-code-bot
Copy link
Contributor

propel-code-bot bot commented Oct 21, 2025

Export Cloud SPLADE Hosted Embedding Function and Robustify Sparse Auto-Embedding in Python Client

This PR introduces two main improvements to the Python client. First, it exports the hosted SPLADE embedding function (ChromaCloudSpladeEmbeddingFunction) in chromadb/utils/embedding_functions/__init__.py, making SPLADE available for imports and schema configuration. Second, it refactors the sparse auto-embedding logic in CollectionCommon.py to gracefully handle edge cases such as documents without metadata, empty or partially filled metadata arrays, and non-metadata-based source keys (e.g., using #document as a source for sparse embedding). A comprehensive suite of new and extended end-to-end schema tests validates the robustness and correctness of these changes.

Key Changes

• Exported ChromaCloudSpladeEmbeddingFunction in chromadb/utils/embedding_functions/__init__.py and added it to relevant registries and __all__.
• Modified CollectionCommon._apply_sparse_embeddings_to_metadatas() to robustly handle missing or empty metadatas, properly batch and assign sparse vectors when the source_key is #document, support None and empty metadata values, and return results that correctly reflect input conditions.
• Enhanced handling to prevent sparse auto-embedding from overwriting manually specified sparse vectors.
• Expanded and added multiple schema-level end-to-end tests in test_schema_e2e.py covering dense vs sparse auto-embedding interactions, document-only collections, batched behavior, persistence after reload, collections with mixed metadata, field type mismatches, and batch/empty document cases.
• Updated the embedding function test (test_ef.py) to include the newly exported SPLADE function.

Affected Areas

chromadb/utils/embedding_functions/__init__.py
chromadb/api/models/CollectionCommon.py
chromadb/test/api/test_schema_e2e.py
chromadb/test/ef/test_ef.py

This summary was automatically generated by @propel-code-bot

@github-actions
Copy link

Reviewer Checklist

Please leverage this checklist to ensure your code review is thorough before approving

Testing, Bugs, Errors, Logs, Documentation

  • Can you think of any use case in which the code does not behave as intended? Have they been tested?
  • Can you think of any inputs or external events that could break the code? Is user input validated and safe? Have they been tested?
  • If appropriate, are there adequate property based tests?
  • If appropriate, are there adequate unit tests?
  • Should any logging, debugging, tracing information be added or removed?
  • Are error messages user-friendly?
  • Have all documentation changes needed been made?
  • Have all non-obvious changes been commented?

System Compatibility

  • Are there any potential impacts on other parts of the system or backward compatibility?
  • Does this change intersect with any items on our roadmap, and if so, is there a plan for fitting them together?

Quality

  • Is this code of a unexpectedly high quality (Readability, Modularity, Intuitiveness)

@jairad26 jairad26 force-pushed the jai/export-python-hosted-splade-model branch from d2204b1 to 517106f Compare October 21, 2025 22:50
@jairad26 jairad26 force-pushed the jai/export-python-hosted-splade-model branch from 517106f to c2c379d Compare October 21, 2025 23:24
@jairad26 jairad26 requested a review from sanketkedia October 22, 2025 00:19
@jairad26 jairad26 force-pushed the jai/export-python-hosted-splade-model branch from c2c379d to d6914e9 Compare October 22, 2025 00:39
@jairad26 jairad26 enabled auto-merge (squash) October 22, 2025 01:04
@jairad26 jairad26 merged commit 9e020d9 into main Oct 22, 2025
62 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants