Spaces:
Sleeping
Sleeping
File size: 3,040 Bytes
6848c8b c493259 ae3c993 c493259 ae3c993 6848c8b ae3c993 6848c8b ae3c993 6848c8b ae3c993 6848c8b ae3c993 c493259 ae3c993 c493259 ae3c993 c493259 ae3c993 6848c8b c493259 6848c8b ae3c993 c493259 6848c8b ae3c993 6848c8b ae3c993 6848c8b ae3c993 6848c8b | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 | def load_prompts(prompt="default", context="", response_type=None):
"""
Load the prompts from a file or define them in the code.
Args:
prompt (str): The prompt to load.
context (str): The context to use in the prompt.
response_type (str): The style of language the answer should use.
Returns:
str: The loaded prompt.
"""
# choose response_type
if response_type == "Simple Language":
response_type = "Use plain language and explain so that a 5th grader would understand."
elif response_type == "Technical":
response_type = "Use technical jargon and provide detailed explanations."
elif response_type == "Homer Simpson Language":
response_type = "Use simple language and explain it like Homer Simpson would."
elif response_type == "Sarcasm":
response_type = "Use sarcastic language and tone."
elif response_type is None:
response_type = ""
# choose prompt and append response_type
if prompt == "default":
prompt = ("""You are a helpful assistant that helps users with the repair of their devices.
Ask them if they need help with a repair.
If they do, ask them to provide the device name and model. """ + response_type)
elif prompt == "diagnose_issue":
prompt = ("""
You are a helpful assistant.
Your job is to determine if an appliance or device, the brand of the appliance or device,
the model of the appliance or device and the user's issue with the applicance or device
were mentioned in the user's message.
If yes, extract the appliance or device, its model and its issue and confirm it back to the user and stop asking for information.
If not, continue to ask the user to provide the missing information until they provide it.
Do not provide troubleshooting steps or solutions.""" + response_type)
elif prompt == "repair_guide":
prompt = (f"List repair steps for the Problem. Use the following context:\n{context}. " + response_type)
elif prompt == "repair_helper":
prompt = (f"Answer the users question about the guide. Use the following context:\n{context}. " + response_type)
# create support ticket
elif prompt == "support_ticket":
prompt = ("""
You are a technical support assistant. Based on the user's input, generate a structured support ticket with the following fields:
1. Device Type
2. Brand and Model
3. Serial Number (if available)
4. Problem Description
5. Troubleshooting Steps Already Taken
6. Additional Notes (if available)
Ensure the ticket is clear and concise, suitable for submission to a professional repair service.
""" + response_type)
return prompt |