From 3c6661a44d7e0fecbd1beab1695f6ffc82a00ae7 Mon Sep 17 00:00:00 2001 From: Shangjie Chen Date: Mon, 4 May 2026 20:17:16 -0700 Subject: [PATCH] feat: add parse_kv_pairs function to sessions utils --- src/google/adk_community/sessions/utils.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/google/adk_community/sessions/utils.py b/src/google/adk_community/sessions/utils.py index bc53d2b2..5fb50626 100644 --- a/src/google/adk_community/sessions/utils.py +++ b/src/google/adk_community/sessions/utils.py @@ -35,3 +35,13 @@ def _json_serializer(obj): if isinstance(obj, Decimal): return float(obj) return str(obj) + + +def parse_kv_pairs(data: str) -> dict: + """Parses comma-separated key-value pairs into a dictionary.""" + result = {} + parts = data.split(",") + for part in parts: + key, value = part.split(":") + result[key.strip()] = value.strip() + return result