langchain_community.chat_models.ernie.ErnieBotChat¶
class langchain_community.chat_models.ernie.ErnieBotChat[source]¶
Bases: BaseChatModel
ERNIE-Bot large language model.
ERNIE-Bot is a large language model developed by Baidu,
covering a huge amount of Chinese data.
To use, you should have the ernie_client_id and ernie_client_secret set,
or set the environment variable ERNIE_CLIENT_ID and ERNIE_CLIENT_SECRET.
Note:
access_token will be automatically generated based on client_id and client_secret,
and will be regenerated after expiration (30 days).
Default model is ERNIE-Bot-turbo,
currently supported models are ERNIE-Bot-turbo, ERNIE-Bot, ERNIE-Bot-8K,
ERNIE-Bot-4, ERNIE-Bot-turbo-AI.
Example
from langchain_community.chat_models import ErnieBotChat
chat = ErnieBotChat(model_name='ERNIE-Bot')
Deprecated Note:
Please use QianfanChatEndpoint instead of this class.
QianfanChatEndpoint is a more suitable choice for production.
Always test your code after changing to QianfanChatEndpoint.
Example of QianfanChatEndpoint:from langchain_community.chat_models import QianfanChatEndpoint
qianfan_chat = QianfanChatEndpoint(model="ERNIE-Bot",
    endpoint="your_endpoint", qianfan_ak="your_ak", qianfan_sk="your_sk")
Create a new model by parsing and validating input data from keyword arguments.
Raises ValidationError if the input data cannot be parsed to form a valid model.
param access_token: Optional[str] = None¶
access token is generated by client id and client secret,
setting this value directly will cause an error