Skip to content

Conversation

@tanujnay112
Copy link
Contributor

@tanujnay112 tanujnay112 commented Dec 5, 2025

Description of changes

Summarize the changes made by this PR.

  • Improvements & Bug fixes
    • attach_function now accepts a Function enum in its new function parameter. The old function_id parameter has been removed. This API change should make the definition of attach_function clearer.
  • New functionality
    • ...

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

github-actions bot commented Dec 5, 2025

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

Warning

This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
Learn more

This stack of pull requests is managed by Graphite. Learn more about stacking.

@propel-code-bot
Copy link
Contributor

propel-code-bot bot commented Dec 5, 2025

Rename attach_function parameter to use Function enum

This PR replaces the function_id argument on Collection.attach_function with a new function parameter that accepts values from the newly introduced chromadb.api.functions.Function enum (with convenience aliases). All first-party call sites, including integration tests, statistics helpers, and the task API example, are updated to pass enum instances. The client method still converts the enum to its string value before delegating to the lower-level API to preserve runtime compatibility with the backend.

Key Changes

• Added Function enum and aliases in chromadb/api/functions.py for built-in attachable functions
• Renamed Collection.attach_function argument from function_id to function and mapped enum values to string IDs before client invocation
• Updated distributed task API tests to import Function/RECORD_COUNTER_FUNCTION and use the new parameter name
• Revised chromadb/utils/statistics.py helper and examples/task_api_example.py to pass function=STATISTICS_FUNCTION/RECORD_COUNTER_FUNCTION

Affected Areas

chromadb/api/functions.py
chromadb/api/models/Collection.py
chromadb/utils/statistics.py
chromadb/test/distributed/test_task_api.py
examples/task_api_example.py

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

@tanujnay112 tanujnay112 changed the title [ENH]: Change attach_function::function_name param to be clearer [ENH]: Change attach_function::function_id param to be clearer Dec 5, 2025
@tanujnay112 tanujnay112 requested a review from HammadB December 5, 2025 06:20
@tanujnay112 tanujnay112 changed the base branch from detach_change to graphite-base/5962 December 5, 2025 22:34
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