MCPcopy Create free account
hub / github.com/crewAIInc/crewAI / _sanitize_payload

Function _sanitize_payload

scripts/age90_file_input_runner.py:41–55  ·  view source on GitHub ↗

Shorten large fields before printing API payloads.

(value: Any)

Source from the content-addressed store, hash-verified

39
40
41def _sanitize_payload(value: Any) -> Any:
42 """Shorten large fields before printing API payloads."""
43 if isinstance(value, Mapping):
44 sanitized: dict[str, Any] = {}
45 for key, item in value.items():
46 if key == "file_data" and isinstance(item, str):
47 sanitized[key] = item[:100] + f"... ({len(item)} chars)"
48 else:
49 sanitized[str(key)] = _sanitize_payload(item)
50 return sanitized
51
52 if isinstance(value, Sequence) and not isinstance(value, str | bytes):
53 return [_sanitize_payload(item) for item in value]
54
55 return value
56
57
58def inspect_native_path(pdf_path: Path, provider: str, api: str | None) -> None:

Callers 1

print_payload_and_stopFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected