symfonic.core.learning.refiner¶
refiner ¶
InsightExtractor -- uses an LLM to identify business facts from conversation.
InsightExtractor ¶
InsightExtractor(
llm: Any = None,
custom_prompt: str | None = None,
min_confidence: float = 0.5,
*,
observability_hook: ObservabilityHook | None = None,
)
Extracts LearnedInsight objects from conversation text using an LLM.
The extraction prompt can be customized with domain-specific
instructions via custom_prompt. The default prompt targets
general business insights.
Graceful degradation: when no LLM is configured, extract()
returns an empty list without raising.
Source code in src/symfonic/core/learning/refiner.py
extract
async
¶
extract(
conversation: str,
tenant_id: str = "",
*,
callback_manager: CallbackManager | None = None,
run_id: str = "",
model_name: str = "",
) -> list[LearnedInsight]
Extract insights from conversation text.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
conversation
|
str
|
The raw conversation text to analyze. |
required |
tenant_id
|
str
|
Tenant identifier to stamp on each insight. |
''
|
callback_manager
|
CallbackManager | None
|
v7.4.3 -- when present, fires
|
None
|
run_id
|
str
|
Engine run identifier for callback correlation. |
''
|
model_name
|
str
|
Optional model identifier to stamp on the
LLMEndEvent. When empty, falls back to |
''
|
Returns:
| Type | Description |
|---|---|
list[LearnedInsight]
|
List of LearnedInsight objects above the min_confidence threshold. |
list[LearnedInsight]
|
Returns empty list when no LLM is configured or the conversation |
list[LearnedInsight]
|
is blank (never raises). |