Home / Function/ test_message_with_name() — langchain Function Reference

test_message_with_name() — langchain Function Reference

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

Entity Profile

Dependency Diagram

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

Relationship Graph

Source Code

libs/standard-tests/langchain_tests/integration_tests/chat_models.py lines 3208–3230

    def test_message_with_name(self, model: BaseChatModel) -> None:
        """Test that `HumanMessage` with values for the `name` field can be handled.

        These messages may take the form:

        ```python
        HumanMessage("hello", name="example_user")
        ```

        If possible, the `name` field should be parsed and passed appropriately
        to the model. Otherwise, it should be ignored.

        ??? question "Troubleshooting"

            If this test fails, check that the `name` field on `HumanMessage`
            objects is either ignored or passed to the model appropriately.

        """
        result = model.invoke([HumanMessage("hello", name="example_user")])
        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_message_with_name() do?
test_message_with_name() is a function in the langchain codebase, defined in libs/standard-tests/langchain_tests/integration_tests/chat_models.py.
Where is test_message_with_name() defined?
test_message_with_name() is defined in libs/standard-tests/langchain_tests/integration_tests/chat_models.py at line 3208.

Analyze Your Own Codebase

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

Try Supermodel Free