Skip to content

symfonic.core.learning.models

models

LearnedInsight -- a business fact extracted from conversation.

LearnedInsight dataclass

LearnedInsight(
    fact: str,
    confidence: float,
    category: str,
    tags: tuple[str, ...] = (),
    tenant_id: str = "",
    timestamp: datetime = (lambda: datetime.now(UTC))(),
    metadata: dict[str, Any] = dict(),
    scope: TenantScope | None = None,
)

A business fact extracted from conversation by the InsightExtractor.

Immutable by design — once extracted, an insight is a fixed record that can be safely passed across async boundaries without copying.

Attributes:

Name Type Description
fact str

The specific business observation (1-2 sentences).

confidence float

Certainty score between 0.0 and 1.0.

category str

Domain bucket (e.g. "customer_behavior", "inventory").

tags tuple[str, ...]

Optional keyword tuple for filtering and retrieval.

tenant_id str

Owning tenant; empty string means unscoped.

timestamp datetime

UTC creation time; auto-set on construction.

metadata dict[str, Any]

Arbitrary extra data from the extraction process.

scope TenantScope | None

T-7.21.7 -- optional full TenantScope carrying sub_tenant_id / namespace (and any future field). Preferred by :class:CommitToMemoryTool over the bare tenant_id reconstruction path because the latter silently dropped namespace. Backward compatible: when None (the v7.20 default), the tool falls back to the bare- tenant_id construction.