MCPcopy Create free account
hub / github.com/promptfoo/promptfoo / _truncate_body

Function _truncate_body

src/python/persistent_wrapper.py:176–182  ·  view source on GitHub ↗

Truncate text to max_length, adding indicator if truncated.

(text, max_length=4096)

Source from the content-addressed store, hash-verified

174
175
176def _truncate_body(text, max_length=4096):
177 """Truncate text to max_length, adding indicator if truncated."""
178 if not isinstance(text, str):
179 text = str(text)
180 if len(text) <= max_length:
181 return text
182 return text[: max_length - 13] + "... [truncated]"
183
184
185def _traced_call(method_callable, args, function_name):

Callers 1

_traced_callFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…