Home / Function/ test_standard_params() — langchain Function Reference

test_standard_params() — langchain Function Reference

Architecture documentation for the test_standard_params() function in chat_models.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  d6217f0e_5b8e_ba78_45b6_4fdced275e18["test_standard_params()"]
  f4b40f56_1158_0e72_1cac_d0121e4eabd8["ChatModelUnitTests"]
  d6217f0e_5b8e_ba78_45b6_4fdced275e18 -->|defined in| f4b40f56_1158_0e72_1cac_d0121e4eabd8
  454c7bc0_b7ba_c01c_6607_87da05bdc994["chat_model_class()"]
  d6217f0e_5b8e_ba78_45b6_4fdced275e18 -->|calls| 454c7bc0_b7ba_c01c_6607_87da05bdc994
  style d6217f0e_5b8e_ba78_45b6_4fdced275e18 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/standard-tests/langchain_tests/unit_tests/chat_models.py lines 1069–1106

    def test_standard_params(self, model: BaseChatModel) -> None:
        """Test that model properly generates standard parameters.

        These are used for tracing purposes.

        ??? question "Troubleshooting"

            If this test fails, check that the model accommodates [standard parameters](https://docs.langchain.com/oss/python/langchain/models#parameters).

            Check also that the model class is named according to convention
            (e.g., `ChatProviderName`).
        """

        class ExpectedParams(BaseModel):
            ls_provider: str
            ls_model_name: str
            ls_model_type: Literal["chat"]
            ls_temperature: float | None = None
            ls_max_tokens: int | None = None
            ls_stop: list[str] | None = None

        ls_params = model._get_ls_params()
        try:
            ExpectedParams(**ls_params)
        except ValidationError as e:
            pytest.fail(f"Validation error: {e}")

        # Test optional params
        model = self.chat_model_class(
            max_tokens=10,
            stop=["test"],
            **self.chat_model_params,
        )
        ls_params = model._get_ls_params()
        try:
            ExpectedParams(**ls_params)
        except ValidationError as e:
            pytest.fail(f"Validation error: {e}")

Domain

Subdomains

Frequently Asked Questions

What does test_standard_params() do?
test_standard_params() is a function in the langchain codebase, defined in libs/standard-tests/langchain_tests/unit_tests/chat_models.py.
Where is test_standard_params() defined?
test_standard_params() is defined in libs/standard-tests/langchain_tests/unit_tests/chat_models.py at line 1069.
What does test_standard_params() call?
test_standard_params() calls 1 function(s): chat_model_class.

Analyze Your Own Codebase

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

Try Supermodel Free