Skip to content

Conversation

@Sicheng-Pan
Copy link
Contributor

@Sicheng-Pan Sicheng-Pan commented Sep 18, 2025

Description of changes

Summarize the changes made by this PR.

  • Improvements & Bug fixes
    • N/A
  • New functionality
    • Allow search args to be dicts
    • Added tests

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?

@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)

Copy link
Contributor Author

Sicheng-Pan commented Sep 18, 2025

@Sicheng-Pan Sicheng-Pan marked this pull request as ready for review September 18, 2025 03:33
@propel-code-bot
Copy link
Contributor

propel-code-bot bot commented Sep 18, 2025

Enable Dictionary Inputs for Search Arguments in Expression API

This PR introduces support for using plain Python dictionaries (dicts) as input arguments in the Search expression API, alongside the existing class-based interfaces. Users can now supply dicts for where, rank, limit, and select parameters, both at construction and via builder methods, and these will be automatically parsed and validated into the appropriate expression types. The enhancement is supported by comprehensive unit tests and improved docstrings for user-facing APIs.

Key Changes

• Added from_dict static methods to Where, Rank, Limit, and Select classes for creating expression objects from dicts
• Extended Search API to accept dicts (and other common convenience types like lists or ints) for where, rank, limit, and select parameters
• Implemented type validation and input normalization for all dict-based API surfaces, with informative error handling
• Revised and clarified docstrings to document dict usage and clarify the semantics for special fields and metadata fields
• Added extensive new unit tests covering all conversion cases (including invalid inputs and round-trips) in chromadb/test/test_api.py
• Minor refactors to ensure safe and clear handling of user input throughout the expression construction process

Affected Areas

chromadb/execution/expression/plan.py
chromadb/execution/expression/operator.py
chromadb/test/test_api.py

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

@Sicheng-Pan Sicheng-Pan force-pushed the 09-17-_enh_allow_dict_as_search_args branch from d8ed9e5 to 938c246 Compare September 22, 2025 20:15
@Sicheng-Pan Sicheng-Pan force-pushed the 09-17-_enh_allow_dict_as_search_args branch 3 times, most recently from 8d633cc to d6a6c6c Compare September 22, 2025 22:51
@blacksmith-sh blacksmith-sh bot deleted a comment from Sicheng-Pan Sep 22, 2025
Copy link
Contributor Author

Sicheng-Pan commented Sep 23, 2025

Merge activity

  • Sep 23, 12:17 AM UTC: A user started a stack merge that includes this pull request via Graphite.
  • Sep 23, 12:51 AM UTC: Graphite rebased this pull request as part of a merge.
  • Sep 23, 1:16 AM UTC: @Sicheng-Pan merged this pull request with Graphite.

@Sicheng-Pan Sicheng-Pan changed the base branch from 09-17-_enh_implements_rrf_helper_expression to graphite-base/5503 September 23, 2025 00:18
@Sicheng-Pan Sicheng-Pan changed the base branch from graphite-base/5503 to main September 23, 2025 00:49
@Sicheng-Pan Sicheng-Pan force-pushed the 09-17-_enh_allow_dict_as_search_args branch from d6a6c6c to e562dd1 Compare September 23, 2025 00:50
@Sicheng-Pan Sicheng-Pan merged commit 8e8884c into main Sep 23, 2025
59 checks passed
@Sicheng-Pan Sicheng-Pan deleted the 09-17-_enh_allow_dict_as_search_args branch October 10, 2025 19:05
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