community[patch]: deprecate ErnieBotChat and ErnieEmbeddings classes (#15862)

- **Description:** add deprecated warning for ErnieBotChat and
ErnieEmbeddings.
- These two classes **lack maintenance** and do not use the sdk provided
by qianfan, which means hard to implement some key feature like
streaming.
- The alternative `langchain_community.chat_models.QianfanChatEndpoint`
and `langchain_community.embeddings.QianfanEmbeddingsEndpoint` can
completely replace these two classes, only need to change configuration
items.
  - **Issue:** None,
  - **Dependencies:** None,
  - **Twitter handle:** None

---------

Co-authored-by: Bagatur <baskaryan@gmail.com>
This commit is contained in:
axiangcoding
2024-01-16 03:14:44 +08:00
committed by GitHub
parent 7c57cfd8f0
commit daa9ccae52
4 changed files with 97 additions and 10 deletions

View File

@@ -4,6 +4,7 @@ import threading
from typing import Dict, List, Optional
import requests
from langchain_core._api.deprecation import deprecated
from langchain_core.embeddings import Embeddings
from langchain_core.pydantic_v1 import BaseModel, root_validator
from langchain_core.runnables.config import run_in_executor
@@ -12,6 +13,10 @@ from langchain_core.utils import get_from_dict_or_env
logger = logging.getLogger(__name__)
@deprecated(
since="0.0.13",
alternative="langchain_community.embeddings.QianfanEmbeddingsEndpoint",
)
class ErnieEmbeddings(BaseModel, Embeddings):
"""`Ernie Embeddings V1` embedding models."""