themefinder 0.7.4__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- themefinder/__init__.py +24 -0
- themefinder/advanced_tasks/__init__.py +0 -0
- themefinder/advanced_tasks/cross_cutting_themes_agent.py +404 -0
- themefinder/advanced_tasks/theme_clustering_agent.py +356 -0
- themefinder/llm_batch_processor.py +442 -0
- themefinder/models.py +438 -0
- themefinder/prompts/agentic_theme_clustering.txt +34 -0
- themefinder/prompts/consultation_system_prompt.txt +1 -0
- themefinder/prompts/cross_cutting_identification.txt +16 -0
- themefinder/prompts/cross_cutting_mapping.txt +19 -0
- themefinder/prompts/cross_cutting_refinement.txt +15 -0
- themefinder/prompts/detail_detection.txt +31 -0
- themefinder/prompts/sentiment_analysis.txt +41 -0
- themefinder/prompts/theme_condensation.txt +34 -0
- themefinder/prompts/theme_generation.txt +38 -0
- themefinder/prompts/theme_mapping.txt +36 -0
- themefinder/prompts/theme_refinement.txt +54 -0
- themefinder/prompts/theme_target_alignment.txt +18 -0
- themefinder/tasks.py +656 -0
- themefinder/themefinder_logging.py +12 -0
- themefinder-0.7.4.dist-info/METADATA +174 -0
- themefinder-0.7.4.dist-info/RECORD +24 -0
- themefinder-0.7.4.dist-info/WHEEL +4 -0
- themefinder-0.7.4.dist-info/licenses/LICENCE +21 -0
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
{system_prompt}
|
|
2
|
+
|
|
3
|
+
Your job is to help identify which topics come up in free_text_responses to a question.
|
|
4
|
+
|
|
5
|
+
You will be given:
|
|
6
|
+
- a QUESTION that has been asked
|
|
7
|
+
- a TOPIC LIST of topics that are known to be present in free_text_responses to this question. These will be structured as follows:
|
|
8
|
+
{{'topic_id': 'topic_description}}
|
|
9
|
+
- a list of FREE_TEXT_RESPONSES to the question. These will be structured as follows:
|
|
10
|
+
{{'response_id': 'free text response'}}
|
|
11
|
+
|
|
12
|
+
Your task is to analyze each response and decide which topics are present. Guidelines:
|
|
13
|
+
- You can only assign to a response to a topic in the provided TOPIC LIST
|
|
14
|
+
- A response doesn't need to exactly match the language used in the TOPIC LIST, it should be considered a match if it expresses a similar sentiment.
|
|
15
|
+
- You must use the alphabetic 'topic_id' to indicate which topic you have assigned. Do not use the full topic description
|
|
16
|
+
- Each response can be assigned to multiple topics if it matches more than one topic from the TOPIC LIST.
|
|
17
|
+
- Each topic can only be assigned once per response, if the topic is mentioned more than once use the first mention for reasoning and stance.
|
|
18
|
+
- There is no limit on how many topics can be assigned to a response.
|
|
19
|
+
|
|
20
|
+
You MUST include every response ID in the output.
|
|
21
|
+
If the response can not be labelled return empty sections where appropriate but you MUST return an entry
|
|
22
|
+
with the correct response ID for each input object.
|
|
23
|
+
You must only return the alphabetic topic_ids in the labels section.
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
QUESTION:
|
|
27
|
+
|
|
28
|
+
{question}
|
|
29
|
+
|
|
30
|
+
TOPIC LIST:
|
|
31
|
+
|
|
32
|
+
{refined_themes}
|
|
33
|
+
|
|
34
|
+
FREE_TEXT_RESPONSES:
|
|
35
|
+
|
|
36
|
+
{responses}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
{system_prompt}
|
|
2
|
+
|
|
3
|
+
You are tasked with refining a list of topics generated from responses to a question.
|
|
4
|
+
|
|
5
|
+
## Input
|
|
6
|
+
You will receive a list of TOPICS. These topics explicitly tie opinions to whether a person agrees or disagrees with the question.
|
|
7
|
+
|
|
8
|
+
## Output
|
|
9
|
+
You will produce a list of CLEAR STANCE TOPICS based on the input. Each topic should have four parts:
|
|
10
|
+
1. A brief, clear topic label (3-7 words)
|
|
11
|
+
2. A more detailed topic description (1-2 sentences)
|
|
12
|
+
3. The source_topic_count field should be included for each topic and should reflect the number of original source topics that were merged to create this refined topic. If multiple source topics were combined, sum their individual counts. If only one source topic was used, simply retain its original count value.
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
## Guidelines
|
|
16
|
+
|
|
17
|
+
1. Information Retention:
|
|
18
|
+
- Preserve all key information, details and concepts from the original topics.
|
|
19
|
+
- Ensure no significant details are lost in the refinement process.
|
|
20
|
+
|
|
21
|
+
2. Clear Stance Formulation:
|
|
22
|
+
- Reformulate topics to express a clear stance that can be agreed or disagreed with.
|
|
23
|
+
- Use direct language like "Increased risk of X" rather than "X"
|
|
24
|
+
- Avoid double negatives and ambiguous phrasing.
|
|
25
|
+
- Phrase topics as definitive statements.
|
|
26
|
+
|
|
27
|
+
3. Avoid Response References:
|
|
28
|
+
- Do not use language that refers to multiple responses or respondents.
|
|
29
|
+
- Focus solely on the content of each topic.
|
|
30
|
+
- Avoid phrases like "many respondents said" or "some responses indicated".
|
|
31
|
+
|
|
32
|
+
4. Distinctiveness:
|
|
33
|
+
- Ensure each topic represents a unique concept or aspect of the policy.
|
|
34
|
+
- Minimize overlap between topics.
|
|
35
|
+
- If topics are closely related, find ways to differentiate them clearly.
|
|
36
|
+
|
|
37
|
+
5. Fluency and Readability:
|
|
38
|
+
- Create concise, clear topic labels that summarize the main idea.
|
|
39
|
+
- Provide detailed descriptions that expand on the label without mere repetition.
|
|
40
|
+
- Use proper grammar, punctuation, and natural language.
|
|
41
|
+
|
|
42
|
+
## Process
|
|
43
|
+
|
|
44
|
+
1. Analyze the TOPICS to identify key themes and information.
|
|
45
|
+
2. Group closely related topics together.
|
|
46
|
+
3. For each group or individual topic:
|
|
47
|
+
a. Distill the core concept, removing any bias or opinion.
|
|
48
|
+
b. Create a concise topic label.
|
|
49
|
+
c. Write a more detailed description that provides context without taking sides.
|
|
50
|
+
4. Review the entire list to ensure distinctiveness and adjust as needed.
|
|
51
|
+
5. Combine the topic label and description with a colon separator
|
|
52
|
+
|
|
53
|
+
TOPICS:
|
|
54
|
+
{responses}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
{system_prompt}
|
|
2
|
+
Input: You will receive a JSON array of themes, where each theme contains a description of a topic or concept.
|
|
3
|
+
|
|
4
|
+
Goal: Consolidate these themes into approximately {target_n_themes} distinct categories by:
|
|
5
|
+
1. Identifying and combining similar or overlapping themes
|
|
6
|
+
2. Preserving all significant details and perspectives
|
|
7
|
+
3. Creating clear, comprehensive descriptions for each merged theme
|
|
8
|
+
|
|
9
|
+
Requirements:
|
|
10
|
+
- Each consolidated theme should capture all relevant information from its source themes
|
|
11
|
+
- Final descriptions should be concise but thorough
|
|
12
|
+
- The merged themes should be distinct from each other with minimal overlap
|
|
13
|
+
- The source_topic_count field should be included for each theme and represent the sum of all source themes that were combined to create it
|
|
14
|
+
- You cannot return more than {target_n_themes}
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
Themes to analyze:
|
|
18
|
+
{responses}
|