seanpedrickcase commited on
Commit
b50798a
·
1 Parent(s): 64ffd3a

Added options to use different sentiment categories. Can ask for more concise summaries.

Browse files
Files changed (3) hide show
  1. app.py +8 -4
  2. tools/llm_api_call.py +18 -8
  3. tools/prompts.py +3 -3
app.py CHANGED
@@ -112,6 +112,8 @@ with app:
112
 
113
  context_textbox = gr.Textbox(label="Write up to one sentence giving context to the large language model for your task (e.g. 'Consultation for the construction of flats on Main Street')")
114
 
 
 
115
  extract_topics_btn = gr.Button("Extract topics from open text", variant="primary")
116
 
117
  text_output_summary = gr.Markdown(value="### Language model response will appear here")
@@ -146,6 +148,8 @@ with app:
146
  deduplicate_previous_data_btn = gr.Button("Deduplicate topics", variant="primary")
147
 
148
  duplicate_output_files = gr.File(height=file_input_height, label="Upload files to summarise", file_count= "multiple", file_types=['.xlsx', '.xls', '.csv', '.parquet', '.csv.gz'])
 
 
149
 
150
  summarise_previous_data_btn = gr.Button("Summarise topics", variant="primary")
151
  summary_output_files = gr.File(height=file_input_height, label="Summarised output files", interactive=False)
@@ -226,14 +230,14 @@ with app:
226
  then(load_in_data_file,
227
  inputs = [in_data_files, in_colnames, batch_size_number], outputs = [file_data_state, data_file_names_textbox, total_number_of_batches], api_name="load_data").then(\
228
  fn=extract_topics,
229
- inputs=[in_data_files, file_data_state, master_topic_df_state, master_reference_df_state, master_unique_topics_df_state, text_output_summary, data_file_names_textbox, total_number_of_batches, in_api_key, temperature_slide, in_colnames, model_choice, candidate_topics, latest_batch_completed, text_output_summary, text_output_file_list_state, log_files_output_list_state, first_loop_state, conversation_metadata_textbox, initial_table_prompt_textbox, prompt_2_textbox, prompt_3_textbox, system_prompt_textbox, add_to_existing_topics_system_prompt_textbox, add_to_existing_topics_prompt_textbox, number_of_prompts, batch_size_number, context_textbox, estimated_time_taken_number],
230
  outputs=[text_output_summary, master_topic_df_state, master_unique_topics_df_state, master_reference_df_state, text_output_file, text_output_file_list_state, latest_batch_completed, log_files_output, log_files_output_list_state, conversation_metadata_textbox, estimated_time_taken_number, summarisation_in_previous_data_files, duplicate_output_files], api_name="extract_topics")
231
 
232
  # return display_table, existing_topics_table, existing_unique_topics_df, existing_reference_df, out_file_paths, out_file_paths, latest_batch_completed, log_files_output_paths, log_files_output_paths, whole_conversation_metadata_str, final_time, out_file_paths, out_file_paths
233
 
234
  # If the output file count text box changes, keep going with redacting each data file until done. Then reveal the feedback buttons.
235
  latest_batch_completed.change(fn=extract_topics,
236
- inputs=[in_data_files, file_data_state, master_topic_df_state, master_reference_df_state, master_unique_topics_df_state, text_output_summary, data_file_names_textbox, total_number_of_batches, in_api_key, temperature_slide, in_colnames, model_choice, candidate_topics, latest_batch_completed, text_output_summary, text_output_file_list_state, log_files_output_list_state, second_loop_state, conversation_metadata_textbox, initial_table_prompt_textbox, prompt_2_textbox, prompt_3_textbox, system_prompt_textbox, add_to_existing_topics_system_prompt_textbox, add_to_existing_topics_prompt_textbox, number_of_prompts, batch_size_number, context_textbox, estimated_time_taken_number],
237
  outputs=[text_output_summary, master_topic_df_state, master_unique_topics_df_state, master_reference_df_state, text_output_file, text_output_file_list_state, latest_batch_completed, log_files_output, log_files_output_list_state, conversation_metadata_textbox, estimated_time_taken_number, summarisation_in_previous_data_files, duplicate_output_files]).\
238
  then(fn = reveal_feedback_buttons,
239
  outputs=[data_feedback_radio, data_further_details_text, data_submit_feedback_btn, data_feedback_title], scroll_to_output=True)
@@ -246,9 +250,9 @@ with app:
246
  summarise_previous_data_btn.click(empty_output_vars_summarise, inputs=None, outputs=[summary_reference_table_sample_state, master_unique_topics_df_revised_summaries_state, master_reference_df_revised_summaries_state, summary_output_files, summarised_outputs_list, latest_summary_completed_num, conversation_metadata_textbox]).\
247
  then(load_in_previous_data_files, inputs=[duplicate_output_files], outputs=[master_reference_df_state, master_unique_topics_df_state, latest_batch_completed_no_loop, summarisation_in_previous_data_files_status, data_file_names_textbox, unique_topics_table_file_textbox]).\
248
  then(sample_reference_table_summaries, inputs=[master_reference_df_state, master_unique_topics_df_state, random_seed], outputs=[summary_reference_table_sample_state, summarised_references_markdown, master_reference_df_state, master_unique_topics_df_state]).\
249
- then(summarise_output_topics, inputs=[summary_reference_table_sample_state, master_unique_topics_df_state, master_reference_df_state, model_choice, in_api_key, summarised_references_markdown, temperature_slide, data_file_names_textbox, summarised_outputs_list, latest_summary_completed_num, conversation_metadata_textbox, in_data_files, in_colnames, log_files_output_list_state], outputs=[summary_reference_table_sample_state, master_unique_topics_df_revised_summaries_state, master_reference_df_revised_summaries_state, summary_output_files, summarised_outputs_list, latest_summary_completed_num, conversation_metadata_textbox, summarised_output_markdown, log_files_output])
250
 
251
- latest_summary_completed_num.change(summarise_output_topics, inputs=[summary_reference_table_sample_state, master_unique_topics_df_state, master_reference_df_state, model_choice, in_api_key, summarised_references_markdown, temperature_slide, data_file_names_textbox, summarised_outputs_list, latest_summary_completed_num, conversation_metadata_textbox, in_data_files, in_colnames, log_files_output_list_state], outputs=[summary_reference_table_sample_state, master_unique_topics_df_revised_summaries_state, master_reference_df_revised_summaries_state, summary_output_files, summarised_outputs_list, latest_summary_completed_num, conversation_metadata_textbox, summarised_output_markdown, log_files_output])
252
 
253
  # If uploaded partially completed consultation files do this. This should then start up the 'latest_batch_completed' change action above to continue extracting topics.
