[ENH](rust-client): Add embedding functions#7116
Open
rescrv wants to merge 4 commits into
Open
Conversation
Implement Chroma Cloud embedding functions for the Rust client: - Add ChromaCloudQwenEmbeddingFunction for dense embeddings - Add ChromaCloudSpladeEmbeddingFunction for sparse embeddings - Extend EmbeddingFunction trait with embed_query_strs method - Auto-attach embedding function from collection schema on get - Allow add/upsert/update to compute embeddings from documents when explicit embeddings are omitted (IntoOptionalEmbeddings) - Add fluent builders for embedding functions and configurations - Expose chroma_cloud_api_key through client for auto-config - Add embeddings example demonstrating dense and sparse usage - Add unit tests for embedding resolution and auto-attach Co-authored-by: AI
Reviewer ChecklistPlease leverage this checklist to ensure your code review is thorough before approving Testing, Bugs, Errors, Logs, Documentation
System Compatibility
Quality
|
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Sicheng-Pan
reviewed
May 22, 2026
| .filter_map(|document| document.as_deref()) | ||
| .collect::<Vec<_>>(); | ||
| if input.is_empty() { | ||
| return Ok(None); |
Contributor
There was a problem hiding this comment.
is this the right return value here
Contributor
Author
There was a problem hiding this comment.
If there are no documents it'll return no embeddings. This makes sense because it's for update. No doc, no embed.
Sicheng-Pan
reviewed
May 22, 2026
| Ok(Some( | ||
| documents | ||
| .iter() | ||
| .map(|document| document.as_ref().map(|_| embeddings.next().unwrap())) |
Contributor
There was a problem hiding this comment.
nit: would prefer avoid unwrap if possible
Sicheng-Pan
approved these changes
May 22, 2026
This comment has been minimized.
This comment has been minimized.
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.
Description of changes
Implement Chroma Cloud embedding functions for the Rust client:
when explicit embeddings are omitted (IntoOptionalEmbeddings)
Test plan
CI
Migration plan
Backwards-compatible for people not using embeddings already.
Observability plan
N/A
Documentation Changes
Doc strings updated.
Co-authored-by: AI