mirror of
https://github.com/hwchase17/langchain.git
synced 2025-08-13 22:59:05 +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."""
|
||||
return {}
|
||||
|
||||
@property
|
||||
def chat_model_model_param(self) -> dict:
|
||||
return self.chat_model_params.get("model", "test-model-name")
|
||||
|
||||
@property
|
||||
def standard_chat_model_params(self) -> dict:
|
||||
""":private:"""
|
||||
@ -521,6 +525,29 @@ class ChatModelUnitTests(ChatModelTests):
|
||||
)
|
||||
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:
|
||||
"""Test initialization from environment variables. Relies on the
|
||||
``init_from_env_params`` property. Test is skipped if that property is not
|
||||
|
Loading…
Reference in New Issue
Block a user