Skip to content

API Reference parrot.knowledge.wiki.inbox.classify

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

parrot.knowledge.wiki.inbox.classify

View source

Taxonomy-bound document classification and deterministic tag/id normalization.

Alias AcquiredDocument

Re-exported from parrot.knowledge.wiki.documents.AcquiredDocument.

Alias DocumentMetadata

Re-exported from parrot.knowledge.wiki.documents.DocumentMetadata.

Alias InboxClassification

Re-exported from parrot.knowledge.wiki.inbox.models.InboxClassification.

Class InboxClassificationError

Classification failed or returned a malformed structured response.

Class InboxClassifier

Run and validate one structured classification call.

Parameter Type Default Description
adapter LLMCaller Structured LLM adapter.
taxonomy Taxonomy Closed classification taxonomy.
max_chars int 24000 Maximum document characters included in the prompt.

Method InboxClassifier.classify

Classify or raise InboxClassificationError; unknown kinds alone may fall back.

classify(acquired: AcquiredDocument, triage: ManifestDocEntry) -> ResolvedClassification

Parameter Type Default Description
acquired AcquiredDocument Acquired source document.
triage ManifestDocEntry Prior triage result for the document.

Returns: ResolvedClassification — A taxonomy-resolved classification.

Raises:

  • InboxClassificationError — If the adapter fails or response is malformed.

Alias LLMCaller

Re-exported from parrot.knowledge.graphindex.protocols.LLMCaller.

Alias ManifestDocEntry

Re-exported from parrot.knowledge.wiki.review.ManifestDocEntry.

Alias ResolvedClassification

Re-exported from parrot.knowledge.wiki.inbox.models.ResolvedClassification.

Alias Taxonomy

Re-exported from parrot.knowledge.wiki.charter.Taxonomy.

Function build_classification_prompt

Build a bounded data-only prompt declaring allowed kinds and the tag cap.

build_classification_prompt(text: str, taxonomy: Taxonomy, briefing: str, metadata: DocumentMetadata) -> str

Parameter Type Default Description
text str Bounded untrusted document text.
taxonomy Taxonomy Closed taxonomy that constrains the response.
briefing str Triage output supplied as context.
metadata DocumentMetadata Loader-derived document metadata.

Returns: str — The structured-classification prompt.

Function normalize_tag

ASCII-fold and kebab-case a tag; drop empty or overlong results.

normalize_tag(raw: str) -> str | None

Parameter Type Default Description
raw str Untrusted tag text returned by the model.

Returns: str | None — A normalized tag, or None when no usable tag remains.

Function normalize_tags

Normalize, dedupe in order and cap the tag sequence.

normalize_tags(raw: Iterable[str], *, max_tags: int) -> list[str]

Parameter Type Default Description
raw Iterable[str] Model-provided tags.
max_tags int Maximum normalized tags to retain.

Returns: list[str] — Normalized, unique tags in their original order.

Function slugify_doc_id

Return doc:<kebab-title-max-48>-<file_hash[:8]>.

slugify_doc_id(title: str, file_hash: str) -> str

Parameter Type Default Description
title str Resolved document title.
file_hash str Content hash from triage.

Returns: str — A stable document page identifier.

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