本页还没有译文
本页 23 段还没译成Español,下面显示的是英文原文。ChatDeepSeek integration
还没翻译译自英文(docs.langchain.com)本页 23 段都还没译
This will help you get started with DeepSeek's hosted chat models.
Tip
API Reference
For detailed documentation of all features and configuration options, head to the ChatDeepSeek API reference.
Overview
Integration details
| Class | Package | Serializable | JS support | Downloads | Version |
|---|---|---|---|---|---|
ChatDeepSeek | langchain-deepseek | beta | ✅ |
Model features
| Tool calling | Structured output | Image input | Audio input | Video input | Token-level streaming | Native async | Token usage | Logprobs |
|---|---|---|---|---|---|---|---|---|
| ✅ | ✅ | ❌ | ❌ | ❌ | ✅ | ✅ | ✅ | ❌ |
Note
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").
Setup
To access DeepSeek models you'll need to create a DeepSeek account, get an API key, and install the langchain-deepseek integration package.
Credentials
Head to DeepSeek's API Key page to sign up to DeepSeek and generate an API key. Once you've done this set the DEEPSEEK_API_KEY environment variable:
import getpass
import os
if not os.getenv("DEEPSEEK_API_KEY"):
os.environ["DEEPSEEK_API_KEY"] = getpass.getpass("Enter your DeepSeek API key: ")To enable automated tracing of your model calls, set your LangSmith API key:
os.environ["LANGSMITH_TRACING"] = "true"
os.environ["LANGSMITH_API_KEY"] = getpass.getpass("Enter your LangSmith API key: ")Installation
The LangChain DeepSeek integration lives in the langchain-deepseek package:
pip install -qU langchain-deepseekInstantiation
Now we can instantiate our model object and generate chat completions:
from langchain_deepseek import ChatDeepSeek
llm = ChatDeepSeek(
model="deepseek-chat",
temperature=0,
max_tokens=None,
timeout=None,
max_retries=2,
# other params...
)Invocation
messages = [
(
"system",
"You are a helpful assistant that translates English to French. Translate the user sentence.",
),
("human", "I love programming."),
]
ai_msg = llm.invoke(messages)
ai_msg.contentAPI reference
For detailed documentation of all ChatDeepSeek features and configurations head to the API Reference.