mirror of
https://github.com/hwchase17/langchain.git
synced 2025-05-29 19:18:53 +00:00
langchain[patch]: Add missing deprecation for openai adapters (#20668)
Add missing deprecation for openai adapters
This commit is contained in:
parent
38adbfdf34
commit
936c6cc74a
@ -1,20 +1,28 @@
|
||||
from langchain_community.adapters.openai import (
|
||||
Chat,
|
||||
ChatCompletion,
|
||||
ChatCompletionChunk,
|
||||
ChatCompletions,
|
||||
Choice,
|
||||
ChoiceChunk,
|
||||
Completions,
|
||||
IndexableBaseModel,
|
||||
chat,
|
||||
convert_dict_to_message,
|
||||
convert_message_to_dict,
|
||||
convert_messages_for_finetuning,
|
||||
convert_openai_messages,
|
||||
)
|
||||
import warnings
|
||||
|
||||
__all__ = [
|
||||
from langchain_core._api import LangChainDeprecationWarning
|
||||
|
||||
from langchain.utils.interactive_env import is_interactive_env
|
||||
|
||||
|
||||
def __getattr__(name: str) -> None:
|
||||
# If not in interactive env, raise warning.
|
||||
from langchain_community.adapters import openai
|
||||
|
||||
if not is_interactive_env():
|
||||
warnings.warn(
|
||||
"Importing from langchain is deprecated. Importing from "
|
||||
"langchain will no longer be supported as of langchain==0.2.0. "
|
||||
"Instead of `from langchain.adapters.openai import {name}` "
|
||||
"Use `from langchain_community.adapters.openai import {name}`."
|
||||
"To install langchain-community run `pip install -U langchain-community`.",
|
||||
category=LangChainDeprecationWarning,
|
||||
)
|
||||
|
||||
return getattr(openai, name)
|
||||
|
||||
|
||||
__all__ = [ # noqa: F822
|
||||
"IndexableBaseModel",
|
||||
"Choice",
|
||||
"ChatCompletions",
|
||||
|
Loading…
Reference in New Issue
Block a user