-
Notifications
You must be signed in to change notification settings - Fork 316
refactor(chat_models): proxy deprecated LiteLLM chat models to langchain-litellm #476
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
Conversation
The LiteLLM wrapper is deprecated. Users are advised to install `langchain-litellm` and import `ChatLiteLLM` from there.
- Replace runtime imports with TYPE_CHECKING-safe stubs - Raise clear ImportError when langchain-litellm is not installed - Preserve __all__ and static typing compatibility - Guide users to migrate via explicit deprecation warning
CI note (pydantic validator count):The This PR removes the ChatLiteLLM class, which was the single definition site inheriting Pydantic validators from BaseChatModel. ChatLiteLLMRouter previously inherited those validators via ChatLiteLLM, so removing both classes results in a net decrease of 1 validator definition, not 2. The script correctly detects this reduction and requests updating the baseline count when running Happy to update the script in this PR if preferred, or leave it unchanged and let a maintainer handle the baseline bump. |
Updated the current count for Pydantic validator usage check
|
Pushed a follow-up commit to update the Pydantic validator baseline (check_pydantic.sh) from 123 → 122. |
This commit only adds type annotations to MockGet to satisfy mypy --no-untyped-def. No functional changes.
|
@mdrxy Could you please take a quick look when you get a sec? We’ve been emitting the ChatLiteLLM deprecation warning for a long time now, and this PR just turns the old classes into thin shims pointing to Feels like the right middle ground before we fully delete these in a future release, but would love your take on how you want to handle this going forward. |
|
@mdrxy I just noticed that ChatLiteLLM and ChatLiteLLMRouter were already fully removed in #403 (mdrxy/remove-chat-models → scratch). Given that direction, this PR (which keeps a thin compatibility shim + deprecation path) is no longer aligned with current maintainer intent. I’ll close this PR to avoid re-introducing deprecated surface area. Happy to help with follow-ups or migration docs if useful. |
Description
This PR removes the deprecated LiteLLM chat model implementations from
langchain-communityand replaces them with hard proxy stubs that forward users to the standalonelangchain-litellmpackage.Both
ChatLiteLLMandChatLiteLLMRouterare now exposed as deprecated compatibility shims, preserving existing import paths while directing users to the canonical implementation inlangchain-litellm.This change:
ChatLiteLLMandChatLiteLLMRouterDeprecationWarningsdirecting users tolangchain-litellmImportErrorwhenlangchain-litellmis not installed__all__to maintain public API stability and IDE/type-checker supportThis aligns LiteLLM with LangChain’s provider package pattern and reduces long-term maintenance burden in
langchain-community.Issue
N/A (continuation of existing deprecations)
Dependencies
None. No new dependencies added.