cat-llm 0.0.21__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.
- {cat_llm-0.0.21.dist-info → cat_llm-0.0.23.dist-info}/METADATA +1 -1
- cat_llm-0.0.23.dist-info/RECORD +8 -0
- catllm/CERAD_functions.py +15 -5
- catllm/__about__.py +1 -1
- catllm/__init__.py +1 -1
- catllm/cat_llm.py +4 -4
- cat_llm-0.0.21.dist-info/RECORD +0 -8
- {cat_llm-0.0.21.dist-info → cat_llm-0.0.23.dist-info}/WHEEL +0 -0
- {cat_llm-0.0.21.dist-info → cat_llm-0.0.23.dist-info}/licenses/LICENSE +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: cat-llm
|
|
3
|
-
Version: 0.0.
|
|
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
|
-
#
|
|
2
|
-
|
|
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 = ["
|
|
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 = ["
|
|
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 = ["
|
|
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
catllm/__init__.py
CHANGED
catllm/cat_llm.py
CHANGED
|
@@ -56,7 +56,7 @@ Number your categories from 1 through {cat_num} and be concise with the category
|
|
|
56
56
|
The specific task is to identify {specificity} categories of responses to a survey question. \
|
|
57
57
|
The research question is: {research_question}""" if research_question else "You are a helpful assistant."},
|
|
58
58
|
{'role': 'user', 'content': prompt}
|
|
59
|
-
]
|
|
59
|
+
],
|
|
60
60
|
temperature=creativity
|
|
61
61
|
)
|
|
62
62
|
reply = response_obj.choices[0].message.content
|
|
@@ -1094,7 +1094,7 @@ def cerad_score(
|
|
|
1094
1094
|
shape = shape.lower()
|
|
1095
1095
|
|
|
1096
1096
|
if shape == "circle":
|
|
1097
|
-
categories = ["
|
|
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 = ["
|
|
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 = ["
|
|
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",
|
cat_llm-0.0.21.dist-info/RECORD
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
catllm/CERAD_functions.py,sha256=Qb6-X4147pLkiGYnhCiTZbUllnI_Phc78NeEGm9IYic,14560
|
|
2
|
-
catllm/__about__.py,sha256=TunDrsvgMTHUI-XmOUy6ZvCm0jyzgtPLSTQ4FQ-i1EE,404
|
|
3
|
-
catllm/__init__.py,sha256=bgH_2K70m3WP9B8GZNciAr7ld7bSNwgpzhYgkoAC8Bo,299
|
|
4
|
-
catllm/cat_llm.py,sha256=z3ohaq2sXrcI6ygvQTKNNlAN5ptmNmwCimkM625j7LQ,58205
|
|
5
|
-
cat_llm-0.0.21.dist-info/METADATA,sha256=1AzIw7qX1yrWpsozHM-XfTvzk2R8nSY35yrogvt93uY,1679
|
|
6
|
-
cat_llm-0.0.21.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
7
|
-
cat_llm-0.0.21.dist-info/licenses/LICENSE,sha256=wJLsvOr6lrFUDcoPXExa01HOKFWrS3JC9f0RudRw8uw,1075
|
|
8
|
-
cat_llm-0.0.21.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|