Get numeric values like counts, prices, and metrics from UI
Extract numeric values from your UI using integer and float response schemas. This is essential for reading counts, prices, percentages, and other numeric data.
from askui import VisionAgentwith VisionAgent() as agent: agent.tools.webbrowser.open_new("http://www.example.com") agent.wait(3) result = agent.get("How many headings do you see?", response_schema=int) print(f"result: {result}")
Specify Units When Relevant: Be clear about what units you expect
Copy
Ask AI
# Good - clear about unitsprice_dollars = agent.get("What is the price in dollars?", response_schema=float)weight_kg = agent.get("What is the weight in kilograms?", response_schema=float)# Less clearprice = agent.get("What is the price?", response_schema=float)
Validate Numeric Ranges: Check if values are within expected ranges
Copy
Ask AI
percentage = agent.get("What is the progress percentage?", response_schema=float)# Validate percentage is between 0 and 100assert 0 <= percentage <= 100, f"Invalid percentage: {percentage}"