|
215 | 215 | "prompt_data = \"\"\n", |
216 | 216 | "post_number = 0\n", |
217 | 217 | "views = 0\n", |
218 | | - "interactions = 0\n", |
219 | | - "\n", |
| 218 | + "engagements = 0\n", |
| 219 | + "to_keep = [\n", |
| 220 | + " \"URL\",\n", |
| 221 | + " \"DATE\",\n", |
| 222 | + " \"TIME\",\n", |
| 223 | + " \"TEXT\",\n", |
| 224 | + " \"VIEWS\",\n", |
| 225 | + " \"LIKES\",\n", |
| 226 | + " \"COMMENTS\",\n", |
| 227 | + " \"SHARES\",\n", |
| 228 | + " \"ENGAGEMENTS\",\n", |
| 229 | + " \"CONCEPT\",\n", |
| 230 | + " \"SENTIMENT\",\n", |
| 231 | + " \"TARGET\",\n", |
| 232 | + " \"OBJECTIVE\",\n", |
| 233 | + "]\n", |
220 | 234 | "# Load data from pickle\n", |
221 | 235 | "df = pd.DataFrame()\n", |
222 | 236 | "data = pload(input_dir, input_file) \n", |
|
228 | 242 | "# Filter on this week and last week\n", |
229 | 243 | "if len(df) > 0:\n", |
230 | 244 | " df = df[(df[\"ENTITY\"] == entity_name) & df[\"SCENARIO\"].isin([TW, LW])]\n", |
231 | | - " df[\"INTERACTIONS\"] = df.LIKES + df.COMMENTS + df.SHARES\n", |
232 | | - " prompt_data = df.to_string()\n", |
| 245 | + " prompt_data = df[to_keep].to_string()\n", |
233 | 246 | " post_number = len(df)\n", |
234 | 247 | " views = df.VIEWS.sum()\n", |
235 | | - " interactions = df.INTERACTIONS.sum()\n", |
| 248 | + " engagements = df.ENGAGEMENTS.sum()\n", |
236 | 249 | " \n", |
237 | 250 | "if views == 0:\n", |
238 | | - " kpi = f\"{interactions}\"\n", |
239 | | - " kpi_label = \"interactions\"\n", |
| 251 | + " kpi = f\"{engagements}\"\n", |
| 252 | + " kpi_label = \"engagements\"\n", |
240 | 253 | "else:\n", |
241 | 254 | " kpi = f\"{views}\"\n", |
242 | 255 | " kpi_label = \"impressions\"\n", |
|
270 | 283 | "system_prompt = f\"\"\"\n", |
271 | 284 | "Act as a Content Assistant who has access to valuable data and insights about the content strategy. \n", |
272 | 285 | "Your role is to manage and optimize the content, ensuring it reaches the target audience effectively. \n", |
273 | | - "This week '{TW}' the '{entity_name}' published {len(df)} contents and generated and {kpi} {kpi_label}. \n", |
| 286 | + "The last 2 weeks '{TW}' & '{LW}' the '{entity_name}' published {len(df)} contents and generated and {kpi} {kpi_label}. \n", |
274 | 287 | "Here is the list with the post published: {prompt_data}.\n", |
275 | 288 | "The first message should be about presenting yourself and analyze '{entity_name}' contents published based on best post/topics by {kpi_label}, by date and time with a maximum of 3 bullet points.\n", |
276 | | - "Then, you will display the image inside the markdown of the chat about the evolution of content {kpi_label} over the last 2 weeks: [({image_html})].\n", |
| 289 | + "Then, you will display the image inside the markdown of the chat about the evolution of content {kpi_label} over the last 2 weeks: .\n", |
277 | 290 | "You must ALWAYS show the image in the first message.\n", |
278 | 291 | "Be casual, but professional. Wait for the first answer from the user, and then start with the first high-level analysis. \n", |
279 | 292 | "\"\"\"" |
|
340 | 353 | "print(\"--> Create new chat\")\n", |
341 | 354 | "Markdown(f\"[Create New Chat](https://naas.ai/chat/use?plugin_url={plugin_url})\")" |
342 | 355 | ] |
| 356 | + }, |
| 357 | + { |
| 358 | + "cell_type": "code", |
| 359 | + "execution_count": null, |
| 360 | + "id": "9adc4d13-42d7-4c82-b7b0-621e1bf1c10e", |
| 361 | + "metadata": {}, |
| 362 | + "outputs": [], |
| 363 | + "source": [] |
343 | 364 | } |
344 | 365 | ], |
345 | 366 | "metadata": { |
|
0 commit comments