Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit6841562

Browse files
committed
Linting
Signed-off-by: Mihai Criveti <crivetimihai@gmail.com>
1 parentcbcab24 commit6841562

File tree

3 files changed

+21
-32
lines changed

3 files changed

+21
-32
lines changed

‎.env.example‎

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1125,13 +1125,19 @@ LLM_PROVIDER=openai
11251125
# Redis Configuration for chat session storage and maintaining history
11261126
# CACHE_TYPE should be set to "redis" and REDIS_URL configured appropriately as mentioned in the caching section.
11271127

1128-
LLMCHAT_SESSION_TTL=300# Seconds for active_session key TTL
1129-
LLMCHAT_SESSION_LOCK_TTL=30# Seconds for lock expiry
1130-
LLMCHAT_SESSION_LOCK_RETRIES=10# How many times to poll while waiting
1131-
LLMCHAT_SESSION_LOCK_WAIT=0.2# Seconds between polls
1132-
1133-
LLMCHAT_CHAT_HISTORY_TTL=3600# Seconds for chat history expiry
1134-
LLMCHAT_CHAT_HISTORY_MAX_MESSAGES=50# Maximum message history to store per user
1128+
# Seconds for active_session key TTL
1129+
LLMCHAT_SESSION_TTL=300
1130+
# Seconds for lock expiry
1131+
LLMCHAT_SESSION_LOCK_TTL=30
1132+
# How many times to poll while waiting
1133+
LLMCHAT_SESSION_LOCK_RETRIES=10
1134+
# Seconds between polls
1135+
LLMCHAT_SESSION_LOCK_WAIT=0.2
1136+
1137+
# Seconds for chat history expiry
1138+
LLMCHAT_CHAT_HISTORY_TTL=3600
1139+
# Maximum message history to store per user
1140+
LLMCHAT_CHAT_HISTORY_MAX_MESSAGES=50
11351141

11361142
#####################################
11371143
# Azure OpenAI Configuration

‎mcpgateway/services/gateway_service.py‎

Lines changed: 7 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -3554,10 +3554,7 @@ def _validate_tools(self, tools: list[dict[str, Any]], context: str = "default")
35543554
validation_errors.append(error_msg)
35553555
exceptValueErrorase:
35563556
if"JSON structure exceeds maximum depth"instr(e):
3557-
error_msg= (
3558-
f"Tool '{tool_name}' schema too deeply nested. "
3559-
f"Current depth limit:{settings.validation_max_json_depth}"
3560-
)
3557+
error_msg=f"Tool '{tool_name}' schema too deeply nested. "f"Current depth limit:{settings.validation_max_json_depth}"
35613558
logger.error(error_msg)
35623559
logger.warning("Consider increasing VALIDATION_MAX_JSON_DEPTH environment variable")
35633560
else:
@@ -3570,23 +3567,14 @@ def _validate_tools(self, tools: list[dict[str, Any]], context: str = "default")
35703567
validation_errors.append(error_msg)
35713568

35723569
ifvalidation_errors:
3573-
logger.warning(
3574-
f"Tool validation completed with{len(validation_errors)} error(s). "
3575-
f"Successfully validated{len(valid_tools)} tool(s)."
3576-
)
3570+
logger.warning(f"Tool validation completed with{len(validation_errors)} error(s). "f"Successfully validated{len(valid_tools)} tool(s).")
35773571
forerrinvalidation_errors[:3]:
35783572
logger.debug(f"Validation error:{err}")
35793573

35803574
ifnotvalid_toolsandvalidation_errors:
35813575
ifcontext=="oauth":
3582-
raiseOAuthToolValidationError(
3583-
f"OAuth tool fetch failed: all{len(tools)} tools failed validation. "
3584-
f"First error:{validation_errors[0][:200]}"
3585-
)
3586-
raiseGatewayConnectionError(
3587-
f"Failed to fetch tools: All{len(tools)} tools failed validation. "
3588-
f"First error:{validation_errors[0][:200]}"
3589-
)
3576+
raiseOAuthToolValidationError(f"OAuth tool fetch failed: all{len(tools)} tools failed validation. "f"First error:{validation_errors[0][:200]}")
3577+
raiseGatewayConnectionError(f"Failed to fetch tools: All{len(tools)} tools failed validation. "f"First error:{validation_errors[0][:200]}")
35903578

35913579
returnvalid_tools
35923580

@@ -3617,9 +3605,7 @@ async def _connect_to_sse_server_without_validation(self, server_url: str, authe
36173605

36183606
response=awaitsession.list_tools()
36193607
tools=response.tools
3620-
tools= [
3621-
tool.model_dump(by_alias=True,exclude_none=True,exclude_unset=True)fortoolintools
3622-
]
3608+
tools= [tool.model_dump(by_alias=True,exclude_none=True,exclude_unset=True)fortoolintools]
36233609

36243610
tools=self._validate_tools(tools,context="oauth")
36253611
iftools:
@@ -3762,9 +3748,7 @@ def get_httpx_client_factory(
37623748

37633749
response=awaitsession.list_tools()
37643750
tools=response.tools
3765-
tools= [
3766-
tool.model_dump(by_alias=True,exclude_none=True,exclude_unset=True)fortoolintools
3767-
]
3751+
tools= [tool.model_dump(by_alias=True,exclude_none=True,exclude_unset=True)fortoolintools]
37683752

37693753
tools=self._validate_tools(tools)
37703754
iftools:
@@ -3904,9 +3888,7 @@ def get_httpx_client_factory(
39043888

39053889
response=awaitsession.list_tools()
39063890
tools=response.tools
3907-
tools= [
3908-
tool.model_dump(by_alias=True,exclude_none=True,exclude_unset=True)fortoolintools
3909-
]
3891+
tools= [tool.model_dump(by_alias=True,exclude_none=True,exclude_unset=True)fortoolintools]
39103892

39113893
tools=self._validate_tools(tools)
39123894
fortoolintools:

‎plugins/tools_telemetry_exporter/__init__.py‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# -*- coding: utf-8 -*-
12
"""Tools Telemetry Exporter Plugin - exports tool invocation telemetry to OpenTelemetry."""
23

34
fromplugins.tools_telemetry_exporter.telemetry_exporterimportToolsTelemetryExporterPlugin

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp