Validate ``obj`` against ``schema``; return ``(ok, error_message)``.
(obj: Any, schema: Mapping[str, Any])
| 29 | |
| 30 | |
| 31 | def validate_structured(obj: Any, schema: Mapping[str, Any]) -> tuple[bool, Optional[str]]: |
| 32 | """Validate ``obj`` against ``schema``; return ``(ok, error_message)``.""" |
| 33 | try: |
| 34 | validate_json_schema(obj, schema, root_name="output") |
| 35 | return True, None |
| 36 | except ToolInputError as exc: |
| 37 | return False, str(exc) |
| 38 | |
| 39 | |
| 40 | @dataclass |