Skip to content

Conversation

codetheweb
Copy link
Contributor

@codetheweb codetheweb commented Oct 19, 2025

Description of changes

Adds create_collection() and get_or_create_collection() to the Rust client, also wires up list_collections().

Test plan

How are these changes tested?

  • 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

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)

if let Some(response) = maybe_response {
let json = response.json::<serde_json::Value>().await?;

if tracing::enabled!(tracing::Level::TRACE) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

now logs response JSON on failed requests
will add a custom error type for when we receive parsable JSON errors in a follow up PR

@codetheweb codetheweb marked this pull request as ready for review October 19, 2025 23:16
@codetheweb codetheweb requested a review from rescrv October 19, 2025 23:16
Copy link
Contributor

propel-code-bot bot commented Oct 19, 2025

Add create_collection() and Refactor to Database Name-Based APIs in Rust Client

This PR implements two new methods, create_collection() and get_or_create_collection(), in the Rust client for Chroma, supporting creation (and upsert) of collections against the backend API. The list_collections() method is also fully implemented to return richer details (now returning a vector of ChromaCollection). The request and client logic is significantly refactored to shift from using database_id to database_name throughout the API, including both wire protocol and local state handling. Internal types, request objects, and related client methods are renamed and updated for name-based access, ensuring consistency. Tests are expanded to cover these new capabilities, verifying create_collection(), get_or_create_collection(), and full round-trips including limit/offset logic on list_collections().

Key Changes

• Added create_collection() and get_or_create_collection() methods to ChromaClient in rust/chroma/src/client/chroma_client.rs.
• Refactored all database-related fields and logic from database_id to database_name in the client code and request builders.
• Reworked ListCollectionsRequest and related code to use database_name and default values; added CreateCollectionRequest struct.
• Updated internal state management in ChromaClient to track default_database_name instead of default_database_id, including mutex logic, setters, and resolution on demand.
• Modified ChromaCollection to ensure internal fields relevant for new collection operations are properly exposed.
• Expanded and refactored tests in chroma_client.rs to cover new collection creation logic, list round-trips, and naming consistency.
• Enhanced error handling in send() to log full response JSON in tracing for failed requests.
• Updated documentation and comments to reflect new parameter naming and API behavior.

Affected Areas

rust/chroma/src/client/chroma_client.rs
rust/chroma/src/types/requests.rs
rust/chroma/src/client/options.rs
rust/chroma/src/collection.rs
rust/chroma/src/types.rs

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

@codetheweb codetheweb force-pushed the feat-chroma-rust-client-create-list-collections branch from 7a43dc3 to 703a271 Compare October 19, 2025 23:21
Copy link
Contributor Author

@codetheweb codetheweb force-pushed the feat-chroma-rust-client-create-list-collections branch from 703a271 to 0e9ef4c Compare October 20, 2025 00:10
Copy link
Contributor Author

codetheweb commented Oct 20, 2025

Merge activity

  • Oct 20, 2:45 AM UTC: A user started a stack merge that includes this pull request via Graphite.
  • Oct 20, 2:45 AM UTC: @codetheweb merged this pull request with Graphite.

@codetheweb codetheweb merged commit bf8e462 into main Oct 20, 2025
61 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.

2 participants