> For the complete documentation index, see [llms.txt](https://docs.raga.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.raga.ai/ragaai-catalyst/ragaai-metric-library/guardrails/valid-range.md).

# Valid Range

Ensure numeric values generated by AI fall within allowed ranges. Keep calculations safe and accurate.

**Objective**\
Ensures that numerical values in the text fall within a valid range, maintaining data accuracy.

**Interpretation**\
A higher score indicates that one or more numerical values fall outside the acceptable range. A lower (or zero) score indicates all values are within the valid range.

**Code Execution**

```python
metrics = [
    {
        "name": "Valid Range",
        "config": {
            "model": "gpt-4o-mini",
            "provider": "openai"
        },
        "column_name": "your-column-identifier",
        "schema_mapping": schema_mapping
    }
]
```

**Example**

* **Prompt**: “Provide the temperature in Celsius between -50 and 50.”
* **Context**: “Valid range is from -50 to 50.”
* **Response**: “The temperature is 100°C.”
* **Metric Output**: `{"score": 1, "reason": "Value out of valid range (100°C is > 50°C)."}`
