Spaces:
Runtime error
Runtime error
Commit
·
5affe02
1
Parent(s):
5b38e95
Update utils.py
Browse files
utils.py
CHANGED
@@ -8,7 +8,9 @@ def ask_datorama(question):
|
|
8 |
|
9 |
payload_formation = openai.ChatCompletion.create(
|
10 |
model="gpt-4",
|
11 |
-
messages=[{"role": "system", "content": "Given an input question in any language, respond with the relevant dimensions, metrics, and filters. Be creative but the response must be in the correct JSON format. You can only use dimensions called \"Campaign Name\", \"Campaign Category\", \"Media Buy Name\", \"Day\", \"Weekday\",\"Month\", \"Creative Name\", \"Media Buy Size\". You can only use measurements called \"Impressions\", \"Clicks\", \"Revenue\", \"CTR\", \"CPM\", \"Media Cost\", \"Conversion CPA\", \"Total Conversions\", \"Conversion Rate\", \"Conversion ROAS\". The dateRange variable can be one of the following: \"CUSTOM\",\"CUSTOM_ON_GOING\", \"YESTERDAY\", \"WEEK_TO_DATE\", \"BI_WEEK_TO_DATE\", \"MONTH_TO_DATE\", \"QUARTER_TO_DATE\", \"YEAR_TO_DATE\", \"
|
|
|
|
|
12 |
{"role": "user", "content": question}],
|
13 |
temperature=0.2
|
14 |
)
|
|
|
8 |
|
9 |
payload_formation = openai.ChatCompletion.create(
|
10 |
model="gpt-4",
|
11 |
+
messages=[{"role": "system", "content": "Given an input question in any language, respond with the relevant dimensions, metrics, and filters. Be creative but the response must be in the correct JSON format. You can only use dimensions called \"Campaign Name\", \"Campaign Category\", \"Media Buy Name\", \"Day\", \"Weekday\",\"Month\", \"Creative Name\", \"Media Buy Size\". You can only use measurements called \"Impressions\", \"Clicks\", \"Revenue\", \"CTR\", \"CPM\", \"Media Cost\", \"Conversion CPA\", \"Total Conversions\", \"Conversion Rate\", \"Conversion ROAS\". The dateRange variable can be one of the following: \"CUSTOM\",\"CUSTOM_ON_GOING\", \"YESTERDAY\", \"WEEK_TO_DATE\", \"BI_WEEK_TO_DATE\", \"MONTH_TO_DATE\", \"QUARTER_TO_DATE\", \"YEAR_TO_DATE\", \"PREV_WEEK\", \"PREV_BI_WEEK\", \"PREV_MONTH\", \"PREV_QUARTER\", \"PREV_YEAR\", \"LAST_WEEK\", \"LAST_BI_WEEK\", \"LAST_MONTH\", \"LAST_3_MONTHS\", \"THIS_WEEK\", \"THIS_BI_WEEK\", \"THIS_MONTH\", \"THIS_QUARTER\", \"THIS_YEAR\".\nIf you use a CUSTOM you'll need to add startDate & endDate, if you use CUSTOM_ONGOING you'll need to add startDate only."},
|
12 |
+
{"role": "user", "content": "What is the day that had more than 1000 impressions with the most clicks of 2021?"},
|
13 |
+
{"role": "assistant", "content": "{\n \"workspaceId\": 77283,\n \"dateRange\": \"CUSTOM\",\n \"startDate\": \"2021-01-01\",\n \"endDate\": \"2021-12-31\",\n \"measurements\": [\n {\n \"name\": \"Clicks\"\n },\n {\n \"name\": \"Impressions\"\n }\n ],\n \"dimensions\": [\n \"Day\"\n ],\n \"numberMeasurementFilter\": [\n {\n \"fieldName\": \"Impressions\",\n \"operator\": \"GREATER\",\n \"val\": 1000\n }\n ],\n \"sortConfig\": [\n {\n \"sortBy\": \"Clicks\",\n \"sortOrder\": \"DESC\"\n }\n ],\n \"topResults\": \"1\",\n \"groupOthers\": false,\n \"topPerDimension\": true,\n \"totalDimensions\": []\n}\n\nInput: \"Cuál es la campaña con el mayor número de impresiones del último mes?\"\nOutput: {\n \"workspaceId\": 77283,\n \"dateRange\": \"LAST_MONTH\",\n \"measurements\": [\n {\n \"name\": \"Impressions\"\n }\n ],\n \"dimensions\": [\n \"Campaign Name\"\n ],\n \"sortConfig\": [\n {\n \"sortBy\": \"Impressions\",\n \"sortOrder\": \"DESC\"\n }\n ],\n \"topResults\": \"1\",\n \"groupOthers\": false,\n \"topPerDimension\": true,\n \"totalDimensions\": []\n}."},
|
14 |
{"role": "user", "content": question}],
|
15 |
temperature=0.2
|
16 |
)
|