test_convert_chunk_with_reasoning() — langchain Function Reference
Architecture documentation for the test_convert_chunk_with_reasoning() function in test_chat_models.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD 5485b390_870b_f8b1_0fa2_58ec26a0dd43["test_convert_chunk_with_reasoning()"] 530201c5_d88b_5d70_4ba9_c13da0c872e6["TestChatDeepSeekCustomUnit"] 5485b390_870b_f8b1_0fa2_58ec26a0dd43 -->|defined in| 530201c5_d88b_5d70_4ba9_c13da0c872e6 style 5485b390_870b_f8b1_0fa2_58ec26a0dd43 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
libs/partners/deepseek/tests/unit_tests/test_chat_models.py lines 174–199
def test_convert_chunk_with_reasoning(self) -> None:
"""Test that reasoning is properly extracted from streaming chunk."""
chat_model = ChatDeepSeek(model=MODEL_NAME, api_key=SecretStr("api_key"))
chunk: dict[str, Any] = {
"choices": [
{
"delta": {
"content": "Main content",
"reasoning": "Streaming reasoning",
},
},
],
}
chunk_result = chat_model._convert_chunk_to_generation_chunk(
chunk,
AIMessageChunk,
None,
)
if chunk_result is None:
msg = "Expected chunk_result not to be None"
raise AssertionError(msg)
assert (
chunk_result.message.additional_kwargs.get("reasoning_content")
== "Streaming reasoning"
)
Domain
Subdomains
Source
Frequently Asked Questions
What does test_convert_chunk_with_reasoning() do?
test_convert_chunk_with_reasoning() is a function in the langchain codebase, defined in libs/partners/deepseek/tests/unit_tests/test_chat_models.py.
Where is test_convert_chunk_with_reasoning() defined?
test_convert_chunk_with_reasoning() is defined in libs/partners/deepseek/tests/unit_tests/test_chat_models.py at line 174.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free