cat-llm 0.0.28__py3-none-any.whl → 0.0.29__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.28.dist-info → cat_llm-0.0.29.dist-info}/METADATA +1 -1
- cat_llm-0.0.29.dist-info/RECORD +9 -0
- catllm/CERAD_functions.py +50 -22
- catllm/__about__.py +1 -1
- catllm/cat_llm.py +2 -3
- cat_llm-0.0.28.dist-info/RECORD +0 -9
- {cat_llm-0.0.28.dist-info → cat_llm-0.0.29.dist-info}/WHEEL +0 -0
- {cat_llm-0.0.28.dist-info → cat_llm-0.0.29.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.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
|
|
@@ -0,0 +1,9 @@
|
|
|
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,,
|
catllm/CERAD_functions.py
CHANGED
|
@@ -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
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
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)
|
catllm/__about__.py
CHANGED
catllm/cat_llm.py
CHANGED
|
@@ -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
|
|
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
|
cat_llm-0.0.28.dist-info/RECORD
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
catllm/CERAD_functions.py,sha256=mtHxshRWmWXMH9kkkCfbMHXgDe00EVabjFiN8s73LPI,16935
|
|
2
|
-
catllm/__about__.py,sha256=ZBz_2FX253RxgXFq-1v4qkfIEZi38fNzs_Rp2e3ZdCo,404
|
|
3
|
-
catllm/__init__.py,sha256=kLk180aJna1s-wU6CLr4_hKkbjoeET-11jGmC1pdhQw,330
|
|
4
|
-
catllm/cat_llm.py,sha256=Rwyz93caNf0h9tfurObY6qDjtG6EKaYXR0GrVW7h2kU,16920
|
|
5
|
-
catllm/image_functions.py,sha256=JLlv5qQhAQzgsRIY18rUPtM1P7x1Fw2UlWlI1dpv3dA,31272
|
|
6
|
-
cat_llm-0.0.28.dist-info/METADATA,sha256=zcHC8uPOLGIr9GOeq1Qyf04WebFdYEY5p4f8ZoZAwHg,1679
|
|
7
|
-
cat_llm-0.0.28.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
8
|
-
cat_llm-0.0.28.dist-info/licenses/LICENSE,sha256=wJLsvOr6lrFUDcoPXExa01HOKFWrS3JC9f0RudRw8uw,1075
|
|
9
|
-
cat_llm-0.0.28.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|