mirror of
https://github.com/hwchase17/langchain.git
synced 2025-08-19 09:30:15 +00:00
[fix]: Tests
This commit is contained in:
parent
099ed443f3
commit
c888ea409c
@ -1082,7 +1082,7 @@ def get_all_basemodel_annotations(
|
|||||||
for name, param in cls.model_fields.items():
|
for name, param in cls.model_fields.items():
|
||||||
if param.alias and param.alias != name:
|
if param.alias and param.alias != name:
|
||||||
warnings.warn(
|
warnings.warn(
|
||||||
f"Field '{name}' has alias '{param.alias}'. The alias will be used instead of the field name.",
|
f"Field '{name}' has alias '{param.alias}'. The alias will be used in tool schema instead of the field name.",
|
||||||
stacklevel=2
|
stacklevel=2
|
||||||
)
|
)
|
||||||
for name, param in inspect.signature(cls).parameters.items():
|
for name, param in inspect.signature(cls).parameters.items():
|
||||||
|
@ -2709,5 +2709,5 @@ def test_get_all_basemodel_annotations_warning() -> None:
|
|||||||
class ModelWithAlias(BaseModel):
|
class ModelWithAlias(BaseModel):
|
||||||
field_with_alias: str = Field(alias="alias_field")
|
field_with_alias: str = Field(alias="alias_field")
|
||||||
|
|
||||||
with pytest.warns(UserWarning, match="Field 'field_with_alias' has alias 'alias_field'. The alias will be used instead of the field name."):
|
with pytest.warns(UserWarning, match="Field 'field_with_alias' has alias 'alias_field'. The alias will be used in tool schema instead of the field name."):
|
||||||
get_all_basemodel_annotations(ModelWithAlias)
|
get_all_basemodel_annotations(ModelWithAlias)
|
||||||
|
Loading…
Reference in New Issue
Block a user