mirror of
https://github.com/hwchase17/langchain.git
synced 2025-08-01 00:49:25 +00:00
community[patch]: deprecate all HF classes (#22444)
This commit is contained in:
parent
58b118544e
commit
17c127531a
@ -39,9 +39,7 @@ DEFAULT_SYSTEM_PROMPT = """You are a helpful, respectful, and honest assistant."
|
||||
@deprecated(
|
||||
since="0.0.37",
|
||||
removal="0.3",
|
||||
alternative_import=(
|
||||
"from langchain_huggingface.chat_models.huggingface import ChatHuggingFace"
|
||||
),
|
||||
alternative_import=("from langchain_huggingface import ChatHuggingFace"),
|
||||
)
|
||||
class ChatHuggingFace(BaseChatModel):
|
||||
"""
|
||||
|
@ -1,6 +1,7 @@
|
||||
from typing import Any, Dict, List, Optional
|
||||
|
||||
import requests
|
||||
from langchain_core._api import deprecated
|
||||
from langchain_core.embeddings import Embeddings
|
||||
from langchain_core.pydantic_v1 import BaseModel, Extra, Field, SecretStr
|
||||
|
||||
@ -17,6 +18,11 @@ DEFAULT_QUERY_BGE_INSTRUCTION_EN = (
|
||||
DEFAULT_QUERY_BGE_INSTRUCTION_ZH = "为这个句子生成表示以用于检索相关文章:"
|
||||
|
||||
|
||||
@deprecated(
|
||||
since="0.2.2",
|
||||
removal="0.3.0",
|
||||
alternative_import="from langchain_huggingface import HuggingFaceEmbeddings",
|
||||
)
|
||||
class HuggingFaceEmbeddings(BaseModel, Embeddings):
|
||||
"""HuggingFace sentence_transformers embedding models.
|
||||
|
||||
|
@ -2,6 +2,7 @@ import json
|
||||
import os
|
||||
from typing import Any, Dict, List, Optional
|
||||
|
||||
from langchain_core._api import deprecated
|
||||
from langchain_core.embeddings import Embeddings
|
||||
from langchain_core.pydantic_v1 import BaseModel, Extra, root_validator
|
||||
|
||||
@ -9,6 +10,11 @@ DEFAULT_MODEL = "sentence-transformers/all-mpnet-base-v2"
|
||||
VALID_TASKS = ("feature-extraction",)
|
||||
|
||||
|
||||
@deprecated(
|
||||
since="0.2.2",
|
||||
removal="0.3.0",
|
||||
alternative_import="from langchain_huggingface import HuggingFaceEndpointEmbeddings", # noqa: E501
|
||||
)
|
||||
class HuggingFaceHubEmbeddings(BaseModel, Embeddings):
|
||||
"""HuggingFaceHub embedding models.
|
||||
|
||||
|
@ -25,7 +25,7 @@ VALID_TASKS = (
|
||||
@deprecated(
|
||||
since="0.0.37",
|
||||
removal="0.3",
|
||||
alternative_import="from langchain_huggingface.llms import HuggingFaceEndpoint",
|
||||
alternative_import="from langchain_huggingface import HuggingFaceEndpoint",
|
||||
)
|
||||
class HuggingFaceEndpoint(LLM):
|
||||
"""
|
||||
|
@ -20,7 +20,11 @@ VALID_TASKS_DICT = {
|
||||
}
|
||||
|
||||
|
||||
@deprecated("0.0.21", removal="0.3.0", alternative="HuggingFaceEndpoint")
|
||||
@deprecated(
|
||||
"0.0.21",
|
||||
removal="0.3.0",
|
||||
alternative_import="from langchain_huggingface import HuggingFaceEndpoint",
|
||||
)
|
||||
class HuggingFaceHub(LLM):
|
||||
"""HuggingFaceHub models.
|
||||
! This class is deprecated, you should use HuggingFaceEndpoint instead.
|
||||
|
@ -26,7 +26,7 @@ logger = logging.getLogger(__name__)
|
||||
@deprecated(
|
||||
since="0.0.37",
|
||||
removal="0.3",
|
||||
alternative_import="from rom langchain_huggingface.llms import HuggingFacePipeline",
|
||||
alternative_import="from langchain_huggingface import HuggingFacePipeline",
|
||||
)
|
||||
class HuggingFacePipeline(BaseLLM):
|
||||
"""HuggingFace Pipeline API.
|
||||
|
@ -14,7 +14,11 @@ from langchain_core.utils import get_pydantic_field_names
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@deprecated("0.0.21", removal="0.3.0", alternative="HuggingFaceEndpoint")
|
||||
@deprecated(
|
||||
"0.0.21",
|
||||
removal="0.3.0",
|
||||
alternative_import="from langchain_huggingface import HuggingFaceEndpoint",
|
||||
)
|
||||
class HuggingFaceTextGenInference(LLM):
|
||||
"""
|
||||
HuggingFace text generation API.
|
||||
|
Loading…
Reference in New Issue
Block a user