Skip to content

API Reference parrot_pipelines.planogram.identification.verify

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

parrot_pipelines.planogram.identification.verify

View source

Closed-set, evidence-gated verification of unresolved identifications.

Attribute CHOICE_CANNOT_TELL

Type: str

Attribute CHOICE_OTHER

Type: str

Alias CycleContext

Re-exported from parrot_pipelines.planogram.contracts.CycleContext.

Alias FacingDefinition

Re-exported from parrot_pipelines.planogram.comparison.definition.FacingDefinition.

Alias Identification

Re-exported from parrot_pipelines.planogram.contracts.Identification.

Alias SlotsDefinition

Re-exported from parrot_pipelines.planogram.comparison.definition.SlotsDefinition.

Attribute VERIFY_PROMPT_VERSION

Type: str

Attribute VERIFY_STAGE

Type: str

Class VerificationAnswer

LLM structured output for one crop.

Fields:

Field Type Default Description
choice str One of the offered product ids, 'other' or 'cannot_tell'
visible_text List[str] Text actually legible in the crop
evidence str '' One sentence: what in the crop supports the choice
confidence float 0.0

Alias VisionError

Re-exported from parrot_pipelines.planogram.identification.vision.VisionError.

Function crop_and_encode

Padded crop clamped to the image, PNG bytes. Picklable (CPU executor).

crop_and_encode(image: np.ndarray, box: Tuple[int, int, int, int], pad: float = 0.08) -> bytes

Parameter Type Default Description
image np.ndarray Source BGR image.
box Tuple[int, int, int, int] (x1, y1, x2, y2) in source pixels.
pad float 0.08 Padding per side, as a fraction of the box size.

Returns: bytes — PNG bytes of the crop.

Alias encode_png

Re-exported from parrot_pipelines.planogram.identification.vision.encode_png.

Attribute logger

Function option_order

Deterministic order seeded by sha256(shape_id|product) — no option is systematically first.

option_order(shape_id: str, products: Sequence[str]) -> List[str]

Parameter Type Default Description
shape_id str
products Sequence[str]

Returns: List[str]

Function pick_candidates

Up to n + 1 distinct-product candidates compatible with the PARTIAL READ (brand / descriptors).

Returns [] when the identification has no partial read — a closed set is never built from expectation alone; expected-empty facings are never candidates.

pick_candidates(identification: Identification, definition: SlotsDefinition, n: int) -> List[FacingDefinition]

Parameter Type Default Description
identification Identification The unresolved identification.
definition SlotsDefinition The slots definition.
n int Number of distractors (candidates returned: at most n + 1).

Returns: List[FacingDefinition] — Candidate facings (one per distinct product), described ones first, then by product id.

Function verify_unresolved

Closed-set pass for unresolved slots. An offered expected SKU is never evidence by itself.

Returns a NEW list, same order and length. Untouched when: observed empty, already resolved, no box, no partial read, choice is other/cannot_tell/not offered, evidence gate fails, or the call failed.

verify_unresolved(image: np.ndarray, identifications: List[Identification], definition: SlotsDefinition, ctx: CycleContext, *, n_distractors: int = 3, boxes: Optional[Dict[str, DetectionBox]] = None) -> List[Identification]

Parameter Type Default Description
image np.ndarray Untouched full-resolution BGR image.
identifications List[Identification] Identifications of the image.
definition SlotsDefinition The slots definition (candidate products).
ctx CycleContext Per-run services.
n_distractors int 3 Distractors per closed set (at most n + 1 options).
boxes Optional[Dict[str, DetectionBox]] None shape_id -> DetectionBox crops (identifications carry no geometry).

Returns: List[Identification] — A new list, same order and length.

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