mirror of
https://github.com/crewAIInc/crewAI.git
synced 2026-04-30 14:52:36 +00:00
linted
This commit is contained in:
@@ -314,7 +314,6 @@ class PlannerObserver:
|
||||
We handle all cases to avoid silently falling back to a
|
||||
hardcoded success default.
|
||||
"""
|
||||
import json
|
||||
|
||||
if isinstance(response, StepObservation):
|
||||
return response
|
||||
@@ -324,7 +323,7 @@ class PlannerObserver:
|
||||
text = response.strip()
|
||||
try:
|
||||
return StepObservation.model_validate_json(text)
|
||||
except Exception:
|
||||
except Exception: # noqa: S110
|
||||
pass
|
||||
# Some LLMs wrap the JSON in markdown fences
|
||||
if text.startswith("```"):
|
||||
@@ -333,14 +332,14 @@ class PlannerObserver:
|
||||
inner = "\n".join(lines[1:-1] if lines[-1].strip() == "```" else lines[1:])
|
||||
try:
|
||||
return StepObservation.model_validate_json(inner.strip())
|
||||
except Exception:
|
||||
except Exception: # noqa: S110
|
||||
pass
|
||||
|
||||
# Dict path
|
||||
if isinstance(response, dict):
|
||||
try:
|
||||
return StepObservation.model_validate(response)
|
||||
except Exception:
|
||||
except Exception: # noqa: S110
|
||||
pass
|
||||
|
||||
# Last resort — log what we got so it's diagnosable
|
||||
|
||||
Reference in New Issue
Block a user