Skip to content

Commit bcaafc3

Browse files
committed
fix: add type ignore comments for field_validator in feedback tool
Add type: ignore[misc] comments to @field_validator decorators to suppress mypy warnings about decorator usage with Pydantic v2. This is a cosmetic fix to improve type checking compatibility. Changes: - Added type: ignore[misc] to validate_feedback validator - Added type: ignore[misc] to validate_account_id validator - Added type: ignore[misc] to validate_tool_names validator - Minor formatting improvements for consistency
1 parent a1c688b commit bcaafc3

File tree

1 file changed

+8
-20
lines changed

1 file changed

+8
-20
lines changed

stackone_ai/feedback/tool.py

Lines changed: 8 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ class FeedbackInput(BaseModel):
2424
account_id: str | list[str] = Field(..., description="Account identifier(s) - single ID or list of IDs")
2525
tool_names: list[str] = Field(..., min_length=1, description="List of tool names")
2626

27-
@field_validator("feedback")
27+
@field_validator("feedback") # type: ignore[misc]
2828
@classmethod
2929
def validate_feedback(cls, v: str) -> str:
3030
"""Validate that feedback is non-empty after trimming."""
@@ -33,7 +33,7 @@ def validate_feedback(cls, v: str) -> str:
3333
raise ValueError("Feedback must be a non-empty string")
3434
return trimmed
3535

36-
@field_validator("account_id")
36+
@field_validator("account_id") # type: ignore[misc]
3737
@classmethod
3838
def validate_account_id(cls, v: str | list[str]) -> list[str]:
3939
"""Validate and normalize account ID(s) to a list."""
@@ -53,7 +53,7 @@ def validate_account_id(cls, v: str | list[str]) -> list[str]:
5353

5454
raise ValueError("Account ID must be a string or list of strings")
5555

56-
@field_validator("tool_names")
56+
@field_validator("tool_names") # type: ignore[misc]
5757
@classmethod
5858
def validate_tool_names(cls, v: list[str]) -> list[str]:
5959
"""Validate and clean tool names."""
@@ -120,31 +120,19 @@ def execute(
120120
"tool_names": tool_names,
121121
}
122122
result = super().execute(validated_arguments, options=options)
123-
results.append({
124-
"account_id": account_id,
125-
"status": "success",
126-
"result": result
127-
})
123+
results.append({"account_id": account_id, "status": "success", "result": result})
128124
except Exception as exc:
129125
error_msg = str(exc)
130-
errors.append({
131-
"account_id": account_id,
132-
"status": "error",
133-
"error": error_msg
134-
})
135-
results.append({
136-
"account_id": account_id,
137-
"status": "error",
138-
"error": error_msg
139-
})
126+
errors.append({"account_id": account_id, "status": "error", "error": error_msg})
127+
results.append({"account_id": account_id, "status": "error", "error": error_msg})
140128

141129
# Return combined results
142130
return {
143131
"message": f"Feedback sent to {len(account_ids)} account(s)",
144132
"total_accounts": len(account_ids),
145133
"successful": len([r for r in results if r["status"] == "success"]),
146134
"failed": len(errors),
147-
"results": results
135+
"results": results,
148136
}
149137

150138
except json.JSONDecodeError as exc:
@@ -176,7 +164,7 @@ def create_feedback_tool(
176164
name = "meta_collect_tool_feedback"
177165
description = (
178166
"Collects user feedback on StackOne tool performance. "
179-
"First ask the user, \"Are you ok with sending feedback to StackOne?\" "
167+
'First ask the user, "Are you ok with sending feedback to StackOne?" '
180168
"and mention that the LLM will take care of sending it. "
181169
"Call this tool only when the user explicitly answers yes."
182170
)

0 commit comments

Comments
 (0)