MCPcopy Create free account
hub / github.com/google/adk-python / _truncate

Function _truncate

src/google/adk/utils/_debug_output.py:28–38  ·  view source on GitHub ↗

Truncate text to max length, appending '...' if truncated. Args: text: The text to truncate. max_len: Maximum length before truncation. Returns: The truncated text with '...' appended if it exceeds max_len.

(text: str, max_len: int)

Source from the content-addressed store, hash-verified

26
27
28def _truncate(text: str, max_len: int) -> str:
29 """Truncate text to max length, appending '...' if truncated.
30
31 Args:
32 text: The text to truncate.
33 max_len: Maximum length before truncation.
34
35 Returns:
36 The truncated text with '...' appended if it exceeds max_len.
37 """
38 return text[:max_len] + '...' if len(text) > max_len else text
39
40
41def print_event(event: Event, *, verbose: bool = False) -> None:

Callers 3

run_asyncMethod · 0.85
run_asyncMethod · 0.85
print_eventFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected