Skip to main content

Module number

Module number 

Source
Expand description

Numeric value extraction from LLM responses.

Provides parse_number for extracting a numeric value and parse_number_in_range for bounded extraction, handling common LLM output patterns like “Score: 8.5”, “8/10”, and prose-wrapped numbers.

Functions§

parse_number
Extract a numeric value from an LLM response.
parse_number_in_range
Extract a number and verify it falls within [min, max] inclusive.
parse_number_in_range_with_trace
Extract a bounded numeric value with diagnostic trace.
parse_number_with_trace
Extract a numeric value from an LLM response with diagnostic trace.