Home / Function/ test_files_api_image() — langchain Function Reference

test_files_api_image() — langchain Function Reference

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

Entity Profile

Dependency Diagram

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

Relationship Graph

Source Code

libs/partners/anthropic/tests/integration_tests/test_chat_models.py lines 1857–1890

def test_files_api_image(block_format: str) -> None:
    """Note: this is a beta feature.

    TODO: Update to remove beta once generally available.
    """
    image_file_id = os.getenv("ANTHROPIC_FILES_API_IMAGE_ID")
    if not image_file_id:
        pytest.skip()
    llm = ChatAnthropic(
        model=MODEL_NAME,  # type: ignore[call-arg]
        betas=["files-api-2025-04-14"],
    )
    if block_format == "anthropic":
        block = {
            "type": "image",
            "source": {
                "type": "file",
                "file_id": image_file_id,
            },
        }
    else:
        # standard block format
        block = {
            "type": "image",
            "file_id": image_file_id,
        }
    input_message = {
        "role": "user",
        "content": [
            {"type": "text", "text": "Describe this image."},
            block,
        ],
    }
    _ = llm.invoke([input_message])

Domain

Subdomains

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free