I am converting natural language to SQL for my database using text to SQL chain. Further I am also finding out a summary of the data (retrieved from the first chain) using fact extraction chain. I have a few issues in the output summary:
-
The summary doesn’t come out to be decent for all queries.
For example, data- [{fruits: apples, sale:200}, {fruits:mango,sale:350}, {fruits:banana, sale:150}]. Summary- Apples have the highest sales followed by mangoes and then banana- which is incorrect. -
My prompt consists of input data and query (in natural language). While passing the prompt for getting summary- the query in natural language is getting converted into SQL and then passed into prompt- which is puzzling me!
For example-
Prompt template-
template=“”"
Your task is to write a summary based on the
information provided in the data delimited by triple backticks following the
steps below-
- Analyse the input data.
- Extract key facts out of the input data.
- Do not add names and figures that are not present in the data.
- Do not write numbers in scientific notation or exponents or any other special symbols.
- Use at most 25 words.
- Do not add any prefix to the output. For example- do not write the output as Summary: or Answer:
Data: {text_input}
“”")
Please suggest edits to the prompt to improve factual accuracy and how to eliminate the second problem. Thank you!