Home / Class/ TestAnthropicStandard Class — langchain Architecture

TestAnthropicStandard Class — langchain Architecture

Architecture documentation for the TestAnthropicStandard class in test_standard.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  c3a3c277_9cf7_2326_165f_554aee9ad2a1["TestAnthropicStandard"]
  971e928f_9c9b_ce7a_b93d_e762f2f5aa54["ChatModelIntegrationTests"]
  c3a3c277_9cf7_2326_165f_554aee9ad2a1 -->|extends| 971e928f_9c9b_ce7a_b93d_e762f2f5aa54
  2880dbd6_e774_85c2_83e2_8529a7770a73["test_standard.py"]
  c3a3c277_9cf7_2326_165f_554aee9ad2a1 -->|defined in| 2880dbd6_e774_85c2_83e2_8529a7770a73
  741b5874_bfe3_cc5e_e16e_8a030f593b5f["chat_model_class()"]
  c3a3c277_9cf7_2326_165f_554aee9ad2a1 -->|method| 741b5874_bfe3_cc5e_e16e_8a030f593b5f
  e450202a_d22b_7b2c_4418_690e77dce23a["chat_model_params()"]
  c3a3c277_9cf7_2326_165f_554aee9ad2a1 -->|method| e450202a_d22b_7b2c_4418_690e77dce23a
  6d688758_3d6a_6ec6_b874_e80a6e7bb0af["supports_image_inputs()"]
  c3a3c277_9cf7_2326_165f_554aee9ad2a1 -->|method| 6d688758_3d6a_6ec6_b874_e80a6e7bb0af
  1ebf6454_f711_a54b_58be_63bd06e9a3b9["supports_image_urls()"]
  c3a3c277_9cf7_2326_165f_554aee9ad2a1 -->|method| 1ebf6454_f711_a54b_58be_63bd06e9a3b9
  b709a32a_b0b3_f8d3_ca1c_dc509cd1f2c1["supports_pdf_inputs()"]
  c3a3c277_9cf7_2326_165f_554aee9ad2a1 -->|method| b709a32a_b0b3_f8d3_ca1c_dc509cd1f2c1
  fafd7c9c_0fb9_a730_f0c2_4283b0c816e6["supports_image_tool_message()"]
  c3a3c277_9cf7_2326_165f_554aee9ad2a1 -->|method| fafd7c9c_0fb9_a730_f0c2_4283b0c816e6
  99e644c0_d0ac_714a_5e0e_00fc4f8f9920["supports_pdf_tool_message()"]
  c3a3c277_9cf7_2326_165f_554aee9ad2a1 -->|method| 99e644c0_d0ac_714a_5e0e_00fc4f8f9920
  ceabf5b0_5ecb_5d9e_5a71_171defde7f7c["supports_anthropic_inputs()"]
  c3a3c277_9cf7_2326_165f_554aee9ad2a1 -->|method| ceabf5b0_5ecb_5d9e_5a71_171defde7f7c
  96fefcde_d36e_419b_02de_8d2a76896544["enable_vcr_tests()"]
  c3a3c277_9cf7_2326_165f_554aee9ad2a1 -->|method| 96fefcde_d36e_419b_02de_8d2a76896544
  9dfa5bfe_c65b_c41a_a477_c77e5553685c["supported_usage_metadata_details()"]
  c3a3c277_9cf7_2326_165f_554aee9ad2a1 -->|method| 9dfa5bfe_c65b_c41a_a477_c77e5553685c
  a9b24974_52fe_18d4_5d31_09090bacb9a5["invoke_with_cache_creation_input()"]
  c3a3c277_9cf7_2326_165f_554aee9ad2a1 -->|method| a9b24974_52fe_18d4_5d31_09090bacb9a5
  cdc99555_09b8_a41a_6a84_2593190a2245["invoke_with_cache_read_input()"]
  c3a3c277_9cf7_2326_165f_554aee9ad2a1 -->|method| cdc99555_09b8_a41a_6a84_2593190a2245

Relationship Graph

Source Code

libs/partners/anthropic/tests/integration_tests/test_standard.py lines 18–149

class TestAnthropicStandard(ChatModelIntegrationTests):
    """Use standard chat model integration tests against the `ChatAnthropic` class."""

    @property
    def chat_model_class(self) -> type[BaseChatModel]:
        return ChatAnthropic

    @property
    def chat_model_params(self) -> dict:
        return {"model": MODEL}

    @property
    def supports_image_inputs(self) -> bool:
        return True

    @property
    def supports_image_urls(self) -> bool:
        return True

    @property
    def supports_pdf_inputs(self) -> bool:
        return True

    @property
    def supports_image_tool_message(self) -> bool:
        return True

    @property
    def supports_pdf_tool_message(self) -> bool:
        return True

    @property
    def supports_anthropic_inputs(self) -> bool:
        return True

    @property
    def enable_vcr_tests(self) -> bool:
        return True

    @property
    def supported_usage_metadata_details(
        self,
    ) -> dict[
        Literal["invoke", "stream"],
        list[
            Literal[
                "audio_input",
                "audio_output",
                "reasoning_output",
                "cache_read_input",
                "cache_creation_input",
            ]
        ],
    ]:
        return {
            "invoke": ["cache_read_input", "cache_creation_input"],
            "stream": ["cache_read_input", "cache_creation_input"],
        }

    def invoke_with_cache_creation_input(self, *, stream: bool = False) -> AIMessage:
        llm = ChatAnthropic(
            model=MODEL,  # type: ignore[call-arg]
        )
        with Path.open(REPO_ROOT_DIR / "README.md") as f:
            readme = f.read()

        input_ = f"""What's langchain? Here's the langchain README:

        {readme}
        """
        return _invoke(
            llm,
            [
                {
                    "role": "user",
                    "content": [
                        {
                            "type": "text",
                            "text": input_,
                            "cache_control": {"type": "ephemeral"},
                        },

Frequently Asked Questions

What is the TestAnthropicStandard class?
TestAnthropicStandard is a class in the langchain codebase, defined in libs/partners/anthropic/tests/integration_tests/test_standard.py.
Where is TestAnthropicStandard defined?
TestAnthropicStandard is defined in libs/partners/anthropic/tests/integration_tests/test_standard.py at line 18.
What does TestAnthropicStandard extend?
TestAnthropicStandard extends ChatModelIntegrationTests.

Analyze Your Own Codebase

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

Try Supermodel Free