cat-llm 0.0.36__tar.gz → 0.0.38__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.36
3
+ Version: 0.0.38
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
@@ -20,6 +20,7 @@ Classifier: Programming Language :: Python :: Implementation :: CPython
20
20
  Classifier: Programming Language :: Python :: Implementation :: PyPy
21
21
  Requires-Python: >=3.8
22
22
  Requires-Dist: pandas
23
+ Requires-Dist: pkg-resources
23
24
  Requires-Dist: tqdm
24
25
  Description-Content-Type: text/markdown
25
26
 
@@ -367,10 +368,10 @@ Processes each image individually, evaluating the drawn shapes based on CERAD cr
367
368
  - `user_model` (str, default="gpt-4o"): Specific model to use
368
369
  - `creativity` (float, default=0): Temperature/randomness setting (0.0-1.0)
369
370
  - `reference_in_image` (bool, default=False): Whether a reference shape is present in the image for comparison
370
- - `provide_reference` (bool, default=False): Whether to provide a reference example image or description
371
+ - `provide_reference` (bool, default=False): Whether to provide a reference example image (built in reference image)
371
372
  - `safety` (bool, default=False): Enable safety checks and save results at each API call step
372
373
  - `filename` (str, default="categorized_data.csv"): Filename for CSV output
373
- - `model_source` (str, default="OpenAI"): Model provider ("OpenAI", "Anthropic", "Perplexity", "Mistral")
374
+ - `model_source` (str, default="OpenAI"): Model provider ("OpenAI", "Anthropic", "Mistral")
374
375
 
375
376
  **Returns:**
376
377
  - `pandas.DataFrame`: DataFrame with image paths, CERAD scores, and analysis details
@@ -342,10 +342,10 @@ Processes each image individually, evaluating the drawn shapes based on CERAD cr
342
342
  - `user_model` (str, default="gpt-4o"): Specific model to use
343
343
  - `creativity` (float, default=0): Temperature/randomness setting (0.0-1.0)
344
344
  - `reference_in_image` (bool, default=False): Whether a reference shape is present in the image for comparison
345
- - `provide_reference` (bool, default=False): Whether to provide a reference example image or description
345
+ - `provide_reference` (bool, default=False): Whether to provide a reference example image (built in reference image)
346
346
  - `safety` (bool, default=False): Enable safety checks and save results at each API call step
347
347
  - `filename` (str, default="categorized_data.csv"): Filename for CSV output
348
- - `model_source` (str, default="OpenAI"): Model provider ("OpenAI", "Anthropic", "Perplexity", "Mistral")
348
+ - `model_source` (str, default="OpenAI"): Model provider ("OpenAI", "Anthropic", "Mistral")
349
349
 
350
350
  **Returns:**
351
351
  - `pandas.DataFrame`: DataFrame with image paths, CERAD scores, and analysis details
@@ -26,7 +26,8 @@ classifiers = [
26
26
  ]
27
27
  dependencies = [
28
28
  "pandas",
29
- "tqdm"
29
+ "tqdm",
30
+ "pkg_resources"
30
31
  ]
31
32
 
32
33
  [project.urls]
@@ -165,14 +165,13 @@ def cerad_drawn_score(
165
165
  if provide_reference:
166
166
  prompt.append({
167
167
  "type": "image_url",
168
- "image_url": {"url": reference_image, "detail": "high"}
168
+ "image_url": {"url": encoded_ref_image, "detail": "high"}
169
169
  })
170
170
 
171
171
  prompt.append({
172
172
  "type": "image_url",
173
173
  "image_url": {"url": encoded_image, "detail": "high"}
174
174
  })
175
- print(prompt)
176
175
 
177
176
  elif model_source == "Anthropic":
178
177
  prompt = [
@@ -190,16 +189,29 @@ def cerad_drawn_score(
190
189
  f"Example:\n"
191
190
  f"{example_JSON}"
192
191
  ),
193
- },
194
- {
192
+ }
193
+ ]
194
+
195
+ if provide_reference:
196
+ prompt.append({
197
+ "type": "image",
198
+ "source": {
199
+ "type": "base64",
200
+ "media_type": "image/png",
201
+ "data": encoded_ref
202
+ }
203
+ }
204
+ )
205
+
206
+ prompt.append({
195
207
  "type": "image",
196
208
  "source": {
197
209
  "type": "base64",
198
210
  "media_type": "image/jpeg",
199
211
  "data": encoded
200
212
  }
201
- }
202
- ]
213
+ }
214
+ )
203
215
 
204
216
  elif model_source == "Mistral":
205
217
  prompt = [
@@ -217,12 +229,18 @@ def cerad_drawn_score(
217
229
  f"Example:\n"
218
230
  f"{example_JSON}"
219
231
  ),
220
- },
221
- {
222
- "type": "image_url",
223
- "image_url": f"data:image/jpeg;base64,{encoded}"
224
232
  }
225
233
  ]
234
+ if provide_reference:
235
+ prompt.append({
236
+ "type": "image_url",
237
+ "image_url": f"data:image/{ext};base64,{encoded_ref}"
238
+ })
239
+
240
+ prompt.append({
241
+ "type": "image_url",
242
+ "image_url": f"data:image/{ext};base64,{encoded_image}"
243
+ })
226
244
 
227
245
  if model_source == "OpenAI":
228
246
  from openai import OpenAI
@@ -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.36"
4
+ __version__ = "0.0.38"
5
5
  __author__ = "Chris Soria"
6
6
  __email__ = "chrissoria@berkeley.edu"
7
7
  __title__ = "cat-llm"
File without changes