openaivec 0.10.0__py3-none-any.whl → 1.0.10__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. openaivec/__init__.py +13 -4
  2. openaivec/_cache/__init__.py +12 -0
  3. openaivec/_cache/optimize.py +109 -0
  4. openaivec/_cache/proxy.py +806 -0
  5. openaivec/_di.py +326 -0
  6. openaivec/_embeddings.py +203 -0
  7. openaivec/{log.py → _log.py} +2 -2
  8. openaivec/_model.py +113 -0
  9. openaivec/{prompt.py → _prompt.py} +95 -28
  10. openaivec/_provider.py +207 -0
  11. openaivec/_responses.py +511 -0
  12. openaivec/_schema/__init__.py +9 -0
  13. openaivec/_schema/infer.py +340 -0
  14. openaivec/_schema/spec.py +350 -0
  15. openaivec/_serialize.py +234 -0
  16. openaivec/{util.py → _util.py} +25 -85
  17. openaivec/pandas_ext.py +1635 -425
  18. openaivec/spark.py +604 -335
  19. openaivec/task/__init__.py +27 -29
  20. openaivec/task/customer_support/__init__.py +9 -15
  21. openaivec/task/customer_support/customer_sentiment.py +51 -41
  22. openaivec/task/customer_support/inquiry_classification.py +86 -61
  23. openaivec/task/customer_support/inquiry_summary.py +44 -45
  24. openaivec/task/customer_support/intent_analysis.py +56 -41
  25. openaivec/task/customer_support/response_suggestion.py +49 -43
  26. openaivec/task/customer_support/urgency_analysis.py +76 -71
  27. openaivec/task/nlp/__init__.py +4 -4
  28. openaivec/task/nlp/dependency_parsing.py +19 -20
  29. openaivec/task/nlp/keyword_extraction.py +22 -24
  30. openaivec/task/nlp/morphological_analysis.py +25 -25
  31. openaivec/task/nlp/named_entity_recognition.py +26 -28
  32. openaivec/task/nlp/sentiment_analysis.py +29 -21
  33. openaivec/task/nlp/translation.py +24 -30
  34. openaivec/task/table/__init__.py +3 -0
  35. openaivec/task/table/fillna.py +183 -0
  36. openaivec-1.0.10.dist-info/METADATA +399 -0
  37. openaivec-1.0.10.dist-info/RECORD +39 -0
  38. {openaivec-0.10.0.dist-info → openaivec-1.0.10.dist-info}/WHEEL +1 -1
  39. openaivec/embeddings.py +0 -172
  40. openaivec/responses.py +0 -392
  41. openaivec/serialize.py +0 -225
  42. openaivec/task/model.py +0 -84
  43. openaivec-0.10.0.dist-info/METADATA +0 -546
  44. openaivec-0.10.0.dist-info/RECORD +0 -29
  45. {openaivec-0.10.0.dist-info → openaivec-1.0.10.dist-info}/licenses/LICENSE +0 -0
@@ -6,31 +6,31 @@ and management reporting.
6
6
 
7
7
  Example:
8
8
  Basic usage with BatchResponses:
9
-
9
+
10
10
  ```python
11
11
  from openai import OpenAI
12
- from openaivec.responses import BatchResponses
12
+ from openaivec import BatchResponses
13
13
  from openaivec.task import customer_support
14
-
14
+
15
15
  client = OpenAI()
16
16
  summarizer = BatchResponses.of_task(
17
17
  client=client,
18
- model_name="gpt-4o-mini",
18
+ model_name="gpt-4.1-mini",
19
19
  task=customer_support.INQUIRY_SUMMARY
20
20
  )
21
-
21
+
22
22
  inquiries = [
23
- '''Hi there, I've been having trouble with my account for the past week.
24
- Every time I try to log in, it says my password is incorrect, but I'm sure
25
- it's right. I tried resetting it twice but the email never arrives.
23
+ '''Hi there, I've been having trouble with my account for the past week.
24
+ Every time I try to log in, it says my password is incorrect, but I'm sure
25
+ it's right. I tried resetting it twice but the email never arrives.
26
26
  I'm getting really frustrated because I need to access my files for work tomorrow.''',
27
-
28
- '''I love your product! It's been incredibly helpful for my team.
29
- However, I was wondering if there's any way to get more storage space?
27
+
28
+ '''I love your product! It's been incredibly helpful for my team.
29
+ However, I was wondering if there's any way to get more storage space?
30
30
  We're running out and would like to upgrade our plan.'''
31
31
  ]
32
32
  summaries = summarizer.parse(inquiries)
33
-
33
+
34
34
  for summary in summaries:
35
35
  print(f"Summary: {summary.summary}")
36
36
  print(f"Issue: {summary.main_issue}")
@@ -39,30 +39,31 @@ Example:
39
39
  ```
