跳到主要内容
腾讯混元模型 API (Hunyuan API) 实现了对话通信、内容生成、分析和理解,可广泛应用于智能客服、智能营销、角色扮演、广告文案、产品描述、剧本创作、简历生成、文章写作、代码生成、数据分析、内容分析等多种场景。
欲了解更多详情,请参阅更多信息
from langchain_community.chat_models import ChatHunyuan
from langchain.messages 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.")

使用带有流式传输的 ChatHunyuan

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.")

以编程方式连接这些文档到 Claude、VSCode 等,通过 MCP 获取实时答案。
© . This site is unofficial and not affiliated with LangChain, Inc.