Skip to content

refactor(utils_pkg): keep local copy of bm25 retriever to drop langchain-community - #103

Merged
sanjayankur31 merged 1 commit into
NeuroML:developmentfrom
dhanushshankar-hq:feature/replace-langchain-bm25
Aug 14, 2026
Merged

refactor(utils_pkg): keep local copy of bm25 retriever to drop langchain-community#103
sanjayankur31 merged 1 commit into
NeuroML:developmentfrom
dhanushshankar-hq:feature/replace-langchain-bm25

Conversation

@dhanushshankar-hq

Copy link
Copy Markdown

Related Issue

Fixes #102

Description

This PR addresses the DeprecationWarning caused by langchain-community being sunset. As discussed in the issue, it drops the external dependency by creating a local, standalone copy of the BM25 wrapper module.

Changes Made

  • Added utils_pkg/klea_utils/stores/langchain_bm25.py: Created a local copy of the BM25Retriever logic from langchain-community.
  • Updated utils_pkg/klea_utils/stores/retrieval/bm25.py:
    • Replaced the deprecated langchain_community import with the new local module.
    • Replaced lazy loading with a direct import at the top of the file.
  • Updated utils_pkg/setup.cfg: Removed langchain-community from the package dependencies.

@sanjayankur31 sanjayankur31 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few minor tweaks. Please note if any AI was used in the preparation of this PR.

If you could also improve the commit message to explain why we've done this, that'll be good---it'll be documented for future contributors (you can just take the note removed from setup.cfg).

Comment thread utils_pkg/klea_utils/stores/langchain_bm25.py
Comment thread utils_pkg/klea_utils/stores/langchain_bm25.py
…ementation

langchain-community is being sunset/deprecated. To avoid depending on a deprecated package, this commit ports the BM25Retriever wrapper directly into utils_pkg/klea_utils/stores/langchain_bm25.py. Fixes NeuroML#103.
@dhanushshankar-hq
dhanushshankar-hq force-pushed the feature/replace-langchain-bm25 branch from 2b52c06 to 416fb17 Compare August 14, 2026 11:28
@dhanushshankar-hq

Copy link
Copy Markdown
Author

A few minor tweaks. Please note if any AI was used in the preparation of this PR.

Yes, I used an AI assistant (Gemini) to help writing docstrings/headers and drafting the PR description.

@dhanushshankar-hq

Copy link
Copy Markdown
Author

I've updated the PR to address the review feedback.

Just to let you know regarding the failing Ruff CI check: it's triggering on pre-existing issues in untouched modules. The files modified in this PR pass all local Ruff checks cleanly.

@sanjayankur31 sanjayankur31 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great, thanks. merging.

@allcontributors please add @Coderdhanush2003 for code

@sanjayankur31
sanjayankur31 merged commit 71a1694 into NeuroML:development Aug 14, 2026
@dhanushshankar-hq

Copy link
Copy Markdown
Author

Thanks @sanjayankur31! I recently updated my GitHub username.

@allcontributors please add @dhanushshankar-hq for code

@allcontributors

Copy link
Copy Markdown
Contributor

@dhanushshankar-hq

I've put up a pull request to add @dhanushshankar-hq! 🎉

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