MCPcopy Create free account
hub / github.com/google/adk-samples / parse_amount

Function parse_amount

python/agents/invoice-processing/eval/eval.py:112–119  ·  view source on GitHub ↗

Parse a formatted amount string like '1,100.00' into a float.

(value: str)

Source from the content-addressed store, hash-verified

110
111
112def parse_amount(value: str) -> float | None:
113 """Parse a formatted amount string like '1,100.00' into a float."""
114 if value is None:
115 return None
116 try:
117 return float(str(value).replace(",", "").strip())
118 except (ValueError, TypeError):
119 return None
120
121
122def amounts_match(gt_val: str, agent_val: str, tolerance: float) -> bool:

Callers 3

amounts_matchFunction · 0.85
compare_line_itemsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected