Spaces:
Runtime error
Runtime error
from dataset.dataset_json import data | |
def get_model_prompt(question, inventory): | |
prompt = """ | |
You are an expert in recommending cars to customers, you have to recommend a mini car from the following list only | |
""" | |
for car in inventory: | |
prompt += f"{data[car]}\n " | |
prompt += f""" | |
Question: {question} | |
output should be a json with model name and trim name | |
You will always recommend 3 three options. No more no less. | |
Output Format: | |
[ | |
{{"model": "<model name>", | |
"trim": "<trim name>"}}, | |
{{"model": "<model name>", | |
"trim": "<trim name>"}}, | |
{{"model": "<model name>", | |
"trim": "<trim name>"}} | |
] | |
Example Output: | |
[ | |
{{"model": "clubman", | |
"trim": "Classic Trim"}}, | |
{{"model": "countryman_jcw", | |
"trim": "Iconic Trim"}}, | |
{{"model": "hardtop4_door", | |
"trim": "Signature Trim"}} | |
] | |
""" | |
return prompt | |
def get_question_prompt(question): | |
prompt = f""" | |
Look at the following question and tell if it is relevant to buying cars or not. | |
If it is relevant, output true, if it is not relevant, output false. | |
If the user asks about brands other than MINI, output false. | |
If the question is generic question on buying cars, output true. | |
Question: {question} | |
output should be a json with a boolean value | |
Example output: | |
{{"is_relevant": <true/false>}} | |
The output be a clean json with no extra text or markdown | |
""" | |
return prompt | |