Skip to content

API Reference parrot_formdesigner.services.plausibility

github-actions[bot] edited this page Dec 2, 2026 · 4 revisions

parrot_formdesigner.services.plausibility

View source

LLM-assisted answer plausibility checker (FEAT-649 Module 8).

One batched structured-output call judges whether each eligible answer makes sense for its question. Advisory only: low confidence never blocks; on_error governs LLM failure only.

Class AnswerPlausibilityChecker

Run one batched plausibility check for a form submission.

Parameter Type Default Description
client 'AbstractClient | None'
config LLMValidationConfig

Method AnswerPlausibilityChecker.check

Return the report; raise PlausibilityBlocked only under on_error == "block".

The report's not_examined names every eligible field the model never saw — cut by cfg.max_fields or dropped as unrenderable — so a status="ok" report can no longer over-claim coverage. items and not_examined are always disjoint.

check(form: FormSchema, scalars: dict[str, Any], *, locale: str, fields: set[str] | None = None) -> PlausibilityReport

Parameter Type Default Description
form FormSchema
scalars dict[str, Any]
locale str
fields set[str] | None None

Returns: PlausibilityReport

Alias FieldType

Re-exported from parrot_formdesigner.core.types.FieldType.

Alias FormField

Re-exported from parrot_formdesigner.core.schema.FormField.

Alias FormSchema

Re-exported from parrot_formdesigner.core.schema.FormSchema.

Alias LLMValidationConfig

Re-exported from parrot_formdesigner.core.llm_validation.LLMValidationConfig.

Alias NOT_EXAMINED_MAX_FIELDS

Re-exported from parrot_formdesigner.core.llm_validation.NOT_EXAMINED_MAX_FIELDS.

Alias NOT_EXAMINED_UNRENDERABLE

Re-exported from parrot_formdesigner.core.llm_validation.NOT_EXAMINED_UNRENDERABLE.

Class PlausibilityBatch

Structured-output schema sent to the LLM.

Fields:

Field Type Default Description
items list[PlausibilityItemOut]

Class PlausibilityBlocked

Raised only when on_error == "block" and the LLM is unavailable/timed out/unparsable.

Parameter Type Default Description
reason str

Class PlausibilityItemOut

One verdict as returned by the LLM.

Fields:

Field Type Default Description
field_id str
plausible bool
confidence float
reason str ''

Alias PlausibilityReport

Re-exported from parrot_formdesigner.core.llm_validation.PlausibilityReport.

Alias PlausibilityVerdict

Re-exported from parrot_formdesigner.core.llm_validation.PlausibilityVerdict.

Function build_items

Prompt items: field_id, label, description, hint, field_type, options (labels), answer (text).

max_answer_chars caps each rendered answer (None = uncapped, the pre-FEAT-737 behaviour kept for direct callers).

build_items(form: FormSchema, fields: list[FormField], scalars: dict[str, Any], *, locale: str, max_answer_chars: int | None = None) -> list[dict[str, Any]]

Parameter Type Default Description
form FormSchema
fields list[FormField]
scalars dict[str, Any]
locale str
max_answer_chars int | None None

Returns: list[dict[str, Any]]

Function eligible_fields

Fields to send: enabled, answered, not read_only, type not excluded, not sensitive.

Ordered required-first (stable), cut at cfg.max_fields; only restricts to a subset. Thin wrapper over :func:select_fields — call that one to learn what the cap cut.

eligible_fields(form: FormSchema, scalars: dict[str, Any], cfg: LLMValidationConfig, *, only: set[str] | None = None) -> list[FormField]

Parameter Type Default Description
form FormSchema
scalars dict[str, Any]
cfg LLMValidationConfig
only set[str] | None None

Returns: list[FormField]

Alias is_sensitive

Re-exported from parrot_formdesigner.core.voice.is_sensitive.

Alias llm_validation_enabled

Re-exported from parrot_formdesigner.core.llm_validation.llm_validation_enabled.

Function select_fields

Partition eligible fields into those to send and those the cap dropped.

select_fields(form: FormSchema, scalars: dict[str, Any], cfg: LLMValidationConfig, *, only: set[str] | None = None) -> tuple[list[FormField], dict[str, str]]

Parameter Type Default Description
form FormSchema The form whose fields are being judged.
scalars dict[str, Any] Submitted answers by field id.
cfg LLMValidationConfig The form's LLM validation settings.
only set[str] | None None When given, restrict consideration to these field ids.

Returns: tuple[list[FormField], dict[str, str]] — (picked, not_examined) — picked is the cfg.max_fields-capped, required-first list; not_examined maps every field id cut by that cap to NOT_EXAMINED_MAX_FIELDS.

Architecture

Clients

Bots & Agents

Memory

Knowledge

Tools & Toolkits

Flows

Experts

Skills

Stores & Loaders

MCP & A2A

Server & APIs

Integrations

Outputs & A2UI

Prompts

Security

Operations

Migration

SDD Tooling

LLM Wiki

Deployment

Decisions

API Reference

Clone this wiki locally