MCPcopy Create free account
hub / github.com/anthropics/anthropic-sdk-python / fit

Method fit

tests/test_open_telemetry.py:6342–6344  ·  view source on GitHub ↗
(parts: list[Part], limit: int)

Source from the content-addressed store, hash-verified

6340 image: Part = {"type": "anthropic_image"}
6341
6342 def fit(parts: list[Part], limit: int) -> tuple[str, bool]:
6343 values, truncated = fit_content({OUTPUT: [{"role": "assistant", "parts": parts}]}, limit)
6344 return to_json(json.loads(values[OUTPUT])[0]["parts"]), truncated
6345
6346 def size(parts: list[Part]) -> int:
6347 return len(to_json([{"role": "assistant", "parts": parts}]))

Callers

nothing calls this directly

Calls 2

fit_contentFunction · 0.90
to_jsonFunction · 0.90

Tested by

no test coverage detected