symfonic.core.learning.entity_extractor_llm¶
entity_extractor_llm ¶
LLM-backed entity extractor.
Reuses the agent's bound chat model. Best-effort JSON parsing -- a malformed response yields an empty candidate list, never a raise. Caching per-episodic results via a content-hash key is out of scope for v1 (design §9.3 documents the LLM extractor as non-idempotent).
Design reference: §17.1.4 / §13.4 (prompt template).
LlmEntityExtractor ¶
LlmEntityExtractor(chat_model: Any, *, max_entities: int = 10, observability_hook: ObservabilityHook | None = None)
Decision 4.5 strategy. Uses the agent's bound chat model.
Source code in src/symfonic/core/learning/entity_extractor_llm.py
extract
async
¶
extract(text: str, *, callback_manager: CallbackManager | None = None, run_id: str = '', model_name: str = 'entity_extractor_llm') -> list[EntityCandidate]
Extract entity candidates from episodic text.
v7.4.3 (adopter Ask 5): when callback_manager is provided and
the underlying chat model exposes ainvoke, fires
on_llm_end(node_name="entity_extractor_llm") so the gated
Phase 11 LLM call is visible to token billing / OTel. None
preserves byte-identical pre-7.4.3 behaviour.