Spaces:
Sleeping
Sleeping
Commit ·
c56805a
1
Parent(s): f2733e6
Update app.py
Browse files
app.py
CHANGED
|
@@ -61,26 +61,33 @@ if index is None:
|
|
| 61 |
|
| 62 |
text = st.text_input("Query text:", value="Insert PQL here to generate Definitions or ask a PQL related question")
|
| 63 |
|
| 64 |
-
sub_prompt_instruction = """
|
| 65 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 66 |
|
| 67 |
[QUERY: COUNT_TABLE(\"_CEL_AP_ACTIVITIES\"),
|
| 68 |
QUERY: SUM( CASE\n WHEN KPI(\"FORMULA_Activity_CLASSIFICATION_UserType\") = 'MANUAL'\n THEN 1 ELSE NULL\nEND )*1.0,
|
| 69 |
QUERY: SUM( \n CASE\n WHEN \"_CEL_AP_ACTIVITIES\".\"ACTIVITY_EN\" NOT IN ( 'Due Date passed', 'Cash Discount Due Date passed', 'Vendor Creates Invoice', 'Record Goods Receipt')\n THEN 1 ELSE 0\n END \n)]
|
| 70 |
|
| 71 |
-
|
| 72 |
|
| 73 |
1. DEFINITION: Get a full count of the activities table.
|
| 74 |
QUERY: COUNT_TABLE(\"_CEL_AP_ACTIVITIES\"),
|
| 75 |
|
| 76 |
-
|
| 77 |
2. DEFINITION: Get a count of the number of activities with manual users.
|
| 78 |
QUERY: SUM( CASE\n WHEN KPI(\"FORMULA_Activity_CLASSIFICATION_UserType\") = 'MANUAL'\n THEN 1 ELSE NULL\nEND )*1.0,
|
| 79 |
|
| 80 |
-
|
| 81 |
-
3. DEFINITION: Get a count of the number of activities that are not titled 'Due Date passed', 'Cash Discount Due Date passed', 'Vendor Creates Invoice', or 'Record Goods Receipt'""
|
| 82 |
QUERY: SUM( \n CASE\n WHEN \"_CEL_AP_ACTIVITIES\".\"ACTIVITY_EN\" NOT IN ( 'Due Date passed', 'Cash Discount Due Date passed', 'Vendor Creates Invoice', 'Record Goods Receipt')\n THEN 1 ELSE 0\n END \n)
|
| 83 |
-
|
| 84 |
"""
|
| 85 |
|
| 86 |
combined_prompt = f"{sub_prompt_instruction} {text}"
|
|
|
|
| 61 |
|
| 62 |
text = st.text_input("Query text:", value="Insert PQL here to generate Definitions or ask a PQL related question")
|
| 63 |
|
| 64 |
+
sub_prompt_instruction = sub_prompt_instruction = """
|
| 65 |
+
Generate a list of definitions and corresponding PQL queries based on the provided list of PQL queries. Ensure that the output maintains the order of the queries. For each query in the list, follow the format below:
|
| 66 |
+
|
| 67 |
+
1. DEFINITION: [Definition for Query 1]
|
| 68 |
+
QUERY: [PQL Query 1],
|
| 69 |
+
|
| 70 |
+
2. DEFINITION: [Definition for Query 2]
|
| 71 |
+
QUERY: [PQL Query 2],
|
| 72 |
+
|
| 73 |
+
[Continue for all queries in the list]
|
| 74 |
+
|
| 75 |
+
For example, if given this list of PQL queries:
|
| 76 |
|
| 77 |
[QUERY: COUNT_TABLE(\"_CEL_AP_ACTIVITIES\"),
|
| 78 |
QUERY: SUM( CASE\n WHEN KPI(\"FORMULA_Activity_CLASSIFICATION_UserType\") = 'MANUAL'\n THEN 1 ELSE NULL\nEND )*1.0,
|
| 79 |
QUERY: SUM( \n CASE\n WHEN \"_CEL_AP_ACTIVITIES\".\"ACTIVITY_EN\" NOT IN ( 'Due Date passed', 'Cash Discount Due Date passed', 'Vendor Creates Invoice', 'Record Goods Receipt')\n THEN 1 ELSE 0\n END \n)]
|
| 80 |
|
| 81 |
+
The output should be as follows:
|
| 82 |
|
| 83 |
1. DEFINITION: Get a full count of the activities table.
|
| 84 |
QUERY: COUNT_TABLE(\"_CEL_AP_ACTIVITIES\"),
|
| 85 |
|
|
|
|
| 86 |
2. DEFINITION: Get a count of the number of activities with manual users.
|
| 87 |
QUERY: SUM( CASE\n WHEN KPI(\"FORMULA_Activity_CLASSIFICATION_UserType\") = 'MANUAL'\n THEN 1 ELSE NULL\nEND )*1.0,
|
| 88 |
|
| 89 |
+
3. DEFINITION: Get a count of the number of activities that are not titled 'Due Date passed', 'Cash Discount Due Date passed', 'Vendor Creates Invoice', or 'Record Goods Receipt'.
|
|
|
|
| 90 |
QUERY: SUM( \n CASE\n WHEN \"_CEL_AP_ACTIVITIES\".\"ACTIVITY_EN\" NOT IN ( 'Due Date passed', 'Cash Discount Due Date passed', 'Vendor Creates Invoice', 'Record Goods Receipt')\n THEN 1 ELSE 0\n END \n)
|
|
|
|
| 91 |
"""
|
| 92 |
|
| 93 |
combined_prompt = f"{sub_prompt_instruction} {text}"
|