cat-llm 0.0.29__py3-none-any.whl → 0.0.30__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: cat-llm
3
- Version: 0.0.29
3
+ Version: 0.0.30
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
@@ -0,0 +1,9 @@
1
+ catllm/CERAD_functions.py,sha256=OQOkCjC0J0ZiandP2J7YCx39KgdndJN3fAzq5XHYozs,18774
2
+ catllm/__about__.py,sha256=YibkqP-aDZxbnylzJCTNLSTsAvGv9UhLUggZCWgK6kQ,404
3
+ catllm/__init__.py,sha256=kLk180aJna1s-wU6CLr4_hKkbjoeET-11jGmC1pdhQw,330
4
+ catllm/cat_llm.py,sha256=TNsjYKpr8ZH9jeAYN-4DcFcrnR8x2eRl99oXzpdhE0Q,16910
5
+ catllm/image_functions.py,sha256=JLlv5qQhAQzgsRIY18rUPtM1P7x1Fw2UlWlI1dpv3dA,31272
6
+ cat_llm-0.0.30.dist-info/METADATA,sha256=U0z9dm0ZCtDS5opnhns2irSQjQP00qlRqQEljPy_tG8,1679
7
+ cat_llm-0.0.30.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
8
+ cat_llm-0.0.30.dist-info/licenses/LICENSE,sha256=wJLsvOr6lrFUDcoPXExa01HOKFWrS3JC9f0RudRw8uw,1075
9
+ cat_llm-0.0.30.dist-info/RECORD,,
catllm/CERAD_functions.py CHANGED
@@ -179,6 +179,29 @@ def cerad_drawn_score(
179
179
  }
180
180
  },
181
181
  ]
182
+
183
+ elif model_source == "Mistral":
184
+ prompt = [
185
+ {
186
+ "role": "system",
187
+ "content": (
188
+ f"You are an image-tagging assistant trained in the CERAD Constructional Praxis test.\n"
189
+ f"Task ► Examine the attached image and decide, **for each category below**, "
190
+ f"whether it is PRESENT (1) or NOT PRESENT (0).\n\n"
191
+ f"{reference_text}"
192
+ f"Categories:\n{categories_str}\n\n"
193
+ f"Output format ► Respond with **only** a JSON object whose keys are the "
194
+ f"quoted category numbers ('1', '2', …) and whose values are 1 or 0. "
195
+ f"No additional keys, comments, or text.\n\n"
196
+ f"Example:\n"
197
+ f"{example_JSON}"
198
+ ),
199
+ },
200
+ {
201
+ "type": "image_url",
202
+ "image_url": f"data:image/jpeg;base64,{base64_image}"
203
+ }
204
+ ]
182
205
 
183
206
  if model_source == "OpenAI":
184
207
  from openai import OpenAI
@@ -195,20 +218,6 @@ def cerad_drawn_score(
195
218
  print(f"An error occurred: {e}")
196
219
  link1.append(f"Error processing input: {e}")
197
220
 
198
- elif model_source == "Perplexity":
199
- from openai import OpenAI
200
- client = OpenAI(api_key=api_key, base_url="https://api.perplexity.ai")
201
- try:
202
- response_obj = client.chat.completions.create(
203
- model=user_model,
204
- messages=[{'role': 'user', 'content': prompt}],
205
- temperature=creativity
206
- )
207
- reply = response_obj.choices[0].message.content
208
- link1.append(reply)
209
- except Exception as e:
210
- print(f"An error occurred: {e}")
211
- link1.append(f"Error processing input: {e}")
212
221
  elif model_source == "Anthropic":
213
222
  import anthropic
214
223
  client = anthropic.Anthropic(api_key=api_key)
@@ -224,6 +233,7 @@ def cerad_drawn_score(
224
233
  except Exception as e:
225
234
  print(f"An error occurred: {e}")
226
235
  link1.append(f"Error processing input: {e}")
236
+
227
237
  elif model_source == "Mistral":
228
238
  from mistralai import Mistral
229
239
  client = Mistral(api_key=api_key)
@@ -241,7 +251,7 @@ def cerad_drawn_score(
241
251
  print(f"An error occurred: {e}")
242
252
  link1.append(f"Error processing input: {e}")
243
253
  else:
244
- raise ValueError("Unknown source! Choose from OpenAI, Anthropic, Perplexity, or Mistral")
254
+ raise ValueError("Unknown source! Choose from OpenAI, Perplexity, or Mistral")
245
255
  # in situation that no JSON is found
246
256
  if reply is not None:
247
257
  extracted_json = regex.findall(r'\{(?:[^{}]|(?R))*\}', reply, regex.DOTALL)
catllm/__about__.py CHANGED
@@ -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.29"
4
+ __version__ = "0.0.30"
5
5
  __author__ = "Chris Soria"
6
6
  __email__ = "chrissoria@berkeley.edu"
7
7
  __title__ = "cat-llm"
@@ -1,9 +0,0 @@
1
- catllm/CERAD_functions.py,sha256=KaKrtw71VGNzWBRv7B_dMwGT6iYg3D7G5l5nUFKImMw,18332
2
- catllm/__about__.py,sha256=QnNiB46oNOtCa5XpK0snsSnXws0EtbKwFamcLpxgaIk,404
3
- catllm/__init__.py,sha256=kLk180aJna1s-wU6CLr4_hKkbjoeET-11jGmC1pdhQw,330
4
- catllm/cat_llm.py,sha256=TNsjYKpr8ZH9jeAYN-4DcFcrnR8x2eRl99oXzpdhE0Q,16910
5
- catllm/image_functions.py,sha256=JLlv5qQhAQzgsRIY18rUPtM1P7x1Fw2UlWlI1dpv3dA,31272
6
- cat_llm-0.0.29.dist-info/METADATA,sha256=CPxmYv0wGD7HMY-rMyNa3wYR6sZ7d1Okg2SWJaqAHa0,1679
7
- cat_llm-0.0.29.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
8
- cat_llm-0.0.29.dist-info/licenses/LICENSE,sha256=wJLsvOr6lrFUDcoPXExa01HOKFWrS3JC9f0RudRw8uw,1075
9
- cat_llm-0.0.29.dist-info/RECORD,,