Skip to content

Commit 3c6661a

Browse files
committed
feat: add parse_kv_pairs function to sessions utils
1 parent 135054f commit 3c6661a

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

  • src/google/adk_community/sessions

src/google/adk_community/sessions/utils.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,3 +35,13 @@ def _json_serializer(obj):
3535
if isinstance(obj, Decimal):
3636
return float(obj)
3737
return str(obj)
38+
39+
40+
def parse_kv_pairs(data: str) -> dict:
41+
"""Parses comma-separated key-value pairs into a dictionary."""
42+
result = {}
43+
parts = data.split(",")
44+
for part in parts:
45+
key, value = part.split(":")
46+
result[key.strip()] = value.strip()
47+
return result

0 commit comments

Comments
 (0)