Skip to content

Conversation

jairad26
Copy link
Contributor

@jairad26 jairad26 commented Oct 17, 2025

Description of changes

Summarize the changes made by this PR.

  • Improvements & Bug fixes
    • Use ONNX minilm ef by default in python client
  • 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?

Copy link
Contributor Author

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

@jairad26 jairad26 marked this pull request as ready for review October 17, 2025 16:52
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

propel-code-bot bot commented Oct 17, 2025

Default Python Schema Uses ONNX MiniLM Embedding Function

This PR changes the default embedding function (embedding_function) for vector indexes in the Python schema system to use the ONNX MiniLM (MiniLM-L6-v2 ONNX) embedding function by default. The update ensures that, when creating new schemas or configuring vector indexes without explicitly specifying an embedding function, ONNX MiniLM is used by default instead of the previous behavior. The code achieves this through a default_factory on the embedding_function field, with careful instantiation to avoid module import issues. Comprehensive tests have been updated or added to ensure correct serialization, deserialization, and feature behaviors with the new default.

Key Changes

• Set the default value for VectorIndexConfig.embedding_function to ONNX MiniLM (ONNXMiniLM_L6_V2()), using a default_factory for lazy instantiation.
• Refactored the chromadb/api/types.py to construct the ONNXMiniLM_L6_V2 embedding function only when needed, avoiding import-time errors.
• Updated or created detailed unit tests in chromadb/test/api/test_schema.py to validate new default behaviors, serialization/deserialization, config propagation, and override logic.
• Improved JSON serialization/deserialization paths to correctly represent the new default and other known/unknown embedding functions across roundtrips.
• Changed pydantic field handling from direct instance default (DefaultEmbeddingFunction()) to use a function-based approach for safety and extensibility.

Affected Areas

chromadb/api/types.py (schema system, especially VectorIndexConfig and related logic)
chromadb/test/api/test_schema.py (serialization/deserialization and schema logic tests)

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

@jairad26 jairad26 force-pushed the jai/update-default-ef-schema branch 2 times, most recently from 131d68d to 9062bb8 Compare October 20, 2025 17:11
@jairad26 jairad26 force-pushed the jai/update-default-ef-schema branch from 9062bb8 to a356c07 Compare October 20, 2025 18:26
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.

1 participant