Skip to main content
本指南将帮助您开始使用 DeepSeek’s hosted 聊天模型.
API 参考有关所有 features and configuration options, 请前往 ChatDeepSeek API reference.
DeepSeek’s models are open source and can be run locally (e.g. in Ollama) or on other inference providers (e.g. Fireworks, Together) as well.

概述

集成详情

模型功能

DeepSeek-R1, specified via model="deepseek-reasoner", does not support tool calling or structured output. Those features are supported by DeepSeek-V3 (specified via model="deepseek-chat").

设置

要访问 DeepSeek 模型,您需要创建一个 DeepSeek 账户,获取 API 密钥,并安装 langchain-deepseek 集成包。

凭证

前往 DeepSeek’s API Key page 注册 DeepSeek 并生成 API 密钥。 完成后设置 DEEPSEEK_API_KEY 环境变量:
要启用模型调用的自动追踪,请设置您的 LangSmith API key:

安装

LangChain 的 DeepSeek 集成位于 langchain-deepseek 包中:

实例化

现在我们可以实例化模型对象并生成聊天补全:

调用


API 参考

有关所有 ChatDeepSeek 功能和配置的详细文档,请前往 API Reference.