MCPcopy Create free account
hub / github.com/ScaleML/AgentSPEX / truncate_message

Function truncate_message

src/utils.py:8–15  ·  view source on GitHub ↗
(msg: Dict[str, Any], max_value_len=80)

Source from the content-addressed store, hash-verified

6
7
8def truncate_message(msg: Dict[str, Any], max_value_len=80) -> Dict[str, Any]:
9 if max_value_len <= 3:
10 max_value_len = 3
11 return (
12 str(msg)
13 if len(str(msg)) <= max_value_len
14 else str(msg)[: max_value_len - 3] + "...[truncated]"
15 )
16
17
18def shorten_values(msg: Union[List[Any], Dict[str, Any]], max_value_len=80):

Callers 1

_processFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected