-
Notifications
You must be signed in to change notification settings - Fork 32
INTPYTHON-752 Integrate pymongo-search-utils #208
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR integrates the pymongo-search-utils
package to consolidate MongoDB search functionality and reduce code duplication.
- Migrates vector search index creation/update functions to
pymongo-search-utils
- Updates Python version requirement from 3.9 to 3.10
- Replaces local
bulk_embed_and_insert_texts
implementation with the external utility
Reviewed Changes
Copilot reviewed 6 out of 8 changed files in this pull request and generated 6 comments.
Show a summary per file
File | Description |
---|---|
pyproject.toml | Updates Python version requirement to 3.10 |
libs/langchain-mongodb/pyproject.toml | Updates Python version requirement and adds pymongo-search-utils dependency |
libs/langchain-mongodb/tests/utils.py | Imports and uses external bulk_embed_and_insert_texts function |
libs/langchain-mongodb/langchain_mongodb/vectorstores.py | Removes local bulk_embed_and_insert_texts method and uses external function |
libs/langchain-mongodb/langchain_mongodb/utils.py | Removes local _append_client_metadata function and imports from external package |
libs/langchain-mongodb/langchain_mongodb/index.py | Removes local index creation/update functions and imports from external package |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
batch_res = bulk_embed_and_insert_texts( | ||
texts_batch, metadatas_batch, ids[i : j + 1] | ||
) |
Copilot
AI
Oct 6, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The external bulk_embed_and_insert_texts
function is being called without the required self
parameter that was present in the original method. This function needs to receive the embedding model, collection, and field configuration to work properly.
Copilot uses AI. Check for mistakes.
batch_res = bulk_embed_and_insert_texts( | ||
texts_batch, metadatas_batch | ||
) |
Copilot
AI
Oct 6, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The external bulk_embed_and_insert_texts
function is being called without the required self
parameter that was present in the original method. This function needs to receive the embedding model, collection, and field configuration to work properly.
Copilot uses AI. Check for mistakes.
batch_res = bulk_embed_and_insert_texts( | ||
texts_batch, metadatas_batch, ids[i : j + 1] | ||
) |
Copilot
AI
Oct 6, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The external bulk_embed_and_insert_texts
function is being called without the required self
parameter that was present in the original method. This function needs to receive the embedding model, collection, and field configuration to work properly.
Copilot uses AI. Check for mistakes.
batch_res = self.bulk_embed_and_insert_texts( | ||
texts_batch, metadatas_batch | ||
) | ||
batch_res = bulk_embed_and_insert_texts(texts_batch, metadatas_batch) |
Copilot
AI
Oct 6, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The external bulk_embed_and_insert_texts
function is being called without the required self
parameter that was present in the original method. This function needs to receive the embedding model, collection, and field configuration to work properly.
Copilot uses AI. Check for mistakes.
result_ids.extend( | ||
self.bulk_embed_and_insert_texts( | ||
bulk_embed_and_insert_texts( | ||
texts=texts, metadatas=metadatas, ids=ids[start:end] |
Copilot
AI
Oct 6, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The external bulk_embed_and_insert_texts
function is being called without the required self
parameter that was present in the original method. This function needs to receive the embedding model, collection, and field configuration to work properly.
texts=texts, metadatas=metadatas, ids=ids[start:end] | |
embedding_model=self._embedding, | |
collection=self._collection, | |
text_key=self._text_key, | |
embedding_key=self._embedding_key, | |
metadata_key=self._metadata_key, | |
texts=texts, | |
metadatas=metadatas, | |
ids=ids[start:end], |
Copilot uses AI. Check for mistakes.
) -> List: | ||
"""Patched insert_texts that waits for data to be indexed before returning""" | ||
ids_inserted = super().bulk_embed_and_insert_texts(texts, metadatas, ids) | ||
ids_inserted = bulk_embed_and_insert_texts(texts, metadatas, ids) |
Copilot
AI
Oct 6, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The external bulk_embed_and_insert_texts
function is being called without the required instance context that was available when it was called as super().bulk_embed_and_insert_texts()
. This function needs to receive the embedding model, collection, and field configuration to work properly.
ids_inserted = bulk_embed_and_insert_texts(texts, metadatas, ids) | |
ids_inserted = bulk_embed_and_insert_texts( | |
self.embedding, self.collection, self._embedding_field_config, texts, metadatas, ids | |
) |
Copilot uses AI. Check for mistakes.
@NoahStapp Re: test failures Should |
It should be passed in. The previous version of |
Also ignore UP038 based on mongodb/django-mongodb-backend#389
1941706
to
b75d316
Compare
No description provided.