254
  continue_previous_data_files_btn.click(
 
112
 
113
  context_textbox = gr.Textbox(label="Write up to one sentence giving context to the large language model for your task (e.g. 'Consultation for the construction of flats on Main Street')")
114
 
115
+ sentiment_checkbox = gr.Radio(label="Choose sentiment categories to split responses", value="Negative, Neutral, or Positive", choices=["Negative, Neutral, or Positive", "Negative or Positive", "Do not assess sentiment"])
116
+
117
  extract_topics_btn = gr.Button("Extract topics from open text", variant="primary")
118
 
119
  text_output_summary = gr.Markdown(value="### Language model response will appear here")
 
148
  deduplicate_previous_data_btn = gr.Button("Deduplicate topics", variant="primary")
149
 
150
  duplicate_output_files = gr.File(height=file_input_height, label="Upload files to summarise", file_count= "multiple", file_types=['.xlsx', '.xls', '.csv', '.parquet', '.csv.gz'])
151
+
152
+ summarise_format_radio = gr.Radio(label="Choose summary type", value="Return a summary up to two paragraphs long that includes as much detail as possible from the original text", choices=["Return a summary up to two paragraphs long that includes as much detail as possible from the original text", "Return a concise summary up to one paragraph long that summarises only the most important themes from the original text"])
153
 
154
  summarise_previous_data_btn = gr.Button("Summarise topics", variant="primary")
155
  summary_output_files = gr.File(height=file_input_height, label="Summarised output files", interactive=False)
 
230
  then(load_in_data_file,
231
  inputs = [in_data_files, in_colnames, batch_size_number], outputs = [file_data_state, data_file_names_textbox, total_number_of_batches], api_name="load_data").then(\
232
  fn=extract_topics,
233
+ inputs=[in_data_files, file_data_state, master_topic_df_state, master_reference_df_state, master_unique_topics_df_state, text_output_summary, data_file_names_textbox, total_number_of_batches, in_api_key, temperature_slide, in_colnames, model_choice, candidate_topics, latest_batch_completed, text_output_summary, text_output_file_list_state, log_files_output_list_state, first_loop_state, conversation_metadata_textbox, initial_table_prompt_textbox, prompt_2_textbox, prompt_3_textbox, system_prompt_textbox, add_to_existing_topics_system_prompt_textbox, add_to_existing_topics_prompt_textbox, number_of_prompts, batch_size_number, context_textbox, estimated_time_taken_number, sentiment_checkbox],
234
  outputs=[text_output_summary, master_topic_df_state, master_unique_topics_df_state, master_reference_df_state, text_output_file, text_output_file_list_state, latest_batch_completed, log_files_output, log_files_output_list_state, conversation_metadata_textbox, estimated_time_taken_number, summarisation_in_previous_data_files, duplicate_output_files], api_name="extract_topics")
235
 
236
  # return display_table, existing_topics_table, existing_unique_topics_df, existing_reference_df, out_file_paths, out_file_paths, latest_batch_completed, log_files_output_paths, log_files_output_paths, whole_conversation_metadata_str, final_time, out_file_paths, out_file_paths
237
 
238
  # If the output file count text box changes, keep going with redacting each data file until done. Then reveal the feedback buttons.
239
  latest_batch_completed.change(fn=extract_topics,
240
+ inputs=[in_data_files, file_data_state, master_topic_df_state, master_reference_df_state, master_unique_topics_df_state, text_output_summary, data_file_names_textbox, total_number_of_batches, in_api_key, temperature_slide, in_colnames, model_choice, candidate_topics, latest_batch_completed, text_output_summary, text_output_file_list_state, log_files_output_list_state, second_loop_state, conversation_metadata_textbox, initial_table_prompt_textbox, prompt_2_textbox, prompt_3_textbox, system_prompt_textbox, add_to_existing_topics_system_prompt_textbox, add_to_existing_topics_prompt_textbox, number_of_prompts, batch_size_number, context_textbox, estimated_time_taken_number, sentiment_checkbox],
241
  outputs=[text_output_summary, master_topic_df_state, master_unique_topics_df_state, master_reference_df_state, text_output_file, text_output_file_list_state, latest_batch_completed, log_files_output, log_files_output_list_state, conversation_metadata_textbox, estimated_time_taken_number, summarisation_in_previous_data_files, duplicate_output_files]).\
242
  then(fn = reveal_feedback_buttons,
243
  outputs=[data_feedback_radio, data_further_details_text, data_submit_feedback_btn, data_feedback_title], scroll_to_output=True)
 
250
  summarise_previous_data_btn.click(empty_output_vars_summarise, inputs=None, outputs=[summary_reference_table_sample_state, master_unique_topics_df_revised_summaries_state, master_reference_df_revised_summaries_state, summary_output_files, summarised_outputs_list, latest_summary_completed_num, conversation_metadata_textbox]).\
251
  then(load_in_previous_data_files, inputs=[duplicate_output_files], outputs=[master_reference_df_state, master_unique_topics_df_state, latest_batch_completed_no_loop, summarisation_in_previous_data_files_status, data_file_names_textbox, unique_topics_table_file_textbox]).\
252
  then(sample_reference_table_summaries, inputs=[master_reference_df_state, master_unique_topics_df_state, random_seed], outputs=[summary_reference_table_sample_state, summarised_references_markdown, master_reference_df_state, master_unique_topics_df_state]).\
253
+ then(summarise_output_topics, inputs=[summary_reference_table_sample_state, master_unique_topics_df_state, master_reference_df_state, model_choice, in_api_key, summarised_references_markdown, temperature_slide, data_file_names_textbox, summarised_outputs_list, latest_summary_completed_num, conversation_metadata_textbox, in_data_files, in_colnames, log_files_output_list_state, summarise_format_radio], outputs=[summary_reference_table_sample_state, master_unique_topics_df_revised_summaries_state, master_reference_df_revised_summaries_state, summary_output_files, summarised_outputs_list, latest_summary_completed_num, conversation_metadata_textbox, summarised_output_markdown, log_files_output])
254
 
255
+ latest_summary_completed_num.change(summarise_output_topics, inputs=[summary_reference_table_sample_state, master_unique_topics_df_state, master_reference_df_state, model_choice, in_api_key, summarised_references_markdown, temperature_slide, data_file_names_textbox, summarised_outputs_list, latest_summary_completed_num, conversation_metadata_textbox, in_data_files, in_colnames, log_files_output_list_state, summarise_format_radio], outputs=[summary_reference_table_sample_state, master_unique_topics_df_revised_summaries_state, master_reference_df_revised_summaries_state, summary_output_files, summarised_outputs_list, latest_summary_completed_num, conversation_metadata_textbox, summarised_output_markdown, log_files_output])
256
 
257
  # If uploaded partially completed consultation files do this. This should then start up the 'latest_batch_completed' change action above to continue extracting topics.
258
  continue_previous_data_files_btn.click(
tools/llm_api_call.py CHANGED
@@ -194,8 +194,7 @@ def data_file_to_markdown_table(file_data:pd.DataFrame, file_name:str, chosen_co
194
 
195
  #print("batch_basic_response_data:", batch_basic_response_data)
196
 
197
- # Remove problematic characters including ASCII and various quote marks
198
- # Remove problematic characters including control characters, special characters, and excessive leading/trailing whitespace
199
  batch_basic_response_data.loc[:, "Response"]= batch_basic_response_data["Response"].str.replace(r'[\x00-\x1F\x7F]|[""<>]|\\', '', regex=True) # Remove control and special characters
200
  batch_basic_response_data.loc[:, "Response"] = batch_basic_response_data["Response"].str.strip() # Remove leading and trailing whitespace
201
  batch_basic_response_data.loc[:, "Response"] = batch_basic_response_data["Response"].str.replace(r'\s+', ' ', regex=True) # Replace multiple spaces with a single space
@@ -927,6 +926,7 @@ def extract_topics(in_data_file,
927
  batch_size:int=50,
928
  context_textbox:str="",
929
  time_taken:float = 0,
 
930
  max_tokens:int=max_tokens,
931
  model_name_map:dict=model_name_map,
932
  max_time_for_loop:int=max_time_for_loop,
@@ -1146,9 +1146,17 @@ def extract_topics(in_data_file,
1146
  print(out_message)
1147
  return out_message, existing_topics_table, existing_unique_topics_df, existing_reference_df, out_file_paths, out_file_paths, latest_batch_completed, log_files_output_paths, log_files_output_paths, whole_conversation_metadata_str, final_time, out_file_paths, out_file_paths#, out_message
1148
 
 
 
 
 
 
 
1149
  topics_loop_description = "Extracting topics from response batches (each batch of " + str(batch_size) + " responses)."
1150
  topics_loop = tqdm(range(latest_batch_completed, num_batches), desc = topics_loop_description, unit="batches remaining")
1151
 
 
 
1152
 
1153
  for i in topics_loop:
1154
  #for latest_batch_completed in range(num_batches):
@@ -1160,6 +1168,7 @@ def extract_topics(in_data_file,
1160
  #log_files_output_paths.append(simplified_csv_table_path)
1161
 
1162
 
 
1163
  # Conversation history
1164
  conversation_history = []
1165
 
@@ -1279,7 +1288,7 @@ def extract_topics(in_data_file,
1279
 
1280
  # Format the summary prompt with the response table and topics
1281
  formatted_system_prompt = add_existing_topics_system_prompt.format(consultation_context=context_textbox, column_name=chosen_cols)
1282
- formatted_summary_prompt = add_existing_topics_prompt.format(response_table=normalised_simple_markdown_table, topics=unique_topics_markdown)
1283
 
1284
 
1285
  if model_choice == "gemma_2b_it_local":
@@ -1366,14 +1375,14 @@ def extract_topics(in_data_file,
1366
  else:
1367
  print("Using AWS Bedrock model:", model_choice)
1368
 
1369
- formatted_initial_table_prompt = initial_table_prompt.format(response_table=normalised_simple_markdown_table)
1370
-
1371
  formatted_initial_table_system_prompt = system_prompt.format(consultation_context=context_textbox, column_name=chosen_cols)
1372
 
1373
- if prompt2: formatted_prompt2 = prompt2.format(response_table=normalised_simple_markdown_table)
 
 
1374
  else: formatted_prompt2 = prompt2
1375
 
1376
- if prompt3: formatted_prompt3 = prompt3.format(response_table=normalised_simple_markdown_table)
1377
  else: formatted_prompt3 = prompt3
1378
 
1379
  if model_choice == "gemma_2b_it_local":
@@ -1824,6 +1833,7 @@ def summarise_output_topics(summarised_references:pd.DataFrame,
1824
  in_data_files:List[str]=[],
1825
  chosen_cols:List[str]=[],
1826
  log_output_files:list[str]=[],
 
1827
  output_files:list[str] = [],
1828
  summarise_topic_descriptions_prompt:str=summarise_topic_descriptions_prompt, summarise_topic_descriptions_system_prompt:str=summarise_topic_descriptions_system_prompt,
1829
  do_summaries="Yes",
@@ -1948,7 +1958,7 @@ def summarise_output_topics(summarised_references:pd.DataFrame,
1948
 
1949
  summary_text = all_summaries[summary_no]
1950
  #print("summary_text:", summary_text)
1951
- formatted_summary_prompt = [summarise_topic_descriptions_prompt.format(summaries=summary_text)]
1952
 
1953
  try:
1954
  response, conversation_history, metadata = summarise_output_topics_query(model_choice, in_api_key, temperature, formatted_summary_prompt, summarise_topic_descriptions_system_prompt, local_model)
 
194
 
195
  #print("batch_basic_response_data:", batch_basic_response_data)
196
 
197
+ # Remove problematic characters including control characters, special characters, and excessive leading/trailing whitespace
 
198
  batch_basic_response_data.loc[:, "Response"]= batch_basic_response_data["Response"].str.replace(r'[\x00-\x1F\x7F]|[""<>]|\\', '', regex=True) # Remove control and special characters
199
  batch_basic_response_data.loc[:, "Response"] = batch_basic_response_data["Response"].str.strip() # Remove leading and trailing whitespace
200
  batch_basic_response_data.loc[:, "Response"] = batch_basic_response_data["Response"].str.replace(r'\s+', ' ', regex=True) # Replace multiple spaces with a single space
 
926
  batch_size:int=50,
927
  context_textbox:str="",
928
  time_taken:float = 0,
929
+ sentiment_checkbox:str = "Negative, Neutral, or Positive",
930
  max_tokens:int=max_tokens,
931
  model_name_map:dict=model_name_map,
932
  max_time_for_loop:int=max_time_for_loop,
 
1146
  print(out_message)
1147
  return out_message, existing_topics_table, existing_unique_topics_df, existing_reference_df, out_file_paths, out_file_paths, latest_batch_completed, log_files_output_paths, log_files_output_paths, whole_conversation_metadata_str, final_time, out_file_paths, out_file_paths#, out_message
1148
 
1149
+
1150
+ if sentiment_checkbox == "Negative, Neutral, or Positive": sentiment_prompt = "In the third column, write the sentiment of the Subtopic: Negative, Neutral, or Positive"
1151
+ elif sentiment_checkbox == "Negative or Positive": sentiment_prompt = "In the third column, write the sentiment of the Subtopic: Negative or Positive"
1152
+ elif sentiment_checkbox == "Do not assess sentiment": sentiment_prompt = "Create a third column containing only the text 'Not assessed'"
1153
+ else: sentiment_prompt = "In the third column, write the sentiment of the Subtopic: Negative, Neutral, or Positive"
1154
+
1155
  topics_loop_description = "Extracting topics from response batches (each batch of " + str(batch_size) + " responses)."
1156
  topics_loop = tqdm(range(latest_batch_completed, num_batches), desc = topics_loop_description, unit="batches remaining")
1157
 
1158
+
1159
+
1160
 
1161
  for i in topics_loop:
1162
  #for latest_batch_completed in range(num_batches):
 
1168
  #log_files_output_paths.append(simplified_csv_table_path)
1169
 
1170
 
1171
+
1172
  # Conversation history
1173
  conversation_history = []
1174
 
 
1288
 
1289
  # Format the summary prompt with the response table and topics
1290
  formatted_system_prompt = add_existing_topics_system_prompt.format(consultation_context=context_textbox, column_name=chosen_cols)
1291
+ formatted_summary_prompt = add_existing_topics_prompt.format(response_table=normalised_simple_markdown_table, topics=unique_topics_markdown, sentiment_choices=sentiment_prompt)
1292
 
1293
 
1294
  if model_choice == "gemma_2b_it_local":
 
1375
  else:
1376
  print("Using AWS Bedrock model:", model_choice)
1377
 
 
 
1378
  formatted_initial_table_system_prompt = system_prompt.format(consultation_context=context_textbox, column_name=chosen_cols)
1379
 
1380
+ formatted_initial_table_prompt = initial_table_prompt.format(response_table=normalised_simple_markdown_table, sentiment_choices=sentiment_prompt)
1381
+
1382
+ if prompt2: formatted_prompt2 = prompt2.format(response_table=normalised_simple_markdown_table, sentiment_choices=sentiment_prompt)
1383
  else: formatted_prompt2 = prompt2
1384
 
1385
+ if prompt3: formatted_prompt3 = prompt3.format(response_table=normalised_simple_markdown_table, sentiment_choices=sentiment_prompt)
1386
  else: formatted_prompt3 = prompt3
1387
 
1388
  if model_choice == "gemma_2b_it_local":
 
1833
  in_data_files:List[str]=[],
1834
  chosen_cols:List[str]=[],
1835
  log_output_files:list[str]=[],
1836
+ summarise_format_radio:str="Return a summary up to two paragraphs long that includes as much detail as possible from the original text",
1837
  output_files:list[str] = [],
1838
  summarise_topic_descriptions_prompt:str=summarise_topic_descriptions_prompt, summarise_topic_descriptions_system_prompt:str=summarise_topic_descriptions_system_prompt,
1839
  do_summaries="Yes",
 
1958
 
1959
  summary_text = all_summaries[summary_no]
1960
  #print("summary_text:", summary_text)
1961
+ formatted_summary_prompt = [summarise_topic_descriptions_prompt.format(summaries=summary_text, summary_format=summarise_format_radio)]
1962
 
1963
  try:
1964
  response, conversation_history, metadata = summarise_output_topics_query(model_choice, in_api_key, temperature, formatted_summary_prompt, summarise_topic_descriptions_system_prompt, local_model)
tools/prompts.py CHANGED
@@ -6,7 +6,7 @@ initial_table_prompt = """The open text data is shown in the following table tha
6
  Your task is to create one new markdown table with the headings 'General Topic', 'Subtopic', 'Sentiment', 'Response references', and 'Summary'.
7
  In the first column identify general topics relevant to responses. Create as many general topics as you can.
8
  In the second column list subtopics relevant to responses. Make the subtopics as specific as possible and make sure they cover every issue mentioned.
9
- In the third column write the sentiment of the subtopic: Negative, Neutral, or Positive.
10
  In the fourth column list each specific Response reference number that is relevant to the Subtopic, separated by commas. Do no write any other text in this column.
11
  In the fifth and final column, write a short summary of the subtopic based on relevant responses. Highlight specific issues that appear in relevant responses.
12
  Do not add any other columns. Do not repeat Subtopics with the same Sentiment. Return only one table in markdown format containing all relevant topics. Do not add any other text, thoughts, or notes to your response.
@@ -30,7 +30,7 @@ Topics known to be relevant to this dataset are shown in the following Topics ta
30
  Your task is to create one new markdown table, assigning responses from the Response table to existing topics, or to create new topics if no existing topics are relevant.
31
  Create a new markdown table with the headings 'General Topic', 'Subtopic', 'Sentiment', 'Response references', and 'Summary'.
32
  In the first and second columns, assign General Topics and Subtopics to Responses. Assign topics from the Topics table above if they are very relevant to the text of the Response. Fill in the General Topic and Sentiment for the Subtopic if they do not already exist. If you find a new topic that does not exist in the Topics table, add a new row to the new table. Make the General Topic and Subtopic as specific as possible.
33
- In the third column, write the sentiment of the Subtopic: Negative, Neutral, or Positive.
34
  In the fourth column list each specific Response reference number that is relevant to the Subtopic, separated by commas. Do no write any other text in this column.
35
  In the fifth and final column, write a short summary of the Subtopic based on relevant responses. Highlight specific issues that appear in relevant responses.
36
  Do not add any other columns. Remove topics from the table that are not assigned to any response. Do not repeat Subtopics with the same Sentiment.
@@ -45,7 +45,7 @@ summarise_topic_descriptions_prompt = """Below is a table with number of paragra
45
 
46
  '{summaries}'
47
 
48
- Your task is to make a consolidated summary of the above text. Return a summary up to two paragraphs long that includes as much detail as possible from the original text. Return only the summary and no other text.
49
 
50
  Summary:"""
51
 
 
6
  Your task is to create one new markdown table with the headings 'General Topic', 'Subtopic', 'Sentiment', 'Response references', and 'Summary'.
7
  In the first column identify general topics relevant to responses. Create as many general topics as you can.
8
  In the second column list subtopics relevant to responses. Make the subtopics as specific as possible and make sure they cover every issue mentioned.
9
+ In the third column write the sentiment of the subtopic: {sentiment_choices}.
10
  In the fourth column list each specific Response reference number that is relevant to the Subtopic, separated by commas. Do no write any other text in this column.
11
  In the fifth and final column, write a short summary of the subtopic based on relevant responses. Highlight specific issues that appear in relevant responses.
12
  Do not add any other columns. Do not repeat Subtopics with the same Sentiment. Return only one table in markdown format containing all relevant topics. Do not add any other text, thoughts, or notes to your response.
 
30
  Your task is to create one new markdown table, assigning responses from the Response table to existing topics, or to create new topics if no existing topics are relevant.
31
  Create a new markdown table with the headings 'General Topic', 'Subtopic', 'Sentiment', 'Response references', and 'Summary'.
32
  In the first and second columns, assign General Topics and Subtopics to Responses. Assign topics from the Topics table above if they are very relevant to the text of the Response. Fill in the General Topic and Sentiment for the Subtopic if they do not already exist. If you find a new topic that does not exist in the Topics table, add a new row to the new table. Make the General Topic and Subtopic as specific as possible.
33
+ In the third column, write the sentiment of the Subtopic: {sentiment_choices}.
34
  In the fourth column list each specific Response reference number that is relevant to the Subtopic, separated by commas. Do no write any other text in this column.
35
  In the fifth and final column, write a short summary of the Subtopic based on relevant responses. Highlight specific issues that appear in relevant responses.
36
  Do not add any other columns. Remove topics from the table that are not assigned to any response. Do not repeat Subtopics with the same Sentiment.
 
45
 
46
  '{summaries}'
47
 
48
+ Your task is to make a consolidated summary of the above text. {summary_format}. Return only the summary and no other text.
49
 
50
  Summary:"""
51