Regex Check
Objective This metric validates responses against predefined regex patterns, ensuring compliance with specific formats (e.g., email, date, or phone formats).
Interpretation A higher score indicates that the response does not comply with the required regex format or fails validation. A lower (or zero) score indicates compliance.
Code Execution
metrics = [
{
"name": "Regex Check",
"config": {
"model": "gpt-4o-mini",
"provider": "openai"
},
"column_name": "your-column-identifier",
"schema_mapping": schema_mapping
}
]
Example
Prompt: “Enter your email address.”
Context: “Valid email format: [email protected]”
Response: “myemail[at]example.com”
Metric Output:
{"score": 1, "reason": "Response does not match the required email regex format."}
Last updated
Was this helpful?