# Asercje deterministyczne: format, schemat, dopasowanie tekstu

EN: **Deterministic assertions: format, schema and string checks** · id `assertionchecks` · aliases: code assertions, string match, regex checks, schema validation, asercje, deterministic graders

Path: [AI Atlas](https://aiatlasgraph.com/llms.txt) › [Ewaluacja i interpretowalność](https://aiatlasgraph.com/t/evaluation.md) › [Ewaluatory kodowe](https://aiatlasgraph.com/t/codeevals.md) › Asercje deterministyczne: format, schemat, dopasowanie tekstu

## Description

- PL: Gradery kodowe sprawdzające odpowiedzi regułami: dopasowanie dokładne lub regex, walidacja schematu, długość, obecność słów kluczowych.
- EN: Code graders that check outputs with rules: exact or regex match, schema validation, length and keyword presence.

## In one sentence

- PL: Proste reguły w programie sprawdzają odpowiedź modelu: czy ma właściwy format, zawiera wymagane słowo albo nie przekracza długości.
- EN: Simple rules in a program check a model's answer: right format, a required word present, or length within limits.

## Problem it solves

- PL: Część błędów jest banalna do wykrycia, a sprawdzanie ich drugim modelem albo ręcznie marnuje czas i pieniądze.
- EN: Some errors are trivial to detect, and checking them with a second model or by hand wastes time and money.

## What it does

- PL: Jak bramka na lotnisku, która natychmiast wychwytuje oczywiste rzeczy; trudniejsze przypadki trafiają dopiero do człowieka lub sędziego.
- EN: Like an airport gate that instantly catches the obvious items; only harder cases go on to a person or a judge.

## Everyday example

- PL: Formularz wypełniany przez asystenta musi mieć poprawną datę i kod pocztowy; reguła odrzuca odpowiedź, zanim ktoś ją zobaczy.
- EN: A form filled by an assistant needs a valid date and postcode; a rule rejects the answer before anyone sees it.

## This concerns you if you…

- PL: model ma zwracać dane w ściśle określonym formacie
- PL: chcesz tanich testów uruchamianych przy każdej zmianie
- EN: the model must return data in a strict format
- EN: you want cheap tests that run on every change

## Keywords

regex assertions · JSON Schema validation · exact match · fuzzy match · CI evals

## How it works

- PL: Każdy przypadek testowy ma zestaw asercji uruchamianych w kodzie: parsowanie JSON i walidację schematu, dopasowanie dokładne, rozmyte lub wyrażeniem regularnym, limity długości, obecność lub brak fraz. Są szybkie, tanie i powtarzalne, więc pasują do CI i jako pierwszy filtr przed sędzią LLM.
- EN: Each test case carries assertions run in code: JSON parsing and schema validation, exact, fuzzy or regex matching, length limits, and presence or absence of phrases. They are fast, cheap and reproducible, so they suit CI and act as a first filter before an LLM judge.

## Limits

- PL: Reguły są kruche wobec poprawnych wariantów, które nie pasują do wzorca, i nie oceniają sensu ani tonu. Zbyt wiele asercji na brzmienie odpowiedzi zamyka modelowi drogę do lepszych rozwiązań.
- EN: Rules are brittle to valid variants that miss the pattern and cannot judge meaning or tone. Too many wording assertions block the model from better solutions.

## Key terms

- PL: **asercja**: Warunek, który odpowiedź musi spełnić, sprawdzany automatycznie.
- PL: **walidacja schematu**: Sprawdzenie, czy dane mają wymagane pola i typy.
- PL: **wyrażenie regularne**: Wzorzec tekstu do wyszukiwania lub sprawdzania formatu.
- EN: **assertion**: A condition the answer must meet, checked automatically.
- EN: **schema validation**: Checking that data has the required fields and types.
- EN: **regular expression**: A text pattern for searching or checking format.

## Know first

- [Structured outputs i walidacja (Structured outputs and validation)](https://aiatlasgraph.com/t/structured.md)
- [Budowa polecenia: instrukcje, rola i znaczniki (Prompt structure: instructions, roles and delimiters)](https://aiatlasgraph.com/t/promptstructure.md)

## Sources

- [Demystifying evals for AI agents](<https://www.anthropic.com/engineering/demystifying-evals-for-ai-agents>) `anthropic-agent-evals-2026` · by Mikaela Grace, Jeremy Hadfield, Rodrigo Olivares, Jiri De Jonghe (Anthropic)

---

AI Atlas revision 122 (2026-10-30) · HTML: https://aiatlasgraph.com/t/assertionchecks · index: https://aiatlasgraph.com/llms.txt · everything: https://aiatlasgraph.com/llms-full.txt · updated 2026-10-30
