From 83f62fdacfa7930c975e2c4aea5733b17e8d6bde Mon Sep 17 00:00:00 2001 From: Erick Friis Date: Wed, 3 Apr 2024 10:00:25 -0700 Subject: [PATCH] core: fix try_load_from_hub for older langchain versions load_chain (#19964) --- libs/core/langchain_core/utils/loading.py | 17 ++++++++++++++++- libs/core/pyproject.toml | 2 +- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/libs/core/langchain_core/utils/loading.py b/libs/core/langchain_core/utils/loading.py index 3affa3f666..a9abf7ee7a 100644 --- a/libs/core/langchain_core/utils/loading.py +++ b/libs/core/langchain_core/utils/loading.py @@ -1,13 +1,28 @@ """Utilities for loading configurations from langchain_core-hub.""" +import warnings from typing import Any +from langchain_core._api.deprecation import deprecated + +@deprecated( + since="0.1.30", + removal="0.2", + message=( + "Using the hwchase17/langchain-hub " + "repo for prompts is deprecated. Please use " + "https://smith.langchain.com/hub instead." + ), +) def try_load_from_hub( *args: Any, **kwargs: Any, ) -> Any: - raise RuntimeError( + warnings.warn( "Loading from the deprecated github-based Hub is no longer supported. " "Please use the new LangChain Hub at https://smith.langchain.com/hub instead." ) + # return None, which indicates that we shouldn't load from old hub + # and might just be a filepath for e.g. load_chain + return None diff --git a/libs/core/pyproject.toml b/libs/core/pyproject.toml index 71cda788f4..2f4c5c4297 100644 --- a/libs/core/pyproject.toml +++ b/libs/core/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "langchain-core" -version = "0.1.39" +version = "0.1.40" description = "Building applications with LLMs through composability" authors = [] license = "MIT"