Skip to content

Commit d41ad7d

Browse files
fix pylint issue
1 parent 5bda8f2 commit d41ad7d

4 files changed

Lines changed: 21 additions & 7 deletions

File tree

src/backend/app.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ async def lifespan(app: FastAPI):
9696
set_sql_agents(sql_agents)
9797
logger.info("SQL agents initialized successfully.")
9898

99-
except Exception as exc:
99+
except Exception: # noqa: BLE001
100100
logger.error("Failed to initialize SQL agents")
101101
# Don't raise the exception to allow the app to start even if agents fail
102102

@@ -115,7 +115,7 @@ async def lifespan(app: FastAPI):
115115
if azure_client:
116116
await azure_client.close()
117117

118-
except Exception as exc:
118+
except Exception: # noqa: BLE001
119119
logger.error("Error during agent cleanup")
120120

121121

src/backend/common/telemetry/patch_instrumentor.py

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,15 @@
1-
"""\nPatch for Azure AI telemetry instrumentors.\n\nFixes GitHub issue: https://github.com/microsoft/semantic-kernel/issues/13715\n\nThe bug: agent_api_response_to_str() in both azure.ai.agents and azure.ai.projects\nraises ValueError when response_format is a dict (e.g. from Semantic Kernel's AzureAIAgent).\nIt only handles str and None types.\n\nThe fix: Monkey-patch that method to convert dict/other types to JSON string instead of raising.\nMust be called BEFORE configure_azure_monitor() triggers any instrumentation.\n"""
1+
"""
2+
Patch for Azure AI telemetry instrumentors.
3+
4+
Fixes GitHub issue: https://github.com/microsoft/semantic-kernel/issues/13715
5+
6+
The bug: agent_api_response_to_str() in both azure.ai.agents and azure.ai.projects
7+
raises ValueError when response_format is a dict (e.g. from Semantic Kernel's AzureAIAgent).
8+
It only handles str and None types.
9+
10+
The fix: Monkey-patch that method to convert dict/other types to JSON string instead of raising.
11+
Must be called BEFORE configure_azure_monitor() triggers any instrumentation.
12+
"""
213

314
import json
415
import logging
@@ -23,7 +34,13 @@ def patch_instrumentors():
2334
"""
2435
Patch Azure AI telemetry instrumentors to handle dict response_format.
2536
26-
This fixes the ValueError: \"Unknown response format <class 'dict'>\" error\n that occurs when Semantic Kernel's AzureAIAgent passes a dict as response_format\n and Azure Monitor telemetry instrumentor tries to serialize it.\n\n Patches both azure.ai.agents and azure.ai.projects packages.\n Must be called BEFORE configure_azure_monitor().\n """
37+
This fixes the ValueError: "Unknown response format <class 'dict'>" error
38+
that occurs when Semantic Kernel's AzureAIAgent passes a dict as response_format
39+
and Azure Monitor telemetry instrumentor tries to serialize it.
40+
41+
Patches both azure.ai.agents and azure.ai.projects packages.
42+
Must be called BEFORE configure_azure_monitor().
43+
"""
2744
# Patch azure.ai.agents (primary package with the bug)
2845
try:
2946
from azure.ai.agents.telemetry._ai_agents_instrumentor import (

src/backend/sql_agents/convert_script.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
"""
66

77
import json
8-
import logging
98

109
from api.status_updates import send_status_update
1110

src/backend/sql_agents/process_batch.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44
It is the main entry point for the SQL migration process.
55
"""
66

7-
import logging
8-
97
from api.status_updates import send_status_update
108

119
from common.logger.app_logger import AppLogger

0 commit comments

Comments
 (0)