File size: 7,023 Bytes
74d2271 59c1c22 b7f4700 a2c66ec 59c1c22 75d1651 71fcefe b7f4700 71fcefe 59c1c22 b7f4700 59c1c22 71fcefe 59c1c22 b7f4700 59c1c22 a2c66ec 71fcefe a2c66ec 71fcefe 99b54b3 b7f4700 59c1c22 b7f4700 59c1c22 99b54b3 71fcefe b7f4700 71fcefe 59c1c22 b7f4700 59c1c22 71fcefe b7f4700 59c1c22 b7f4700 59c1c22 b50798a b7f4700 99b54b3 b7f4700 75d1651 74d2271 a2c66ec 75d1651 99b54b3 a2c66ec 99b54b3 a2c66ec 99b54b3 a2c66ec 99b54b3 a2c66ec 75d1651 b7f4700 59c1c22 b7f4700 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 |
system_prompt = """You are a researcher analysing responses from an open text dataset. You are analysing a single column from this dataset that is full of open text responses called '{column_name}'. The context of this analysis is '{consultation_context}'."""
initial_table_prompt = """The open text data is shown in the following table that contains two columns, Reference and Response. Response table:
{response_table}
Your task is to create one new markdown table with the headings 'General Topic', 'Subtopic', 'Sentiment', 'Response References', and 'Summary'.
In the first column identify general topics relevant to responses. Create as many general topics as you can.
In the second column list subtopics relevant to responses. Make the subtopics as specific as possible and make sure they cover every issue mentioned. The subtopic should never be blank or empty.
{sentiment_choices}.
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.
In the fifth column, write a short summary of the subtopic based on relevant responses - highlight specific issues that appear.
Do not add any other columns. Do not add any other text to your response.
New table:"""
# Return only one table in markdown format containing all relevant topics. Do not repeat Subtopics with the same Sentiment.
prompt2 = ""
prompt3 = ""
## Adding existing topics to consultation responses
add_existing_topics_system_prompt = system_prompt
force_existing_topics_prompt = """Create a new markdown table with the headings 'Placeholder', 'Subtopics', 'Sentiment', 'Response References', and 'Summary'.
In the first column, write 'Not assessed'. In the second column, assign Subtopics from the above table to Responses. Assign topics only if they are very relevant to the text of the Response. The assigned Subtopics should be chosen from the topics table above, exactly as written. Do not add any new topics, or modify existing topic names."""
allow_new_topics_prompt = """Create a new markdown table with the headings 'General Topic', 'Subtopic', 'Sentiment', 'Response References', and 'Summary'.
In the first and second columns, assign General Topics and Subtopics to Responses. Assign topics from the Topics table above only 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. The subtopic should never be blank or empty."""
force_single_topic_prompt = """ Wherever possible, assign a response to one single topic, unless there are multiple topics that are equally relevant."""
add_existing_topics_prompt = """Responses are shown in the following Response table:
{response_table}
Topics known to be relevant to this dataset are shown in the following Topics table:
{topics}
Your task is to create one new markdown table, assigning responses from the Response table to topics.
{topic_assignment}{force_single_topic}
{sentiment_choices}.
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.
In the fifth column, write a short summary of the Subtopic based on relevant responses - highlight specific issues that appear.
Do not add any other columns. Do not add any other text to your response.
New table:"""
# Return only one table in markdown format containing all relevant topics. Remove topics from the table that are not assigned to any response. Do not repeat Subtopics with the same Sentiment.
summarise_topic_descriptions_system_prompt = system_prompt
summarise_topic_descriptions_prompt = """Below is a table with number of paragraphs related to the data from the open text column:
'{summaries}'
Your task is to make a consolidated summary of the above text. {summary_format}. Return only the summary and no other text.
Summary:"""
single_para_summary_format_prompt = "Return a concise summary up to one paragraph long that summarises only the most important themes from the original text"
two_para_summary_format_prompt = "Return a summary up to two paragraphs long that includes as much detail as possible from the original text"
## The following didn't work well in testing and so is not currently used
create_general_topics_system_prompt = system_prompt
create_general_topics_prompt = """Subtopics known to be relevant to this dataset are shown in the following Topics table:
{topics}
Your task is to create a General Topic name for each Subtopic. The new Topics table should have the columns 'General Topic' and 'Subtopic' only. Write a 'General Topic' text label relevant to the Subtopic next to it in the new table. The text label should describe the general theme of the Subtopic. Do not add any other text, thoughts, or notes to your response.
New Topics table:"""
### Verify exisiting categories prompt
verify_titles_system_prompt = system_prompt
verify_titles_prompt = """Response numbers alongside the Response text and assigned descriptions are shown in the table below:
{response_table}
The criteria for a suitable description for these responses is that they should be readable, concise, and fully encapsulate the main subject of the response.
Create a markdown table with four columns.
The first column is 'Response References', and should contain just the response number under consideration.
The second column is 'Is this a suitable description', answer the question with 'Yes' or 'No', with no other text.
The third column is 'Explanation', give a short explanation for your response in the second column.
The fourth column is 'Alternative description', suggest an alternative description for the response that meet the criteria stated above.
Do not add any other text to your response.
Output markdown table:"""
# example_instruction_prompt_llama3 = """<|start_header_id|>system<|end_header_id|>\n
# You are an AI assistant that follows instruction extremely well. Help as much as you can.<|eot_id|><|start_header_id|>user<|end_header_id|>\n
# Summarise the following text in less than {length} words: "{text}"\n
# Summary:<|eot_id|><|start_header_id|>assistant<|end_header_id|>\n"""
# example_instruction_prompt_phi3 = """<|user|>\n
# Answer the QUESTION using information from the following CONTENT. Respond with short answers that directly answer the question.\n
# CONTENT: {summaries}\n
# QUESTION: {question}\n
# Answer:<|end|>\n
# <|assistant|>"""
# example_instruction_prompt_gemma = """<start_of_turn>user
# Categorise the following text into only one of the following categories that seems most relevant: 'cat1', 'cat2', 'cat3', 'cat4'. Answer only with the choice of category. Do not add any other text. Do not explain your choice.
# Text: {text}<end_of_turn>
# <start_of_turn>model
# Category:""" |