Skip to content

Commit 61b11ec

Browse files
committed
fix: add missing crop function to _DATA_FILE_HELPER_LIB
Fixes #4011
1 parent 1f546df commit 61b11ec

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

src/google/adk/flows/llm_flows/_code_execution.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,10 @@ class DataFileUtil:
7676
_DATA_FILE_HELPER_LIB = '''
7777
import pandas as pd
7878
79+
def crop(s: str, max_chars: int = 64) -> str:
80+
"""Crops a string to max_chars characters."""
81+
return s[: max_chars - 3] + '...' if len(s) > max_chars else s
82+
7983
def explore_df(df: pd.DataFrame) -> None:
8084
"""Prints some information about a pandas DataFrame."""
8185

0 commit comments

Comments
 (0)