Skip to content

ontocast.prompt.section_classification

Prompt templates for section classification during chunk prepare.

document_type_context(document_type)

Optional human-message prefix when the caller supplies a document type hint.

Source code in ontocast/prompt/section_classification.py
def document_type_context(document_type: str | None) -> str:
    """Optional human-message prefix when the caller supplies a document type hint."""
    if document_type is None:
        return ""
    stripped = document_type.strip()
    if not stripped:
        return ""
    return f"Optional context — the source material is described as: {stripped}.\n\n"

format_batch_items(items)

Render (index, fragment) pairs for the batched classification prompt.

Source code in ontocast/prompt/section_classification.py
def format_batch_items(items: list[tuple[int, str]]) -> str:
    """Render ``(index, fragment)`` pairs for the batched classification prompt."""
    return "\n\n".join(f"[{index}] {fragment}" for index, fragment in items)