cat-llm 0.0.22__py3-none-any.whl → 0.0.23__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.22
3
+ Version: 0.0.23
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,8 @@
1
+ catllm/CERAD_functions.py,sha256=Pxk8EE6fYDXQds_X_rpOkSYdC3qL1uk1J22dNqlIGsU,15245
2
+ catllm/__about__.py,sha256=zwS1-qZYSyAy-RZXHHvm1VlcPU3oJNBheC_aGVi7IN0,404
3
+ catllm/__init__.py,sha256=mNp5MQx2aNTtpNBHJ-U9INd1hX3u6jRkOoAewEI25MI,298
4
+ catllm/cat_llm.py,sha256=TJmdM_O9oL7wvTuwohQLY5vgaAttIElCcfXEJHzdhfM,58311
5
+ cat_llm-0.0.23.dist-info/METADATA,sha256=ULEDGfqEUjLUK8g89BAuaIIkmVnsenVM8jvEPpMKErg,1679
6
+ cat_llm-0.0.23.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
7
+ cat_llm-0.0.23.dist-info/licenses/LICENSE,sha256=wJLsvOr6lrFUDcoPXExa01HOKFWrS3JC9f0RudRw8uw,1075
8
+ cat_llm-0.0.23.dist-info/RECORD,,
catllm/CERAD_functions.py CHANGED
@@ -1,10 +1,14 @@
1
- # image multi-class (binary) function
2
- def cerad_score(
1
+ # a function specifically for CERAD Constructional Praxis test
2
+ # specifically for pictures of drawings of shapes like circles, diamonds, rectangles, and cubes
3
+ # SPDX-FileCopyrightText: 2025-present Christopher Soria <
4
+ def cerad_drawn_score(
3
5
  shape,
4
6
  image_input,
5
7
  api_key,
6
8
  user_model="gpt-4o-2024-11-20",
7
9
  creativity=0,
10
+ reference_in_image=False,
11
+ provide_reference=False,
8
12
  safety=False,
9
13
  filename="categorized_data.csv",
10
14
  model_source="OpenAI"
@@ -21,7 +25,7 @@ def cerad_score(
21
25
  shape = shape.lower()
22
26
 
23
27
  if shape == "circle":
24
- categories = ["It has a drawing of a circle",
28
+ categories = ["The image contains a drawing that clearly represents a circle",
25
29
  "The drawing does not resemble a circle",
26
30
  "The drawing resembles a circle",
27
31
  "The circle is closed",
@@ -30,7 +34,7 @@ def cerad_score(
30
34
  "The circle is almost circular",
31
35
  "None of the above descriptions apply"]
32
36
  elif shape == "diamond":
33
- categories = ["It has a drawing of a diamond",
37
+ categories = ["The image contains a drawing that clearly represents a diamond shape",
34
38
  "It has a drawing of a square",
35
39
  "A drawn shape DOES NOT resemble a diamond",
36
40
  "A drawn shape resembles a diamond",
@@ -39,7 +43,7 @@ def cerad_score(
39
43
  "If a diamond is drawn it's more elaborate than a simple diamond (such as overlapping diamonds or a diamond with an extras lines inside)",
40
44
  "None of the above descriptions apply"]
41
45
  elif shape == "rectangles" or shape == "overlapping rectangles":
42
- categories = ["It has a drawing of overlapping rectangles",
46
+ categories = ["The image contains a drawing that clearly represents overlapping rectangles",
43
47
  "A drawn shape DOES NOT resemble a overlapping rectangles",
44
48
  "A drawn shape resembles a overlapping rectangles",
45
49
  "Rectangle 1 has 4 sides",
@@ -101,6 +105,11 @@ def cerad_score(
101
105
  # Handle extension safely
102
106
  ext = Path(img_path).suffix.lstrip(".").lower()
103
107
  encoded_image = f"data:image/{ext};base64,{encoded}"
108
+
109
+ if reference_in_image:
110
+ 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"
111
+ else:
112
+ reference_text = f"Image is expected to show within it a drawing of a {shape}.\n\n"
104
113
 
105
114
  prompt = [
106
115
  {
@@ -123,6 +132,7 @@ def cerad_score(
123
132
  "image_url": {"url": encoded_image, "detail": "high"},
124
133
  },
125
134
  ]
135
+ print(prompt)
126
136
  if model_source == "OpenAI":
127
137
  from openai import OpenAI
128
138
  client = OpenAI(api_key=api_key)
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.22"
4
+ __version__ = "0.0.23"
5
5
  __author__ = "Chris Soria"
6
6
  __email__ = "chrissoria@berkeley.edu"
7
7
  __title__ = "cat-llm"
catllm/__init__.py CHANGED
@@ -12,4 +12,4 @@ from .__about__ import (
12
12
  )
13
13
 
14
14
  from .cat_llm import *
15
- #from .CERAD_functions import *
15
+ from .CERAD_functions import *
catllm/cat_llm.py CHANGED
@@ -1094,7 +1094,7 @@ def cerad_score(
1094
1094
  shape = shape.lower()
1095
1095
 
1096
1096
  if shape == "circle":
1097
- categories = ["It has a drawing of a circle",
1097
+ categories = ["The image contains a drawing that clearly represents a circle",
1098
1098
  "The drawing does not resemble a circle",
1099
1099
  "The drawing resembles a circle",
1100
1100
  "The circle is closed",
@@ -1103,7 +1103,7 @@ def cerad_score(
1103
1103
  "The circle is almost circular",
1104
1104
  "None of the above descriptions apply"]
1105
1105
  elif shape == "diamond":
1106
- categories = ["It has a drawing of a diamond",
1106
+ categories = ["The image contains a drawing that clearly represents a diamond shape",
1107
1107
  "It has a drawing of a square",
1108
1108
  "A drawn shape DOES NOT resemble a diamond",
1109
1109
  "A drawn shape resembles a diamond",
@@ -1112,7 +1112,7 @@ def cerad_score(
1112
1112
  "If a diamond is drawn it's more elaborate than a simple diamond (such as overlapping diamonds or a diamond with an extras lines inside)",
1113
1113
  "None of the above descriptions apply"]
1114
1114
  elif shape == "rectangles" or shape == "overlapping rectangles":
1115
- categories = ["It has a drawing of overlapping rectangles",
1115
+ categories = ["The image contains a drawing that clearly represents overlapping rectangles",
1116
1116
  "A drawn shape DOES NOT resemble a overlapping rectangles",
1117
1117
  "A drawn shape resembles a overlapping rectangles",
1118
1118
  "Rectangle 1 has 4 sides",
@@ -1,8 +0,0 @@
1
- catllm/CERAD_functions.py,sha256=Qb6-X4147pLkiGYnhCiTZbUllnI_Phc78NeEGm9IYic,14560
2
- catllm/__about__.py,sha256=99aNi54Pad2znZPHwQtb9H2nkF1CTegDDOFO6fNlmcE,404
3
- catllm/__init__.py,sha256=bgH_2K70m3WP9B8GZNciAr7ld7bSNwgpzhYgkoAC8Bo,299
4
- catllm/cat_llm.py,sha256=QNa8ZD3z5cWZtdu0gQfkLYq2I96aGwGCUUN61E50RKA,58206
5
- cat_llm-0.0.22.dist-info/METADATA,sha256=W2tUxYh5WcE8LFHDRJJR6xZO5vRdzPDBIsv7i4JOJ04,1679
6
- cat_llm-0.0.22.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
7
- cat_llm-0.0.22.dist-info/licenses/LICENSE,sha256=wJLsvOr6lrFUDcoPXExa01HOKFWrS3JC9f0RudRw8uw,1075
8
- cat_llm-0.0.22.dist-info/RECORD,,