standard-tests[patch]: resolve pydantic warnings (#26190)

This commit is contained in:
Bagatur
2024-09-09 10:34:57 -07:00
committed by GitHub
parent b8fc82b84b
commit 71268f7a15
4 changed files with 15 additions and 3 deletions

View File

@@ -79,7 +79,8 @@ def my_adder(a: int, b: int) -> int:
class ChatModelTests(BaseStandardTests):
@property
@abstractmethod
def chat_model_class(self) -> Type[BaseChatModel]: ...
def chat_model_class(self) -> Type[BaseChatModel]:
...
@property
def chat_model_params(self) -> dict:
@@ -187,7 +188,12 @@ class ChatModelUnitTests(ChatModelTests):
tools = [my_adder_tool, my_adder]
for pydantic_model in TEST_PYDANTIC_MODELS:
tools.extend([pydantic_model, pydantic_model.schema()])
model_schema = (
pydantic_model.model_json_schema()
if hasattr(pydantic_model, "model_json_schema")
else pydantic_model.schema()
)
tools.extend([pydantic_model, model_schema])
# Doing a mypy ignore here since some of the tools are from pydantic
# BaseModel 2 which isn't typed properly yet. This will need to be fixed