Skip to content

API Reference parrot_pipelines.planogram.types.abstract

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

parrot_pipelines.planogram.types.abstract

View source

Abstract base class for planogram type composables.

Class AbstractPlanogramType

Contract for planogram type composables.

Each composable receives a reference to the parent PlanogramCompliance pipeline for access to shared utilities (LLM, image helpers, config).

Concrete implementations supply the strict cycle contract: a default layout profile plus the perceive / identify / compare hooks.

Parameter Type Default Description
pipeline 'PlanogramCompliance' Parent PlanogramCompliance instance providing shared utilities (LLM clients, image processing, config).
config 'PlanogramConfig' The PlanogramConfig for this compliance run.

Method AbstractPlanogramType.validate_contract

Reject incomplete types and configurations without a slots definition, before any inference.

validate_contract() -> None

Raises:

  • TypeError — A cycle hook or default_layout_profile is not implemented.
  • ValueError — slots_definition is missing (names the config and the migration runbook).

Method AbstractPlanogramType.default_layout_profile

Return a fresh default LayoutProfile for this type (configuration overrides are merged by the pipeline).

default_layout_profile() -> LayoutProfile

Returns: LayoutProfile

Method AbstractPlanogramType.perceive

Stage 1: observed geometry for one untouched image (fallback is orchestrator-owned).

perceive(image: Image.Image, image_id: str, ctx: CycleContext) -> PerceptionResult

Parameter Type Default Description
image Image.Image
image_id str
ctx CycleContext

Returns: PerceptionResult

Method AbstractPlanogramType.identify

Stage 2: OCR/vision identification and neutral rule evidence for one image.

identify(image: Image.Image, perception: PerceptionResult, ctx: CycleContext) -> IdentificationResult

Parameter Type Default Description
image Image.Image
perception PerceptionResult
ctx CycleContext

Returns: IdentificationResult

Method AbstractPlanogramType.compare

Stage 3: deterministic comparison of every processed image against the definition; no I/O.

compare(perceptions: Sequence[PerceptionResult], identifications: Sequence[IdentificationResult], ctx: CycleContext) -> ComparisonResult

Parameter Type Default Description
perceptions Sequence[PerceptionResult]
identifications Sequence[IdentificationResult]
ctx CycleContext

Returns: ComparisonResult

Method AbstractPlanogramType.get_render_colors

Return color scheme for rendering compliance overlays.

Override in concrete types to customize colors per planogram type.

get_render_colors() -> Dict[str, Tuple[int, int, int]]

Returns: Dict[str, Tuple[int, int, int]] — Dict mapping color role to RGB tuple.

Alias ComparisonResult

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

Alias CycleContext

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

Alias IdentificationResult

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

Alias LayoutProfile

Re-exported from parrot_pipelines.planogram.layout.LayoutProfile.

Alias PerceptionResult

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

Alias PlanogramCompliance

Re-exported from parrot_pipelines.planogram.plan.PlanogramCompliance.

Alias PlanogramConfig

Re-exported from parrot_pipelines.planogram.models.PlanogramConfig.

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