Merge pull request #2910 from markparonyan/mypy-agent-copilot-utils

fix(typing): resolve mypy errors in agent.gns3_copilot.utils
This commit is contained in:
Jeremy Grossmann 2026-09-29 12:48:03 +02:00 committed by GitHub
commit 4bcaf596df
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 4 additions and 7 deletions

View File

@ -37,6 +37,7 @@ from typing import Dict
from langchain_core.messages import AIMessage
from langchain_core.messages import HumanMessage
from langchain_core.messages import SystemMessage
from langchain_core.messages import ToolCall
from langchain_core.messages import ToolMessage
@ -86,7 +87,7 @@ def convert_langchain_to_openai(lc_message) -> Dict[str, Any]:
tool_calls = []
for tc in lc_message.tool_calls:
# Convert to dict if it's an object
tc_dict = tc if isinstance(tc, dict) else tc.model_dump()
tc_dict = tc
tool_calls.append(
{
"id": tc_dict.get("id", str(uuid.uuid4())),
@ -139,7 +140,7 @@ def convert_openai_to_langchain(msg: Dict[str, Any]):
# Restore tool calls if present
if "tool_calls" in msg and msg["tool_calls"]:
tool_calls = []
tool_calls: list[ToolCall] = []
for tc in msg["tool_calls"]:
tool_calls.append(
{

View File

@ -214,9 +214,7 @@ def parse_tool_content(
return content
# Handle unsupported types
error_msg = ( # type: ignore[unreachable]
f"Content must be str, dict, list, int, float, bool, or None, got {type(content).__name__}"
)
error_msg = f"Content must be str, dict, list, int, float, bool, or None, got {type(content).__name__}"
logger.error(error_msg)
if strict_mode:

View File

@ -301,8 +301,6 @@ module = [
"gns3server.agent.gns3_copilot.tools_v2.gns3_stop_node", # 3
"gns3server.agent.gns3_copilot.tools_v2.gns3_suspend_node", # 3
"gns3server.agent.gns3_copilot.utils.custom_netmiko.scripts.list_netmiko_telnet_devices", # 1
"gns3server.agent.gns3_copilot.utils.message_converters", # 2
"gns3server.agent.gns3_copilot.utils.parse_tool_content", # 1
"gns3server.agent.mcp.appliances", # 1
"gns3server.agent.web_wireshark.docker_client", # 5
"gns3server.api.routes.compute.atm_switch_nodes", # 9