Home / Function/ test_create_chat_result_with_model_extra_reasoning() — langchain Function Reference

test_create_chat_result_with_model_extra_reasoning() — langchain Function Reference

Architecture documentation for the test_create_chat_result_with_model_extra_reasoning() function in test_chat_models.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  38125966_3c35_be8e_95aa_e13bf1fbd650["test_create_chat_result_with_model_extra_reasoning()"]
  530201c5_d88b_5d70_4ba9_c13da0c872e6["TestChatDeepSeekCustomUnit"]
  38125966_3c35_be8e_95aa_e13bf1fbd650 -->|defined in| 530201c5_d88b_5d70_4ba9_c13da0c872e6
  style 38125966_3c35_be8e_95aa_e13bf1fbd650 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/partners/deepseek/tests/unit_tests/test_chat_models.py lines 125–145

    def test_create_chat_result_with_model_extra_reasoning(self) -> None:
        """Test that reasoning is properly extracted from `model_extra`."""
        chat_model = ChatDeepSeek(model=MODEL_NAME, api_key=SecretStr("api_key"))
        mock_message = MagicMock(spec=ChatCompletionMessage)
        mock_message.content = "Main content"
        mock_message.role = "assistant"
        mock_message.model_extra = {"reasoning": "This is the reasoning"}
        mock_message.model_dump.return_value = {
            "role": "assistant",
            "content": "Main content",
            "model_extra": {"reasoning": "This is the reasoning"},
        }
        mock_choice = MagicMock()
        mock_choice.message = mock_message
        mock_response = MockOpenAIResponse(choices=[mock_choice], error=None)

        result = chat_model._create_chat_result(mock_response)
        assert (
            result.generations[0].message.additional_kwargs.get("reasoning_content")
            == "This is the reasoning"
        )

Domain

Subdomains

Frequently Asked Questions

What does test_create_chat_result_with_model_extra_reasoning() do?
test_create_chat_result_with_model_extra_reasoning() is a function in the langchain codebase, defined in libs/partners/deepseek/tests/unit_tests/test_chat_models.py.
Where is test_create_chat_result_with_model_extra_reasoning() defined?
test_create_chat_result_with_model_extra_reasoning() is defined in libs/partners/deepseek/tests/unit_tests/test_chat_models.py at line 125.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free