Home / Function/ test__format_messages_with_citations() — langchain Function Reference

test__format_messages_with_citations() — langchain Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  0383cf87_18fb_4d67_75b5_6de3e1859388["test__format_messages_with_citations()"]
  18428dc5_a41b_90c6_88ad_615296ee3311["test_chat_models.py"]
  0383cf87_18fb_4d67_75b5_6de3e1859388 -->|defined in| 18428dc5_a41b_90c6_88ad_615296ee3311
  style 0383cf87_18fb_4d67_75b5_6de3e1859388 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/partners/anthropic/tests/unit_tests/test_chat_models.py lines 1108–1142

def test__format_messages_with_citations() -> None:
    input_messages = [
        HumanMessage(
            content=[
                {
                    "type": "file",
                    "source_type": "text",
                    "text": "The grass is green. The sky is blue.",
                    "mime_type": "text/plain",
                    "citations": {"enabled": True},
                },
                {"type": "text", "text": "What color is the grass and sky?"},
            ],
        ),
    ]
    expected_messages = [
        {
            "role": "user",
            "content": [
                {
                    "type": "document",
                    "source": {
                        "type": "text",
                        "media_type": "text/plain",
                        "data": "The grass is green. The sky is blue.",
                    },
                    "citations": {"enabled": True},
                },
                {"type": "text", "text": "What color is the grass and sky?"},
            ],
        },
    ]
    actual_system, actual_messages = _format_messages(input_messages)
    assert actual_system is None
    assert actual_messages == expected_messages

Domain

Subdomains

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free