Urgency Analysis¶
Custom urgency_levels (level names), response_times (one time per level),
and customer_tiers (tier names) determine the allowed categorical values in
the returned schema. For example:
from openaivec.task.customer_support import urgency_analysis
task = urgency_analysis(
urgency_levels={"urgent": "Service outage", "routine": "General inquiry"},
response_times={"urgent": "within_15_minutes", "routine": "within_2_days"},
customer_tiers={"vip": "Priority account", "free": "Free plan"},
)
# task.response_format accepts "urgent", "within_15_minutes", and "vip".
All three choice sets must be nonempty, and response_times must have exactly
the same level keys as urgency_levels. With no custom choices, the original
UrgencyAnalysis model and defaults remain unchanged.
openaivec.task.customer_support.urgency_analysis ¶
Customer inquiry urgency-analysis task definition.
Classes¶
UrgencyAnalysis ¶
Bases: BaseModel
Urgency analysis output.
Functions:¶
urgency_analysis ¶
urgency_analysis(
urgency_levels: Mapping[str, str] | None = None,
response_times: Mapping[str, str] | None = None,
customer_tiers: Mapping[str, str] | None = None,
escalation_rules: Mapping[str, str] | None = None,
urgency_keywords: Mapping[str, list[str]] | None = None,
business_context: str = "general customer support",
business_hours: str = "24/7 support",
sla_rules: Mapping[str, str] | None = None,
) -> PreparedTask[UrgencyAnalysis]
Create an urgency task with schema choices matching configured prompt options.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
urgency_levels
|
Mapping[str, str] | None
|
Level names and descriptions. |
None
|
response_times
|
Mapping[str, str] | None
|
Level-to-response-time choices. |
None
|
customer_tiers
|
Mapping[str, str] | None
|
Tier names and descriptions. |
None
|
escalation_rules
|
Mapping[str, str] | None
|
Escalation guidance. |
None
|
urgency_keywords
|
Mapping[str, list[str]] | None
|
Keywords per level. |
None
|
business_context
|
str
|
Customer-support context. |
'general customer support'
|
business_hours
|
str
|
Operating hours. |
'24/7 support'
|
sla_rules
|
Mapping[str, str] | None
|
SLA guidance by tier. |
None
|
Returns:
| Type | Description |
|---|---|
PreparedTask[UrgencyAnalysis]
|
PreparedTask[UrgencyAnalysis]: Configured task and response schema. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If a choice set is empty or response-time levels do not match urgency levels. |