_get_request_payload() — langchain Function Reference
Architecture documentation for the _get_request_payload() function in chat_models.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD c47b3765_db6e_5e49_7f83_88810118f15c["_get_request_payload()"] f3181e26_0568_4993_612c_5b8d73ad3c37["ChatDeepSeek"] c47b3765_db6e_5e49_7f83_88810118f15c -->|defined in| f3181e26_0568_4993_612c_5b8d73ad3c37 style c47b3765_db6e_5e49_7f83_88810118f15c fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
libs/partners/deepseek/langchain_deepseek/chat_models.py lines 257–279
def _get_request_payload(
self,
input_: LanguageModelInput,
*,
stop: list[str] | None = None,
**kwargs: Any,
) -> dict:
payload = super()._get_request_payload(input_, stop=stop, **kwargs)
for message in payload["messages"]:
if message["role"] == "tool" and isinstance(message["content"], list):
message["content"] = json.dumps(message["content"])
elif message["role"] == "assistant" and isinstance(
message["content"], list
):
# DeepSeek API expects assistant content to be a string, not a list.
# Extract text blocks and join them, or use empty string if none exist.
text_parts = [
block.get("text", "")
for block in message["content"]
if isinstance(block, dict) and block.get("type") == "text"
]
message["content"] = "".join(text_parts) if text_parts else ""
return payload
Domain
Subdomains
Source
Frequently Asked Questions
What does _get_request_payload() do?
_get_request_payload() is a function in the langchain codebase, defined in libs/partners/deepseek/langchain_deepseek/chat_models.py.
Where is _get_request_payload() defined?
_get_request_payload() is defined in libs/partners/deepseek/langchain_deepseek/chat_models.py at line 257.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free