INTPYTHON-881 Add auto-embedding to retrievers (#314)
Patch build:
https://spruce.mongodb.com/version/698386a6967f4f000735585f/tasks?sorts=STATUS%3AASC%3BBASE_STATUS%3ADESC
---
<!--
We do not accept pull requests that are primarily or substantially
generated by AI tools (ChatGPT, Copilot, etc.).
All contributions must be written and understood by human contributors.
-->
INTPYTHON-881
## Summary
<!-- What is this PR introducing? If context is already provided from
the JIRA ticket, still place it in the Pull Request as you should not
make the reviewer do digging for a basic summary. -->
Add auto-embedding support to retrievers.
## Changes in this PR
<!-- What changes did you make to the code? What new APIs (public or
private) were added, removed, or edited to generate the desired outcome
explained in the above summary? -->
Conditionally use auto-embedding support added in #305 to retrievers.
## Test Plan
<!-- How did you test the code? If you added unit tests, you can say
that. If you didn’t introduce unit tests, explain why. All code should
be tested in some way – so please list what your validation strategy
was. -->
Retrievers in langchain-mongodb:
1. ✅ MongoDBAtlasHybridSearchRetriever - auto-embedding support added
• Implementation: Lines 83-136 in hybrid_search.py
• Checks if using AutoEmbeddings and uses
autoembedding_vector_search_stage instead of vector_search_stage
• Test: test_hybrid_retriever_autoembed in test_retrievers.py (lines
253-270)
2. ✅ MongoDBAtlasParentDocumentRetriever - auto-embedding support added
• Implementation: Lines 86-116 in parent_document.py
• Checks if using AutoEmbeddings and uses
autoembedding_vector_search_stage instead of vector_search_stage
• Test: test_1clxn_retriever with parametrized embedding (auto/manual)
in test_parent_document.py (lines 42-110)
3. ✅ MongoDBAtlasSelfQueryRetriever - auto-embedding support inherited
• This retriever wraps a MongoDBAtlasVectorSearch vectorstore
## Checklist
<!-- Do not delete the items provided on this checklist -->
### Checklist for Author
- [x] Did you update the changelog (if necessary)?
- [x] Is the intention of the code captured in relevant tests?
- [ ] If there are new TODOs, has a related JIRA ticket been created?
- [x] Has a MongoDB Employee run [the patch build of this
PR](https://github.com/mongodb-labs/ai-ml-pipeline-testing?tab=readme-ov-file#running-a-patch-build-of-a-given-pr)?
### Checklist for Reviewer
- [ ] Does the title of the PR reference a JIRA Ticket?
- [ ] Do you fully understand the implementation? (Would you be
comfortable explaining how this code works to someone else?)
- [ ] Is all relevant documentation (README or docstring) updated?
---------
Co-authored-by: Steven Silvester <steve.silvester@mongodb.com> J
Jeffrey A. Clark committed
1c20f7204daa546b47c8cee2df596be0710348e5
Parent: e614a6d
Committed by GitHub <noreply@github.com>
on 2/5/2026, 2:58:42 AM