TestChatDeepSeekStrictMode Class — langchain Architecture
Architecture documentation for the TestChatDeepSeekStrictMode class in test_chat_models.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD 9e1e7e05_fcb9_6888_687f_284ccfd65fd2["TestChatDeepSeekStrictMode"] 301fa0ae_de30_4ab3_5608_03e6f7c1816a["SampleTool"] 9e1e7e05_fcb9_6888_687f_284ccfd65fd2 -->|extends| 301fa0ae_de30_4ab3_5608_03e6f7c1816a 5ea44688_e61e_5f0e_f4f7_57f0ea8b7bb6["test_chat_models.py"] 9e1e7e05_fcb9_6888_687f_284ccfd65fd2 -->|defined in| 5ea44688_e61e_5f0e_f4f7_57f0ea8b7bb6 a2aaaacb_b7a1_a3b7_49a5_a148639d3607["test_bind_tools_with_strict_mode_uses_beta_endpoint()"] 9e1e7e05_fcb9_6888_687f_284ccfd65fd2 -->|method| a2aaaacb_b7a1_a3b7_49a5_a148639d3607 c57eb4e1_c465_0425_9e4e_0a395cb64508["test_bind_tools_without_strict_mode_uses_default_endpoint()"] 9e1e7e05_fcb9_6888_687f_284ccfd65fd2 -->|method| c57eb4e1_c465_0425_9e4e_0a395cb64508 11de7eb7_356d_4d20_ba73_042a1a387ece["test_with_structured_output_strict_mode_uses_beta_endpoint()"] 9e1e7e05_fcb9_6888_687f_284ccfd65fd2 -->|method| 11de7eb7_356d_4d20_ba73_042a1a387ece
Relationship Graph
Source Code
libs/partners/deepseek/tests/unit_tests/test_chat_models.py lines 254–309
class TestChatDeepSeekStrictMode:
"""Tests for DeepSeek strict mode support.
This tests the experimental beta feature that uses the beta API endpoint
when `strict=True` is used. These tests can be removed when strict mode
becomes stable in the default base API.
"""
def test_bind_tools_with_strict_mode_uses_beta_endpoint(self) -> None:
"""Test that bind_tools with strict=True uses the beta endpoint."""
llm = ChatDeepSeek(
model="deepseek-chat",
api_key=SecretStr("test_key"),
)
# Verify default endpoint
assert llm.api_base == DEFAULT_API_BASE
# Bind tools with strict=True
bound_model = llm.bind_tools([SampleTool], strict=True)
# The bound model should have its internal model using beta endpoint
# We can't directly access the internal model, but we can verify the behavior
# by checking that the binding operation succeeds
assert bound_model is not None
def test_bind_tools_without_strict_mode_uses_default_endpoint(self) -> None:
"""Test bind_tools without strict or with strict=False uses default endpoint."""
llm = ChatDeepSeek(
model="deepseek-chat",
api_key=SecretStr("test_key"),
)
# Test with strict=False
bound_model_false = llm.bind_tools([SampleTool], strict=False)
assert bound_model_false is not None
# Test with strict=None (default)
bound_model_none = llm.bind_tools([SampleTool])
assert bound_model_none is not None
def test_with_structured_output_strict_mode_uses_beta_endpoint(self) -> None:
"""Test that with_structured_output with strict=True uses beta endpoint."""
llm = ChatDeepSeek(
model="deepseek-chat",
api_key=SecretStr("test_key"),
)
# Verify default endpoint
assert llm.api_base == DEFAULT_API_BASE
# Create structured output with strict=True
structured_model = llm.with_structured_output(SampleTool, strict=True)
# The structured model should work with beta endpoint
assert structured_model is not None
Extends
Source
Frequently Asked Questions
What is the TestChatDeepSeekStrictMode class?
TestChatDeepSeekStrictMode is a class in the langchain codebase, defined in libs/partners/deepseek/tests/unit_tests/test_chat_models.py.
Where is TestChatDeepSeekStrictMode defined?
TestChatDeepSeekStrictMode is defined in libs/partners/deepseek/tests/unit_tests/test_chat_models.py at line 254.
What does TestChatDeepSeekStrictMode extend?
TestChatDeepSeekStrictMode extends SampleTool.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free