cat-llm 0.0.28__tar.gz → 0.0.29__tar.gz

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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: cat-llm
3
- Version: 0.0.28
3
+ Version: 0.0.29
4
4
  Summary: A tool for categorizing text data and images using LLMs and vision models
5
5
  Project-URL: Documentation, https://github.com/chrissoria/cat-llm#readme
6
6
  Project-URL: Issues, https://github.com/chrissoria/cat-llm/issues
@@ -130,28 +130,56 @@ def cerad_drawn_score(
130
130
  reference_text = f"This image contains a perfect reference image of a {shape}. Next to is a drawing that is meant to be similar to the reference {shape}.\n\n"
131
131
  else:
132
132
  reference_text = f"Image is expected to show within it a drawing of a {shape}.\n\n"
133
-
134
- prompt = [
135
- {
136
- "type": "text",
137
- "text": (
138
- f"You are an image-tagging assistant trained in the CERAD Constructional Praxis test.\n"
139
- f"Task Examine the attached image and decide, **for each category below**, "
140
- f"whether it is PRESENT (1) or NOT PRESENT (0).\n\n"
141
- f"{reference_text}"
142
- f"Categories:\n{categories_str}\n\n"
143
- f"Output format ► Respond with **only** a JSON object whose keys are the "
144
- f"quoted category numbers ('1', '2', …) and whose values are 1 or 0. "
145
- f"No additional keys, comments, or text.\n\n"
146
- f"Example:\n"
147
- f"{example_JSON}"
148
- ),
149
- },
150
- {
151
- "type": "image_url",
152
- "image_url": {"url": encoded_image, "detail": "high"},
153
- },
154
- ]
133
+
134
+ if model_source == "OpenAI":
135
+ prompt = [
136
+ {
137
+ "type": "text",
138
+ "text": (
139
+ f"You are an image-tagging assistant trained in the CERAD Constructional Praxis test.\n"
140
+ f"Task Examine the attached image and decide, **for each category below**, "
141
+ f"whether it is PRESENT (1) or NOT PRESENT (0).\n\n"
142
+ f"{reference_text}"
143
+ f"Categories:\n{categories_str}\n\n"
144
+ f"Output format Respond with **only** a JSON object whose keys are the "
145
+ f"quoted category numbers ('1', '2', …) and whose values are 1 or 0. "
146
+ f"No additional keys, comments, or text.\n\n"
147
+ f"Example:\n"
148
+ f"{example_JSON}"
149
+ ),
150
+ },
151
+ {
152
+ "type": "image_url",
153
+ "image_url": {"url": encoded_image, "detail": "high"},
154
+ },
155
+ ]
156
+ elif model_source == "Anthropic":
157
+ prompt = [
158
+ {
159
+ "type": "text",
160
+ "text": (
161
+ f"You are an image-tagging assistant trained in the CERAD Constructional Praxis test.\n"
162
+ f"Task ► Examine the attached image and decide, **for each category below**, "
163
+ f"whether it is PRESENT (1) or NOT PRESENT (0).\n\n"
164
+ f"{reference_text}"
165
+ f"Categories:\n{categories_str}\n\n"
166
+ f"Output format ► Respond with **only** a JSON object whose keys are the "
167
+ f"quoted category numbers ('1', '2', …) and whose values are 1 or 0. "
168
+ f"No additional keys, comments, or text.\n\n"
169
+ f"Example:\n"
170
+ f"{example_JSON}"
171
+ ),
172
+ },
173
+ {
174
+ "type": "image",
175
+ "source": {
176
+ "type": "base64",
177
+ "media_type": "image/jpeg",
178
+ "data": encoded
179
+ }
180
+ },
181
+ ]
182
+
155
183
  if model_source == "OpenAI":
156
184
  from openai import OpenAI
157
185
  client = OpenAI(api_key=api_key)
@@ -1,7 +1,7 @@
1
1
  # SPDX-FileCopyrightText: 2025-present Christopher Soria <chrissoria@berkeley.edu>
2
2
  #
3
3
  # SPDX-License-Identifier: MIT
4
- __version__ = "0.0.28"
4
+ __version__ = "0.0.29"
5
5
  __author__ = "Chris Soria"
6
6
  __email__ = "chrissoria@berkeley.edu"
7
7
  __title__ = "cat-llm"
@@ -219,7 +219,7 @@ Return the top {top_n} categories as a numbered list sorted from the most to lea
219
219
  return top_categories_final
220
220
 
221
221
  #multi-class text classification
222
- def extract_multi_class(
222
+ def multi_class(
223
223
  survey_question,
224
224
  survey_input,
225
225
  categories,
@@ -391,5 +391,4 @@ Provide your work in JSON format where the number belonging to each category is
391
391
  save_directory = os.getcwd()
392
392
  categorized_data.to_csv(os.path.join(save_directory, filename), index=False)
393
393
 
394
- return categorized_data
395
-
394
+ return categorized_data
File without changes
File without changes
File without changes