Inquiry Summary¶
Inquiry summary task for customer support interactions.
This module provides a predefined task for summarizing customer inquiries, extracting key information, and creating concise summaries for support agents and management reporting.
Example
Basic usage with BatchResponses:
from openai import OpenAI
from openaivec.responses import BatchResponses
from openaivec.task import customer_support
client = OpenAI()
summarizer = BatchResponses.of_task(
client=client,
model_name="gpt-4o-mini",
task=customer_support.INQUIRY_SUMMARY
)
inquiries = [
'''Hi there, I've been having trouble with my account for the past week.
Every time I try to log in, it says my password is incorrect, but I'm sure
it's right. I tried resetting it twice but the email never arrives.
I'm getting really frustrated because I need to access my files for work tomorrow.''',
'''I love your product! It's been incredibly helpful for my team.
However, I was wondering if there's any way to get more storage space?
We're running out and would like to upgrade our plan.'''
]
summaries = summarizer.parse(inquiries)
for summary in summaries:
print(f"Summary: {summary.summary}")
print(f"Issue: {summary.main_issue}")
print(f"Actions Taken: {summary.actions_taken}")
print(f"Resolution Status: {summary.resolution_status}")
With pandas integration:
import pandas as pd
from openaivec import pandas_ext # Required for .ai accessor
from openaivec.task import customer_support
df = pd.DataFrame({"inquiry": [long_inquiry_text]})
df["summary"] = df["inquiry"].ai.task(customer_support.INQUIRY_SUMMARY)
# Extract summary components
extracted_df = df.ai.extract("summary")
print(extracted_df[["inquiry", "summary_main_issue", "summary_resolution_status"]])
Attributes:
Name | Type | Description |
---|---|---|
INQUIRY_SUMMARY |
PreparedTask
|
A prepared task instance configured for inquiry summarization with temperature=0.0 and top_p=1.0 for deterministic output. |
inquiry_summary(summary_length='concise', business_context='general customer support', temperature=0.0, top_p=1.0)
¶
Create a configurable inquiry summary task.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
summary_length
|
str
|
Length of summary (concise, detailed, bullet_points). |
'concise'
|
business_context
|
str
|
Business context for summary. |
'general customer support'
|
temperature
|
float
|
Sampling temperature (0.0-1.0). |
0.0
|
top_p
|
float
|
Nucleus sampling parameter (0.0-1.0). |
1.0
|
Returns:
Type | Description |
---|---|
PreparedTask
|
PreparedTask configured for inquiry summarization. |
Source code in src/openaivec/task/customer_support/inquiry_summary.py
84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 |
|