Home / Class/ TestChatOllama Class — langchain Architecture

TestChatOllama Class — langchain Architecture

Architecture documentation for the TestChatOllama class in test_chat_models_standard.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  67c98f71_98c8_ee70_5890_4801ea888ea7["TestChatOllama"]
  971e928f_9c9b_ce7a_b93d_e762f2f5aa54["ChatModelIntegrationTests"]
  67c98f71_98c8_ee70_5890_4801ea888ea7 -->|extends| 971e928f_9c9b_ce7a_b93d_e762f2f5aa54
  0d9149da_b2f7_7953_4a7a_a544960ae920["test_chat_models_standard.py"]
  67c98f71_98c8_ee70_5890_4801ea888ea7 -->|defined in| 0d9149da_b2f7_7953_4a7a_a544960ae920
  8393eb7a_327f_700f_e0ae_6de46553496a["chat_model_class()"]
  67c98f71_98c8_ee70_5890_4801ea888ea7 -->|method| 8393eb7a_327f_700f_e0ae_6de46553496a
  3bb1b77a_73f5_1a9c_8dd8_645eec845b0c["chat_model_params()"]
  67c98f71_98c8_ee70_5890_4801ea888ea7 -->|method| 3bb1b77a_73f5_1a9c_8dd8_645eec845b0c
  34eb7892_1bc7_2e3b_bec0_bdf3ee73d814["supports_json_mode()"]
  67c98f71_98c8_ee70_5890_4801ea888ea7 -->|method| 34eb7892_1bc7_2e3b_bec0_bdf3ee73d814
  28c6af1a_cde5_2d96_ef3f_43035489fb48["has_tool_choice()"]
  67c98f71_98c8_ee70_5890_4801ea888ea7 -->|method| 28c6af1a_cde5_2d96_ef3f_43035489fb48
  9ed0191e_4c1a_faf2_b61f_58c53f798ce3["supports_image_inputs()"]
  67c98f71_98c8_ee70_5890_4801ea888ea7 -->|method| 9ed0191e_4c1a_faf2_b61f_58c53f798ce3
  9ce73b59_3d97_c956_e458_af31a78f8560["test_tool_calling()"]
  67c98f71_98c8_ee70_5890_4801ea888ea7 -->|method| 9ce73b59_3d97_c956_e458_af31a78f8560
  1a641317_f975_0f84_d749_2f8631752898["test_tool_calling_async()"]
  67c98f71_98c8_ee70_5890_4801ea888ea7 -->|method| 1a641317_f975_0f84_d749_2f8631752898
  b92f387a_c8e1_950e_fb7f_ccdeacabf4c2["test_tool_calling_with_no_arguments()"]
  67c98f71_98c8_ee70_5890_4801ea888ea7 -->|method| b92f387a_c8e1_950e_fb7f_ccdeacabf4c2

Relationship Graph

Source Code

libs/partners/ollama/tests/integration_tests/chat_models/test_chat_models_standard.py lines 12–62

class TestChatOllama(ChatModelIntegrationTests):
    @property
    def chat_model_class(self) -> type[ChatOllama]:
        return ChatOllama

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

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

    @property
    def has_tool_choice(self) -> bool:
        # TODO: update after Ollama implements
        # https://github.com/ollama/ollama/blob/main/docs/openai.md#supported-request-fields
        return False

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

    @pytest.mark.xfail(
        reason=(
            "Will sometime encounter AssertionErrors where tool responses are "
            "`'3'` instead of `3`"
        )
    )
    def test_tool_calling(self, model: BaseChatModel) -> None:
        super().test_tool_calling(model)

    @pytest.mark.xfail(
        reason=(
            "Will sometime encounter AssertionErrors where tool responses are "
            "`'3'` instead of `3`"
        )
    )
    async def test_tool_calling_async(self, model: BaseChatModel) -> None:
        await super().test_tool_calling_async(model)

    @pytest.mark.xfail(
        reason=(
            "Will sometimes fail due to Ollama's inconsistent tool call argument "
            "structure (see https://github.com/ollama/ollama/issues/6155). "
            "Args may contain unexpected keys like 'conversations' instead of "
            "empty dict."
        )
    )
    def test_tool_calling_with_no_arguments(self, model: BaseChatModel) -> None:
        super().test_tool_calling_with_no_arguments(model)

Frequently Asked Questions

What is the TestChatOllama class?
TestChatOllama is a class in the langchain codebase, defined in libs/partners/ollama/tests/integration_tests/chat_models/test_chat_models_standard.py.
Where is TestChatOllama defined?
TestChatOllama is defined in libs/partners/ollama/tests/integration_tests/chat_models/test_chat_models_standard.py at line 12.
What does TestChatOllama extend?
TestChatOllama extends ChatModelIntegrationTests.

Analyze Your Own Codebase

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

Try Supermodel Free