Fix ChatLiteLLM deprecation warning
Problem to solve
The class ChatLiteLLM was deprecated in LangChain 0.3.24 and will be removed in 1.0.
Step to reproduce
- Enable warnings in Pytest.
diff --git pyproject.toml pyproject.toml index 8068bf22..38b124b9 100644 --- pyproject.toml +++ pyproject.toml @@ -129,7 +129,7 @@ ignore-words-list = "astroid" ignore-multiline-regex = "codespell:ignore-begin.*\n.*codespell:ignore-end" [tool.pytest.ini_options] -addopts = "--disable-warnings" +# addopts = "--disable-warnings" testpaths = ["tests"] filterwarnings = ["error::UserWarning"] asyncio_default_fixture_loop_scope = "function" - Run the test.
❯ poetry run pytest tests/prompts/test_base.py --snip-- tests/prompts/test_base.py:320 /Users/tle/code/gitlab/ai-gateway/tests/prompts/test_base.py:320: LangChainDeprecationWarning: The class `ChatLiteLLM` was deprecated in LangChain 0.3.24 and will be removed in 1.0. An updated version of the class exists in the :class:`~langchain-litellm package and should be used instead. To use it run `pip install -U :class:`~langchain-litellm` and import as `from :class:`~langchain_litellm import ChatLiteLLM``. ChatLiteLLM(
Proposal
Migrate to langchain-litellm library.
Further details
Links / references
Edited by Tan Le