Home / Function/ test_double_messages_conversation() — langchain Function Reference

test_double_messages_conversation() — langchain Function Reference

Architecture documentation for the test_double_messages_conversation() function in chat_models.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  f3b5126b_ea53_a792_8e01_0bae09b4286b["test_double_messages_conversation()"]
  971e928f_9c9b_ce7a_b93d_e762f2f5aa54["ChatModelIntegrationTests"]
  f3b5126b_ea53_a792_8e01_0bae09b4286b -->|defined in| 971e928f_9c9b_ce7a_b93d_e762f2f5aa54
  style f3b5126b_ea53_a792_8e01_0bae09b4286b fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/standard-tests/langchain_tests/integration_tests/chat_models.py lines 1129–1167

    def test_double_messages_conversation(self, model: BaseChatModel) -> None:
        """Test to verify that the model can handle double-message conversations.

        This should pass for all integrations. Tests the model's ability to process
        a sequence of double-system, double-human, and double-ai messages as context
        for generating the next response.

        ??? question "Troubleshooting"

            First, debug
            `langchain_tests.integration_tests.chat_models.ChatModelIntegrationTests.test_invoke`
            because this test also uses `model.invoke`.

            Second, debug
            `langchain_tests.integration_tests.chat_models.ChatModelIntegrationTests.test_conversation`
            because this test is the "basic case" without double messages.

            If that test passes those but not this one, you should verify that:

            1. Your model API can handle double messages, or the integration should
                merge messages before sending them to the API.
            2. The response is a valid `langchain_core.messages.AIMessage`

        """
        messages = [
            SystemMessage("hello"),
            SystemMessage("hello"),
            HumanMessage("hello"),
            HumanMessage("hello"),
            AIMessage("hello"),
            AIMessage("hello"),
            HumanMessage("how are you"),
        ]

        result = model.invoke(messages)
        assert result is not None
        assert isinstance(result, AIMessage)
        assert isinstance(result.text, str)
        assert len(result.content) > 0

Domain

Subdomains

Frequently Asked Questions

What does test_double_messages_conversation() do?
test_double_messages_conversation() is a function in the langchain codebase, defined in libs/standard-tests/langchain_tests/integration_tests/chat_models.py.
Where is test_double_messages_conversation() defined?
test_double_messages_conversation() is defined in libs/standard-tests/langchain_tests/integration_tests/chat_models.py at line 1129.

Analyze Your Own Codebase

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

Try Supermodel Free