Home / Function/ test_pdf_document_input() — langchain Function Reference

test_pdf_document_input() — langchain Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  5b6dc286_e2a3_c5a7_c10a_0440cca8036e["test_pdf_document_input()"]
  f27640dd_3870_5548_d153_f9504ae1021f["test_chat_models.py"]
  5b6dc286_e2a3_c5a7_c10a_0440cca8036e -->|defined in| f27640dd_3870_5548_d153_f9504ae1021f
  style 5b6dc286_e2a3_c5a7_c10a_0440cca8036e fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/partners/anthropic/tests/integration_tests/test_chat_models.py lines 864–887

def test_pdf_document_input() -> None:
    url = "https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf"
    data = b64encode(requests.get(url, timeout=10).content).decode()

    result = ChatAnthropic(model=MODEL_NAME).invoke(  # type: ignore[call-arg]
        [
            HumanMessage(
                [
                    "summarize this document",
                    {
                        "type": "document",
                        "source": {
                            "type": "base64",
                            "data": data,
                            "media_type": "application/pdf",
                        },
                    },
                ],
            ),
        ],
    )
    assert isinstance(result, AIMessage)
    assert isinstance(result.content, str)
    assert len(result.content) > 0

Domain

Subdomains

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free