themefinder 0.4.1__py3-none-any.whl → 0.5.2__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.

Potentially problematic release.


This version of themefinder might be problematic. Click here for more details.

themefinder/core.py CHANGED
@@ -106,7 +106,7 @@ async def sentiment_analysis(
106
106
  responses_df: pd.DataFrame,
107
107
  llm: Runnable,
108
108
  question: str,
109
- batch_size: int = 10,
109
+ batch_size: int = 20,
110
110
  prompt_template: str | Path | PromptTemplate = "sentiment_analysis",
111
111
  system_prompt: str = CONSULTATION_SYSTEM_PROMPT,
112
112
  ) -> pd.DataFrame:
@@ -121,7 +121,7 @@ async def sentiment_analysis(
121
121
  llm (Runnable): Language model instance to use for sentiment analysis.
122
122
  question (str): The survey question.
123
123
  batch_size (int, optional): Number of responses to process in each batch.
124
- Defaults to 10.
124
+ Defaults to 20.
125
125
  prompt_template (str | Path | PromptTemplate, optional): Template for structuring
126
126
  the prompt to the LLM. Can be a string identifier, path to template file,
127
127
  or PromptTemplate instance. Defaults to "sentiment_analysis".
@@ -174,7 +174,6 @@ def generate_prompts(
174
174
  to the prompt template as the 'responses' variable.
175
175
  """
176
176
  batched_prompts = []
177
-
178
177
  for df in response_dfs:
179
178
  prompt = prompt_template.format(
180
179
  responses=df.to_dict(orient="records"), **kwargs
@@ -275,7 +274,7 @@ def check_response_integrity(
275
274
  if returned_ids_set != response_ids_set:
276
275
  logger.info("Failed integrity check")
277
276
  logger.info(
278
- f"Present in original but not returned from LLM: {response_ids_set - returned_ids_set}. Returned in LLM but not present in original: {returned_ids_set -response_ids_set}"
277
+ f"Present in original but not returned from LLM: {response_ids_set - returned_ids_set}. Returned in LLM but not present in original: {returned_ids_set - response_ids_set}"
279
278
  )
280
279
  return False
281
280
  return True
@@ -20,6 +20,9 @@ The final output should be in the following JSON format:
20
20
  ...
21
21
  ]}}
22
22
 
23
+ You MUST include every response ID in the output.
24
+ If the response can not be labelled return empty sections where appropriate but you MUST return an entry
25
+ with the correct response ID for each input object
23
26
 
24
27
  ## EXAMPLE
25
28
  Example 1:
@@ -10,7 +10,7 @@ You will be given:
10
10
  {{'response_id': 'free text response'}}
11
11
 
12
12
  Your task is to analyze each response and decide which topics are present. Guidelines:
13
- - You can only assign a response to a topic in the provided TOPIC LIST
13
+ - You can only assign to a response to a topic in the provided TOPIC LIST
14
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
15
  - You must use the alphabetic 'topic_id' to indicate which topic you have assigned.
16
16
  - Each response can be assigned to multiple topics if it matches more than one topic from the TOPIC LIST.
@@ -20,6 +20,9 @@ Your task is to analyze each response and decide which topics are present. Guide
20
20
  - If a response contains both positive and negative statements about a topic within the same response, choose the stance that receives more emphasis or appears more central to the argument
21
21
  - The order of reasons and stances must align with the order of labels (e.g., stance_a applies to topic_a)
22
22
 
23
+ You MUST include every response ID in the output.
24
+ If the response can not be labelled return empty sections where appropriate but you MUST return an entry
25
+ with the correct response ID for each input object
23
26
 
24
27
  The final output should be in the following JSON format:
25
28
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: themefinder
3
- Version: 0.4.1
3
+ Version: 0.5.2
4
4
  Summary: A topic modelling Python package designed for analysing one-to-many question-answer data eg free-text survey responses.
5
5
  License: MIT
6
6
  Author: i.AI
@@ -1,15 +1,15 @@
1
1
  themefinder/__init__.py,sha256=p6QoCgA-BYWljk8yPOeTgkNcN5m_gA_o3Q86Eh0QjSM,327
2
- themefinder/core.py,sha256=gLvWfDxHKwKlcozAZkqbJyMsBoIqWEjxIqQ-mpFIvqk,17541
3
- themefinder/llm_batch_processor.py,sha256=VToyxuVDRzh3SFbVq9HnkU1F8YNsZqmYvCoznvLt22c,12573
2
+ themefinder/core.py,sha256=pDm6HTAbkk382THIHuFBN2qI5UIMDKJsfpsP2nBzUIg,17541
3
+ themefinder/llm_batch_processor.py,sha256=SDDeMJeX1J3u7FGFddRhVSxty6U8lFVXwG4eNI_0C5o,12573
4
4
  themefinder/prompts/consultation_system_prompt.txt,sha256=_A07oY_an4hnRx-9pQ0y-TLXJz0dd8vDI-MZne7Mdb4,89
5
- themefinder/prompts/sentiment_analysis.txt,sha256=nisBTu4hW0nXB8V_BjQ-1balkuj1E2lRDz5zDjxM7cQ,1626
5
+ themefinder/prompts/sentiment_analysis.txt,sha256=e3DcUKga6pSFcfeo2TAq8x9LXk0YDV-D7P2gtymcyuc,1832
6
6
  themefinder/prompts/theme_condensation.txt,sha256=GFwwQO_oZHhqhPnAfTn887fDzAIVxKoCyj0hXagyBIU,1645
7
7
  themefinder/prompts/theme_generation.txt,sha256=JMXuNojxdSAcxPRU1Jg12Xunv_dX4hNvXYU2pXMWTAw,2500
8
- themefinder/prompts/theme_mapping.txt,sha256=hiyGdWIR7UWdF1g7yqN_kL7o58LFyLtBVVrfJvGcsVU,2088
8
+ themefinder/prompts/theme_mapping.txt,sha256=_7AUGraX4LrnZywO3RiG58NkGbM9vaPwGI1r0dFNGik,2297
9
9
  themefinder/prompts/theme_refinement.txt,sha256=HCgvWAoz-cpFgjX_QS_VVY0X06d4ds0ekBgcoWyFyfg,3360
10
10
  themefinder/prompts/theme_target_alignment.txt,sha256=-_ghr4--KAN6Tz8ExO9s2IXvI6pjWaEA_nG5L83GV5I,1035
11
11
  themefinder/themefinder_logging.py,sha256=n5SUQovEZLC4skEbxicjz_fOGF9mOk3S-Wpj5uXsaL8,314
12
- themefinder-0.4.1.dist-info/LICENCE,sha256=C9ULIN0ctF60ZxUWH_hw1H434bDLg49Z-Qzn6BUHgqs,1060
13
- themefinder-0.4.1.dist-info/METADATA,sha256=GFqwQ6Gss61JCuTXz9RjlSnus6Rrgvy1L9KCifoEhpc,6431
14
- themefinder-0.4.1.dist-info/WHEEL,sha256=IYZQI976HJqqOpQU6PHkJ8fb3tMNBFjg-Cn-pwAbaFM,88
15
- themefinder-0.4.1.dist-info/RECORD,,
12
+ themefinder-0.5.2.dist-info/LICENCE,sha256=C9ULIN0ctF60ZxUWH_hw1H434bDLg49Z-Qzn6BUHgqs,1060
13
+ themefinder-0.5.2.dist-info/METADATA,sha256=RBCyjI9-oU6hoC9MRcf9HEs4Sb_regeK8aoDAy_AQco,6431
14
+ themefinder-0.5.2.dist-info/WHEEL,sha256=XbeZDeTWKc1w7CSIyre5aMDU_-PohRwTQceYnisIYYY,88
15
+ themefinder-0.5.2.dist-info/RECORD,,
@@ -1,4 +1,4 @@
1
1
  Wheel-Version: 1.0
2
- Generator: poetry-core 2.0.1
2
+ Generator: poetry-core 2.1.1
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any