Skip to content

Conversation

@Akshay-Dongare
Copy link
Contributor

Description

This PR removes the deprecated LiteLLM chat model implementations from langchain-community and replaces them with hard proxy stubs that forward users to the standalone langchain-litellm package.

Both ChatLiteLLM and ChatLiteLLMRouter are now exposed as deprecated compatibility shims, preserving existing import paths while directing users to the canonical implementation in langchain-litellm.

This change:

  • Removes local implementations of ChatLiteLLM and ChatLiteLLMRouter
  • Adds clear DeprecationWarnings directing users to langchain-litellm
  • Forces traffic to the standalone package while preserving backwards-compatible import paths
  • Raises a helpful ImportError when langchain-litellm is not installed
  • Preserves __all__ to maintain public API stability and IDE/type-checker support

This 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.

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
@Akshay-Dongare Akshay-Dongare changed the title refactor(community): proxy deprecated LiteLLM chat models to langchain-litellm refactor(chat_models): proxy deprecated LiteLLM chat models to langchain-litellm Dec 17, 2025
@Akshay-Dongare
Copy link
Contributor Author

CI note (pydantic validator count):

The check_pydantic.sh failure is expected and intentional for this change.

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 make lint:
"Please update the 123 variable in ./scripts/check_pydantic.sh to 122"

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
@Akshay-Dongare
Copy link
Contributor Author

Pushed a follow-up commit to update the Pydantic validator baseline (check_pydantic.sh) from 123 → 122.
The cd libs/community / Python 3.11 job is now passing ✅.

@Akshay-Dongare
Copy link
Contributor Author

@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 langchain-litellm instead of carrying the implementation forever.

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.

@Akshay-Dongare
Copy link
Contributor Author

@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant