Home / File/ test_chat_models_standard.py — langchain Source File

test_chat_models_standard.py — langchain Source File

Architecture documentation for test_chat_models_standard.py, a python file in the langchain codebase. 4 imports, 0 dependents.

Entity Profile

Dependency Diagram

graph LR
  60f14334_ddb1_e2e2_dae7_b636540df855["test_chat_models_standard.py"]
  120e2591_3e15_b895_72b6_cb26195e40a6["pytest"]
  60f14334_ddb1_e2e2_dae7_b636540df855 --> 120e2591_3e15_b895_72b6_cb26195e40a6
  ba43b74d_3099_7e1c_aac3_cf594720469e["langchain_core.language_models"]
  60f14334_ddb1_e2e2_dae7_b636540df855 --> ba43b74d_3099_7e1c_aac3_cf594720469e
  8f882798_3f47_fa1f_5253_3b7193f357a9["langchain_tests.integration_tests"]
  60f14334_ddb1_e2e2_dae7_b636540df855 --> 8f882798_3f47_fa1f_5253_3b7193f357a9
  eefab93e_c3f9_d0fd_c7a7_310371e9d16f["langchain_ollama.chat_models"]
  60f14334_ddb1_e2e2_dae7_b636540df855 --> eefab93e_c3f9_d0fd_c7a7_310371e9d16f
  style 60f14334_ddb1_e2e2_dae7_b636540df855 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

"""Test chat model integration using standard integration tests."""

import pytest
from langchain_core.language_models import BaseChatModel
from langchain_tests.integration_tests import ChatModelIntegrationTests

from langchain_ollama.chat_models import ChatOllama

DEFAULT_MODEL_NAME = "llama3.1"


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)

Subdomains

Classes

Dependencies

  • langchain_core.language_models
  • langchain_ollama.chat_models
  • langchain_tests.integration_tests
  • pytest

Frequently Asked Questions

What does test_chat_models_standard.py do?
test_chat_models_standard.py is a source file in the langchain codebase, written in python. It belongs to the CoreAbstractions domain, MessageSchema subdomain.
What does test_chat_models_standard.py depend on?
test_chat_models_standard.py imports 4 module(s): langchain_core.language_models, langchain_ollama.chat_models, langchain_tests.integration_tests, pytest.
Where is test_chat_models_standard.py in the architecture?
test_chat_models_standard.py is located at libs/partners/ollama/tests/integration_tests/chat_models/test_chat_models_standard.py (domain: CoreAbstractions, subdomain: MessageSchema, directory: libs/partners/ollama/tests/integration_tests/chat_models).

Analyze Your Own Codebase

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

Try Supermodel Free