mirror of
https://github.com/hwchase17/langchain.git
synced 2025-08-17 00:17:47 +00:00
standard-tests: model param test
This commit is contained in:
parent
621bba7e26
commit
6d58ccb013
@ -85,6 +85,10 @@ class ChatModelTests(BaseStandardTests):
|
|||||||
"""Initialization parameters for the chat model."""
|
"""Initialization parameters for the chat model."""
|
||||||
return {}
|
return {}
|
||||||
|
|
||||||
|
@property
|
||||||
|
def chat_model_model_param(self) -> dict:
|
||||||
|
return self.chat_model_params.get("model", "test-model-name")
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def standard_chat_model_params(self) -> dict:
|
def standard_chat_model_params(self) -> dict:
|
||||||
""":private:"""
|
""":private:"""
|
||||||
@ -521,6 +525,29 @@ class ChatModelUnitTests(ChatModelTests):
|
|||||||
)
|
)
|
||||||
assert model is not None
|
assert model is not None
|
||||||
|
|
||||||
|
def test_model_param_name(self) -> None:
|
||||||
|
"""Tests model initializatiokn with a model= parameter. This should pass for all
|
||||||
|
integrations.
|
||||||
|
|
||||||
|
.. dropdown:: Troubleshooting
|
||||||
|
|
||||||
|
If this test fails, ensure that the model can be initialized with a
|
||||||
|
``model`` parameter, and that the model parameter can be accessed as
|
||||||
|
``.model``.
|
||||||
|
"""
|
||||||
|
params = {
|
||||||
|
**self.standard_chat_model_params,
|
||||||
|
**self.chat_model_params,
|
||||||
|
}
|
||||||
|
if "model_name" in params:
|
||||||
|
params["model"] = params.pop("model_name")
|
||||||
|
else:
|
||||||
|
params["model"] = self.chat_model_model_param
|
||||||
|
|
||||||
|
model = self.chat_model_class(**params)
|
||||||
|
assert model is not None
|
||||||
|
assert model.model == params["model"]
|
||||||
|
|
||||||
def test_init_from_env(self) -> None:
|
def test_init_from_env(self) -> None:
|
||||||
"""Test initialization from environment variables. Relies on the
|
"""Test initialization from environment variables. Relies on the
|
||||||
``init_from_env_params`` property. Test is skipped if that property is not
|
``init_from_env_params`` property. Test is skipped if that property is not
|
||||||
|
Loading…
Reference in New Issue
Block a user