40
40
 
41
41
  With pandas integration:
42
-
42
+
43
43
  ```python
44
44
  import pandas as pd
45
45
  from openaivec import pandas_ext # Required for .ai accessor
46
46
  from openaivec.task import customer_support
47
-
47
+
48
48
  df = pd.DataFrame({"inquiry": [long_inquiry_text]})
49
49
  df["summary"] = df["inquiry"].ai.task(customer_support.INQUIRY_SUMMARY)
50
-
50
+
51
51
  # Extract summary components
52
52
  extracted_df = df.ai.extract("summary")
53
53
  print(extracted_df[["inquiry", "summary_main_issue", "summary_resolution_status"]])
54
54
  ```
55
55
 
56
56
  Attributes:
57
- INQUIRY_SUMMARY (PreparedTask): A prepared task instance
58
- configured for inquiry summarization with temperature=0.0 and
57
+ INQUIRY_SUMMARY (PreparedTask): A prepared task instance
58
+ configured for inquiry summarization with temperature=0.0 and
59
59
  top_p=1.0 for deterministic output.
60
60
  """
61
61
 
62
- from typing import List, Literal
62
+ from typing import Literal
63
+
63
64
  from pydantic import BaseModel, Field
64
65
 
65
- from ..model import PreparedTask
66
+ from openaivec._model import PreparedTask
66
67
 
67
68
  __all__ = ["inquiry_summary"]
68
69
 
@@ -70,13 +71,15 @@ __all__ = ["inquiry_summary"]
70
71
  class InquirySummary(BaseModel):
71
72
  summary: str = Field(description="Concise summary of the customer inquiry (2-3 sentences)")
72
73
  main_issue: str = Field(description="Primary problem or request being addressed")
73
- secondary_issues: List[str] = Field(description="Additional issues mentioned in the inquiry")
74
+ secondary_issues: list[str] = Field(description="Additional issues mentioned in the inquiry")
74
75
  customer_background: str = Field(description="Relevant customer context or history mentioned")
75
- actions_taken: List[str] = Field(description="Steps the customer has already attempted")
76
+ actions_taken: list[str] = Field(description="Steps the customer has already attempted")
76
77
  timeline: str = Field(description="Timeline of events or when the issue started")
77
78
  impact_description: str = Field(description="How the issue affects the customer")
78
- resolution_status: Literal["not_started", "in_progress", "needs_escalation", "resolved"] = Field(description="Current status (not_started, in_progress, needs_escalation, resolved)")
79
- key_details: List[str] = Field(description="Important technical details, error messages, or specifics")
79
+ resolution_status: Literal["not_started", "in_progress", "needs_escalation", "resolved"] = Field(
80
+ description="Current status (not_started, in_progress, needs_escalation, resolved)"
81
+ )
82
+ key_details: list[str] = Field(description="Important technical details, error messages, or specifics")
80
83
  follow_up_needed: bool = Field(description="Whether follow-up communication is required")
81
84
  summary_confidence: float = Field(description="Confidence in summary accuracy (0.0-1.0)")
82
85
 
@@ -84,34 +87,31 @@ class InquirySummary(BaseModel):
84
87
  def inquiry_summary(
85
88
  summary_length: str = "concise",
86
89
  business_context: str = "general customer support",
87
- temperature: float = 0.0,
88
- top_p: float = 1.0
89
90
  ) -> PreparedTask:
90
91
  """Create a configurable inquiry summary task.
91
-
92
+
92
93
  Args:
93
- summary_length: Length of summary (concise, detailed, bullet_points).
94
- business_context: Business context for summary.
95
- temperature: Sampling temperature (0.0-1.0).
96
- top_p: Nucleus sampling parameter (0.0-1.0).
97
-
94
+ summary_length (str): Length of summary (concise, detailed, bullet_points).
95
+ business_context (str): Business context for summary.
96
+
98
97
  Returns:
99
98
  PreparedTask configured for inquiry summarization.
100
99
  """
101
-
100
+
102
101
  length_instructions = {
103
102
  "concise": "Write a concise 2-3 sentence summary that captures the essence of the inquiry",
104
103
  "detailed": "Write a detailed 4-6 sentence summary that includes comprehensive context",
105
- "bullet_points": "Create a bullet-point summary with key facts and actions"
104
+ "bullet_points": "Create a bullet-point summary with key facts and actions",
106
105
  }
107
-
108
- instructions = f"""Create a comprehensive summary of the customer inquiry that captures all essential information for support agents and management.
106
+
107
+ instructions = f"""Create a comprehensive summary of the customer inquiry that captures all
108
+ essential information for support agents and management.
109
109
 
110
110
  Business Context: {business_context}
111
- Summary Style: {length_instructions.get(summary_length, length_instructions['concise'])}
111
+ Summary Style: {length_instructions.get(summary_length, length_instructions["concise"])}
112
112
 
113
113
  Summary Guidelines:
114
- 1. {length_instructions.get(summary_length, length_instructions['concise'])}
114
+ 1. {length_instructions.get(summary_length, length_instructions["concise"])}
115
115
  2. Identify the primary issue or request clearly
116
116
  3. Note any secondary issues that may need attention
117
117
  4. Extract relevant customer background or context
@@ -151,17 +151,16 @@ Focus on:
151
151
  - Clear distinction between symptoms and root causes
152
152
  - Relevant background without unnecessary details
153
153
 
154
- IMPORTANT: Provide summary responses in the same language as the input text, except for the predefined categorical field (resolution_status) which must use the exact English values specified above (not_started, in_progress, needs_escalation, resolved). For example, if the input is in German, provide all summary content in German, but use English values like "in_progress" for resolution_status.
154
+ IMPORTANT: Provide summary responses in the same language as the input text, except for the
155
+ predefined categorical field (resolution_status) which must use the exact English values
156
+ specified above (not_started, in_progress, needs_escalation, resolved). For example, if the
157
+ input is in German, provide all summary content in German, but use English values like
158
+ "in_progress" for resolution_status.
155
159
 
156
160
  Provide accurate, actionable summary that enables efficient support resolution."""
157
161
 
158
- return PreparedTask(
159
- instructions=instructions,
160
- response_format=InquirySummary,
161
- temperature=temperature,
162
- top_p=top_p
163
- )
162
+ return PreparedTask(instructions=instructions, response_format=InquirySummary)
164
163
 
165
164
 
166
165
  # Backward compatibility - default configuration
167
- INQUIRY_SUMMARY = inquiry_summary()
166
+ INQUIRY_SUMMARY = inquiry_summary()
@@ -5,26 +5,26 @@ what the customer is trying to achieve and how to best assist them.
5
5
 
6
6
  Example:
7
7
  Basic usage with BatchResponses:
8
-
8
+
9
9
  ```python
10
10
  from openai import OpenAI
11
- from openaivec.responses import BatchResponses
11
+ from openaivec import BatchResponses
12
12
  from openaivec.task import customer_support
13
-
13
+
14
14
  client = OpenAI()
15
15
  analyzer = BatchResponses.of_task(
16
16
  client=client,
17
- model_name="gpt-4o-mini",
17
+ model_name="gpt-4.1-mini",
18
18
  task=customer_support.INTENT_ANALYSIS
19
19
  )
20
-
20
+
21
21
  inquiries = [
22
22
  "I want to upgrade my plan to get more storage",
23
23
  "How do I delete my account? I'm not satisfied with the service",
24
24
  "Can you walk me through setting up the mobile app?"
25
25
  ]
26
26
  intents = analyzer.parse(inquiries)
27
-
27
+
28
28
  for intent in intents:
29
29
  print(f"Primary Intent: {intent.primary_intent}")
30
30
  print(f"Action Required: {intent.action_required}")
@@ -33,67 +33,83 @@ Example:
33
33
  ```
34
34
 
35
35
  With pandas integration:
36
-
36
+
37
37
  ```python
38
38
  import pandas as pd
39
39
  from openaivec import pandas_ext # Required for .ai accessor
40
40
  from openaivec.task import customer_support
41
-
41
+
42
42
  df = pd.DataFrame({"inquiry": [
43
43
  "I want to upgrade my plan to get more storage",
44
44
  "How do I delete my account? I'm not satisfied with the service",
45
45
  "Can you walk me through setting up the mobile app?"
46
46
  ]})
47
47
  df["intent"] = df["inquiry"].ai.task(customer_support.INTENT_ANALYSIS)
48
-
48
+
49
49
  # Extract intent components
50
50
  extracted_df = df.ai.extract("intent")
51
51
  print(extracted_df[["inquiry", "intent_primary_intent", "intent_action_required", "intent_success_likelihood"]])
52
52
  ```
53
53
 
54
54
  Attributes:
55
- INTENT_ANALYSIS (PreparedTask): A prepared task instance
56
- configured for intent analysis with temperature=0.0 and
57
- top_p=1.0 for deterministic output.
55
+ INTENT_ANALYSIS (PreparedTask): A prepared task instance configured for intent
56
+ analysis. Provide ``temperature=0.0`` and ``top_p=1.0`` to your API calls
57
+ for deterministic output.
58
58
  """
59
59
 
60
- from typing import List, Literal
60
+ from typing import Literal
61
+
61
62
  from pydantic import BaseModel, Field
62
63
 
63
- from ..model import PreparedTask
64
+ from openaivec._model import PreparedTask
64
65
 
65
66
  __all__ = ["intent_analysis"]
66
67
 
67
68
 
68
69
  class IntentAnalysis(BaseModel):
69
- primary_intent: Literal["get_help", "make_purchase", "cancel_service", "get_refund", "report_issue", "seek_information", "request_feature", "provide_feedback"] = Field(description="Primary customer intent (get_help, make_purchase, cancel_service, get_refund, report_issue, seek_information, request_feature, provide_feedback)")
70
- secondary_intents: List[str] = Field(description="Additional intents if multiple goals are present")
71
- action_required: Literal["provide_information", "troubleshoot", "process_request", "escalate", "redirect", "schedule_callback"] = Field(description="Required action (provide_information, troubleshoot, process_request, escalate, redirect, schedule_callback)")
70
+ primary_intent: Literal[
71
+ "get_help",
72
+ "make_purchase",
73
+ "cancel_service",
74
+ "get_refund",
75
+ "report_issue",
76
+ "seek_information",
77
+ "request_feature",
78
+ "provide_feedback",
79
+ ] = Field(
80
+ description="Primary customer intent (get_help, make_purchase, cancel_service, "
81
+ "get_refund, report_issue, seek_information, request_feature, provide_feedback)"
82
+ )
83
+ secondary_intents: list[str] = Field(description="Additional intents if multiple goals are present")
84
+ action_required: Literal[
85
+ "provide_information", "troubleshoot", "process_request", "escalate", "redirect", "schedule_callback"
86
+ ] = Field(
87
+ description="Required action (provide_information, troubleshoot, process_request, "
88
+ "escalate, redirect, schedule_callback)"
89
+ )
72
90
  intent_confidence: float = Field(description="Confidence in intent detection (0.0-1.0)")
73
- success_likelihood: Literal["very_high", "high", "medium", "low", "very_low"] = Field(description="Likelihood of successful resolution (very_high, high, medium, low, very_low)")
91
+ success_likelihood: Literal["very_high", "high", "medium", "low", "very_low"] = Field(
92
+ description="Likelihood of successful resolution (very_high, high, medium, low, very_low)"
93
+ )
74
94
  customer_goal: str = Field(description="What the customer ultimately wants to achieve")
75
- implicit_needs: List[str] = Field(description="Unstated needs or concerns that may need addressing")
76
- blocking_factors: List[str] = Field(description="Potential obstacles to achieving customer goal")
77
- next_steps: List[str] = Field(description="Recommended next steps to address customer intent")
78
- resolution_complexity: Literal["simple", "moderate", "complex", "very_complex"] = Field(description="Complexity of resolution (simple, moderate, complex, very_complex)")
95
+ implicit_needs: list[str] = Field(description="Unstated needs or concerns that may need addressing")
96
+ blocking_factors: list[str] = Field(description="Potential obstacles to achieving customer goal")
97
+ next_steps: list[str] = Field(description="Recommended next steps to address customer intent")
98
+ resolution_complexity: Literal["simple", "moderate", "complex", "very_complex"] = Field(
99
+ description="Complexity of resolution (simple, moderate, complex, very_complex)"
100
+ )
79
101
 
80
102
 
81
- def intent_analysis(
82
- business_context: str = "general customer support",
83
- temperature: float = 0.0,
84
- top_p: float = 1.0
85
- ) -> PreparedTask:
103
+ def intent_analysis(business_context: str = "general customer support") -> PreparedTask:
86
104
  """Create a configurable intent analysis task.
87
-
105
+
88
106
  Args:
89
- business_context: Business context for intent analysis.
90
- temperature: Sampling temperature (0.0-1.0).
91
- top_p: Nucleus sampling parameter (0.0-1.0).
92
-
107
+ business_context (str): Business context for intent analysis.
108
+
93
109
  Returns:
94
110
  PreparedTask configured for intent analysis.
95
111
  """
96
-
112
+
97
113
  instructions = f"""Analyze customer intent to understand their goals, needs, and how to best assist them.
98
114
 
99
115
  Business Context: {business_context}
@@ -143,17 +159,16 @@ Pay attention to:
143
159
  - Urgency indicators: Time pressure affects resolution approach
144
160
  - Previous interactions: References to prior support contacts
145
161
 
146
- IMPORTANT: Provide analysis responses in the same language as the input text, except for the predefined categorical fields (primary_intent, action_required, success_likelihood, resolution_complexity) which must use the exact English values specified above. For example, if the input is in Japanese, provide customer_goal, implicit_needs, blocking_factors, next_steps, and reasoning in Japanese, but use English values like "get_help" for primary_intent.
162
+ IMPORTANT: Provide analysis responses in the same language as the input text, except for the
163
+ predefined categorical fields (primary_intent, action_required, success_likelihood,
164
+ resolution_complexity) which must use the exact English values specified above. For example,
165
+ if the input is in Japanese, provide customer_goal, implicit_needs, blocking_factors,
166
+ next_steps, and reasoning in Japanese, but use English values like "get_help" for primary_intent.
147
167
 
148
168
  Provide comprehensive intent analysis with actionable recommendations."""
149
169
 
150
- return PreparedTask(
151
- instructions=instructions,
152
- response_format=IntentAnalysis,
153
- temperature=temperature,
154
- top_p=top_p
155
- )
170
+ return PreparedTask(instructions=instructions, response_format=IntentAnalysis)
156
171
 
157
172
 
158
173
  # Backward compatibility - default configuration
159
- INTENT_ANALYSIS = intent_analysis()
174
+ INTENT_ANALYSIS = intent_analysis()
@@ -6,26 +6,26 @@ and professional communication.
6
6
 
7
7
  Example:
8
8
  Basic usage with BatchResponses:
9
-
9
+
10
10
  ```python
11
11
  from openai import OpenAI
12
- from openaivec.responses import BatchResponses
12
+ from openaivec import BatchResponses
13
13
  from openaivec.task import customer_support
14
-
14
+
15
15
  client = OpenAI()
16
16
  responder = BatchResponses.of_task(
17
17
  client=client,
18
- model_name="gpt-4o-mini",
18
+ model_name="gpt-4.1-mini",
19
19
  task=customer_support.RESPONSE_SUGGESTION
20
20
  )
21
-
21
+
22
22
  inquiries = [
23
23
  "I can't access my account. I've tried resetting my password but the email never arrives.",
24
24
  "I'm really disappointed with your service. This is the third time I've had issues.",
25
25
  "Thank you for your help yesterday! The problem is now resolved."
26
26
  ]
27
27
  responses = responder.parse(inquiries)
28
-
28
+
29
29
  for response in responses:
30
30
  print(f"Suggested Response: {response.suggested_response}")
31
31
  print(f"Tone: {response.tone}")
@@ -34,48 +34,57 @@ Example:
34
34
  ```
35
35
 
36
36
  With pandas integration:
37
-
37
+
38
38
  ```python
39
39
  import pandas as pd
40
40
  from openaivec import pandas_ext # Required for .ai accessor
41
41
  from openaivec.task import customer_support
42
-
42
+
43
43
  df = pd.DataFrame({"inquiry": [
44
44
  "I can't access my account. I've tried resetting my password but the email never arrives.",
45
45
  "I'm really disappointed with your service. This is the third time I've had issues."
46
46
  ]})
47
47
  df["response"] = df["inquiry"].ai.task(customer_support.RESPONSE_SUGGESTION)
48
-
48
+
49
49
  # Extract response components
50
50
  extracted_df = df.ai.extract("response")
51
51
  print(extracted_df[["inquiry", "response_suggested_response", "response_tone", "response_priority"]])
52
52
  ```
53
53
 
54
54
  Attributes:
55
- RESPONSE_SUGGESTION (PreparedTask): A prepared task instance
56
- configured for response suggestion with temperature=0.0 and
55
+ RESPONSE_SUGGESTION (PreparedTask): A prepared task instance
56
+ configured for response suggestion with temperature=0.0 and
57
57
  top_p=1.0 for deterministic output.
58
58
  """
59
59
 
60
- from typing import List, Literal
60
+ from typing import Literal
61
+
61
62
  from pydantic import BaseModel, Field
62
63
 
63
- from ..model import PreparedTask
64
+ from openaivec._model import PreparedTask
64
65
 
65
66
  __all__ = ["response_suggestion"]
66
67
 
67
68
 
68
69
  class ResponseSuggestion(BaseModel):
69
70
  suggested_response: str = Field(description="Professional response draft for the customer inquiry")
70
- tone: Literal["empathetic", "professional", "friendly", "apologetic", "solution_focused"] = Field(description="Recommended tone (empathetic, professional, friendly, apologetic, solution_focused)")
71
- priority: Literal["immediate", "high", "medium", "low"] = Field(description="Response priority (immediate, high, medium, low)")
72
- response_type: Literal["acknowledgment", "solution", "escalation", "information_request", "closure"] = Field(description="Type of response (acknowledgment, solution, escalation, information_request, closure)")
73
- key_points: List[str] = Field(description="Main points that must be addressed in the response")
71
+ tone: Literal["empathetic", "professional", "friendly", "apologetic", "solution_focused"] = Field(
72
+ description="Recommended tone (empathetic, professional, friendly, apologetic, solution_focused)"
73
+ )
74
+ priority: Literal["immediate", "high", "medium", "low"] = Field(
75
+ description="Response priority (immediate, high, medium, low)"
76
+ )
77
+ response_type: Literal["acknowledgment", "solution", "escalation", "information_request", "closure"] = Field(
78
+ description="Type of response (acknowledgment, solution, escalation, information_request, closure)"
79
+ )
80
+ key_points: list[str] = Field(description="Main points that must be addressed in the response")
74
81
  follow_up_required: bool = Field(description="Whether follow-up communication is needed")
75
82
  escalation_suggested: bool = Field(description="Whether escalation to management is recommended")
76
- resources_needed: List[str] = Field(description="Additional resources or information required")
77
- estimated_resolution_time: Literal["immediate", "hours", "days", "weeks"] = Field(description="Estimated time to resolution (immediate, hours, days, weeks)")
78
- alternative_responses: List[str] = Field(description="Alternative response options for different scenarios")
83
+ resources_needed: list[str] = Field(description="Additional resources or information required")
84
+ estimated_resolution_time: Literal["immediate", "hours", "days", "weeks"] = Field(
85
+ description="Estimated time to resolution (immediate, hours, days, weeks)"
86
+ )
87
+ alternative_responses: list[str] = Field(description="Alternative response options for different scenarios")
79
88
  personalization_notes: str = Field(description="Suggestions for personalizing the response")
80
89
 
81
90
 
@@ -83,34 +92,31 @@ def response_suggestion(
83
92
  response_style: str = "professional",
84
93
  company_name: str = "our company",
85
94
  business_context: str = "general customer support",
86
- temperature: float = 0.0,
87
- top_p: float = 1.0
88
95
  ) -> PreparedTask:
89
96
  """Create a configurable response suggestion task.
90
-
97
+
91
98
  Args:
92
- response_style: Style of response (professional, friendly, empathetic, formal).
93
- company_name: Name of the company for personalization.
94
- business_context: Business context for responses.
95
- temperature: Sampling temperature (0.0-1.0).
96
- top_p: Nucleus sampling parameter (0.0-1.0).
97
-
99
+ response_style (str): Style of response (professional, friendly, empathetic, formal).
100
+ company_name (str): Name of the company for personalization.
101
+ business_context (str): Business context for responses.
102
+
98
103
  Returns:
99
104
  PreparedTask configured for response suggestions.
100
105
  """
101
-
106
+
102
107
  style_instructions = {
103
108
  "professional": "Maintain professional tone with clear, direct communication",
104
109
  "friendly": "Use warm, approachable language while remaining professional",
105
110
  "empathetic": "Show understanding and compassion for customer concerns",
106
- "formal": "Use formal business language appropriate for official communications"
111
+ "formal": "Use formal business language appropriate for official communications",
107
112
  }
108
-
109
- instructions = f"""Generate a professional, helpful response suggestion for the customer inquiry that addresses their needs effectively.
113
+
114
+ instructions = f"""Generate a professional, helpful response suggestion for the customer
115
+ inquiry that addresses their needs effectively.
110
116
 
111
117
  Business Context: {business_context}
112
118
  Company Name: {company_name}
113
- Response Style: {style_instructions.get(response_style, style_instructions['professional'])}
119
+ Response Style: {style_instructions.get(response_style, style_instructions["professional"])}
114
120
 
115
121
  Response Guidelines:
116
122
  1. Address the customer's main concern directly
@@ -171,17 +177,17 @@ Avoid:
171
177
  - Dismissing customer concerns
172
178
  - Lengthy responses that don't address the main issue
173
179
 
174
- IMPORTANT: Generate responses in the same language as the input text, except for the predefined categorical fields (tone, priority, response_type, estimated_resolution_time) which must use the exact English values specified above. For example, if the input is in Italian, provide suggested_response, key_points, alternative_responses, and personalization_notes in Italian, but use English values like "empathetic" for tone.
180
+ IMPORTANT: Generate responses in the same language as the input text, except for the predefined
181
+ categorical fields (tone, priority, response_type, estimated_resolution_time) which must use
182
+ the exact English values specified above. For example, if the input is in Italian, provide
183
+ suggested_response, key_points, alternative_responses, and personalization_notes in Italian,
184
+ but use English values like "empathetic" for tone.
175
185
 
176
- Generate helpful, professional response that moves toward resolution while maintaining positive customer relationship."""
186
+ Generate helpful, professional response that moves toward resolution while maintaining
187
+ positive customer relationship."""
177
188
 
178
- return PreparedTask(
179
- instructions=instructions,
180
- response_format=ResponseSuggestion,
181
- temperature=temperature,
182
- top_p=top_p
183
- )
189
+ return PreparedTask(instructions=instructions, response_format=ResponseSuggestion)
184
190
 
185
191
 
186
192
  # Backward compatibility - default configuration
187
- RESPONSE_SUGGESTION = response_suggestion()
193
+ RESPONSE_SUGGESTION = response_suggestion()