@@ -23,6 +23,7 @@ class TemplatePromptName(str, Enum):
23
23
UPDATE_PROMPT = "UPDATE_PROMPT"
24
24
SPLIT_PROMPT = "SPLIT_PROMPT"
25
25
ZENDESK_LLM_PROMPT = "ZENDESK_LLM_PROMPT"
26
+ SPLIT_ZENDESK_TICKET = "SPLIT_ZENDESK_TICKET"
26
27
27
28
28
29
def _define_custom_prompts () -> dict [TemplatePromptName , BasePromptTemplate ]:
@@ -230,6 +231,32 @@ def _define_custom_prompts() -> dict[TemplatePromptName, BasePromptTemplate]:
230
231
)
231
232
custom_prompts [TemplatePromptName .SPLIT_PROMPT ] = SPLIT_PROMPT
232
233
234
+ # ---------------------------------------------------------------------------
235
+ # Prompt to split a Zendesk input ticket into multiple questions/tasks
236
+ # ---------------------------------------------------------------------------
237
+ system_message_template = (
238
+ "Given a chat history and an input customer support ticket, split and rephrase the ticket into multiple questions/tasks.\n "
239
+ "- Tasks to be understood may require considering the chat history.\n "
240
+ "- If the user input contains different tasks, you shall split the input into multiple tasks.\n "
241
+ "- Each splitted task shall be a standalone, self-contained task which can be understood "
242
+ "without the chat history. You shall rephrase the tasks if needed.\n "
243
+ "- Do NOT try to solve the tasks or answer the questions, "
244
+ "just reformulate them if needed and otherwise return them as is.\n "
245
+ "- Remember, you shall NOT suggest or generate new tasks.\n "
246
+ "- If no tasks are found, return the user input as is in the task list.\n "
247
+ )
248
+
249
+ template_answer = "Input: {task}"
250
+
251
+ SPLIT_ZENDESK_TICKET = ChatPromptTemplate .from_messages (
252
+ [
253
+ SystemMessagePromptTemplate .from_template (system_message_template ),
254
+ MessagesPlaceholder (variable_name = "chat_history" ),
255
+ HumanMessagePromptTemplate .from_template (template_answer ),
256
+ ]
257
+ )
258
+ custom_prompts [TemplatePromptName .SPLIT_ZENDESK_TICKET ] = SPLIT_ZENDESK_TICKET
259
+
233
260
# ---------------------------------------------------------------------------
234
261
# Prompt to grade the relevance of an answer and decide whather to perform a web search
235
262
# ---------------------------------------------------------------------------
@@ -266,12 +293,12 @@ def _define_custom_prompts() -> dict[TemplatePromptName, BasePromptTemplate]:
266
293
You are a Customer Service Agent using Zendesk. You are answering a client query.
267
294
You will be provided with the users metadata, ticket metadata and ticket history which can be used to answer the query.
268
295
You will also have access to the most relevant similar tickets and additional information sometimes such as API calls.
269
- Never add something in brackets that needs to be filled like [your name], [your email], etc.
296
+ Never add something in brackets that needs to be filled like [your name], [your email], etc.
270
297
Do NOT invent information that was not present in previous tickets or in user metabadata or ticket metadata or additional information.
271
298
Always prioritize information from the most recent tickets, especially if they are contradictory.
272
-
299
+
273
300
Here is the current time: {current_time} UTC
274
-
301
+
275
302
Here are default instructions that can be ignored if they are contradictory to the <instructions from me> section:
276
303
<default instructions>
277
304
- Don't be too verbose, use the same amount of details as in similar tickets.
@@ -281,8 +308,8 @@ def _define_custom_prompts() -> dict[TemplatePromptName, BasePromptTemplate]:
281
308
- Answer in the same language as the user.
282
309
- Don't add a signature at the end of the answer, it will be added once the answer is sent.
283
310
</default instructions>
284
-
285
-
311
+
312
+
286
313
Here are instructions that you MUST follow and prioritize over the <default instructions> section:
287
314
<instructions from me>
288
315
{guidelines}
@@ -320,7 +347,7 @@ def _define_custom_prompts() -> dict[TemplatePromptName, BasePromptTemplate]:
320
347
<client_query>
321
348
{client_query}
322
349
</client_query>
323
-
350
+
324
351
Based on the informations provided, answer directly with the message to send to the customer, ready to be sent:
325
352
Answer:"""
326
353
0 commit comments