ChatHunyuan
Hunyuan chat model API by Tencent. For more information, see https://cloud.tencent.com/document/product/1729
from langchain.chat_models import ChatHunyuan
from langchain.schema import HumanMessage
chat = ChatHunyuan(
hunyuan_app_id=111111111,
hunyuan_secret_id="YOUR_SECRET_ID",
hunyuan_secret_key="YOUR_SECRET_KEY",
)
chat(
[
HumanMessage(
content="You are a helpful assistant that translates English to French.Translate this sentence from English to French. I love programming."
)
]
)
AIMessage(content="J'aime programmer.")
For ChatHunyuan with Streaming
chat = ChatHunyuan(
hunyuan_app_id="YOUR_APP_ID",
hunyuan_secret_id="YOUR_SECRET_ID",
hunyuan_secret_key="YOUR_SECRET_KEY",
streaming=True,
)
chat(
[
HumanMessage(
content="You are a helpful assistant that translates English to French.Translate this sentence from English to French. I love programming."
)
]
)
AIMessageChunk(content="J'aime programmer.")