MCPcopy Create free account
hub / github.com/CommonstackAI/UncommonRoute / _truncate_excerpt

Function _truncate_excerpt

uncommon_route/composition.py:725–731  ·  view source on GitHub ↗
(text: str, limit: int)

Source from the content-addressed store, hash-verified

723
724
725def _truncate_excerpt(text: str, limit: int) -> str:
726 stripped = text.strip()
727 if len(stripped) <= limit:
728 return stripped
729 head = stripped[: max(1, limit // 2)].strip()
730 tail = stripped[-max(1, limit // 3):].strip()
731 return f"{head}\n...\n{tail}"
732
733
734def _looks_like_json(text: str) -> bool:

Callers 1

_rehydrate_artifactsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected