From a9e9d409437c3b3266f7847c864f7b322caa108b Mon Sep 17 00:00:00 2001 From: Andrew Wason Date: Sat, 4 Jan 2025 13:49:51 -0500 Subject: [PATCH] mypy fix --- src/langchain_mcp/toolkit.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/langchain_mcp/toolkit.py b/src/langchain_mcp/toolkit.py index 8eb7174..dc0da0a 100644 --- a/src/langchain_mcp/toolkit.py +++ b/src/langchain_mcp/toolkit.py @@ -68,7 +68,7 @@ def get_tools(self) -> list[BaseTool]: } -def configure_field(name: str, type_: dict[str, t.Any], required: list[str]) -> t.Tuple[type, t.Any]: +def configure_field(name: str, type_: dict[str, t.Any], required: list[str]) -> tuple[type, t.Any]: field_type = TYPEMAP[type_["type"]] default_ = FIELD_DEFAULTS.get(field_type) if name not in required else ... return field_type, default_ @@ -90,7 +90,9 @@ def __get_pydantic_json_schema__( # Since this langchain patch, we need to synthesize pydantic fields from the schema # https://github.com/langchain-ai/langchain/commit/033ac417609297369eb0525794d8b48a425b8b33 required = schema.get("required", []) - fields = {name: configure_field(name, type_, required) for name, type_ in schema["properties"].items()} + fields: dict[str, t.Any] = { + name: configure_field(name, type_, required) for name, type_ in schema["properties"].items() + } return pydantic.create_model("Schema", __base__=SchemaBase, **fields)