cat-llm 0.0.57__py3-none-any.whl → 0.0.59__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.57.dist-info → cat_llm-0.0.59.dist-info}/METADATA +1 -1
- {cat_llm-0.0.57.dist-info → cat_llm-0.0.59.dist-info}/RECORD +7 -7
- catllm/__about__.py +1 -1
- catllm/build_web_research.py +32 -3
- catllm/text_functions.py +0 -1
- {cat_llm-0.0.57.dist-info → cat_llm-0.0.59.dist-info}/WHEEL +0 -0
- {cat_llm-0.0.57.dist-info → cat_llm-0.0.59.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.59
|
|
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
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
catllm/CERAD_functions.py,sha256=ZCKyCiv-2eUPzJ7Yhrz4Y0OJK4iEyWMnOUI7mFDsoEI,22471
|
|
2
|
-
catllm/__about__.py,sha256=
|
|
2
|
+
catllm/__about__.py,sha256=sFpDAFDHuCRUsxZfcPhpF4HRhFnFXsmeLWtwEV6xI84,404
|
|
3
3
|
catllm/__init__.py,sha256=sf02zp7N0NW0mAQi7eQ4gliWR1EwoqvXkHN2HwwjcTE,372
|
|
4
|
-
catllm/build_web_research.py,sha256=
|
|
4
|
+
catllm/build_web_research.py,sha256=4nANCNeu_j2s3D7ouuZU_x-ZN0YS3TcsVglZZPuJYLU,8121
|
|
5
5
|
catllm/image_functions.py,sha256=8dUpwHwVe4Vf06wjFNgLnh54q5upo4E-P87-TKaSECE,35519
|
|
6
|
-
catllm/text_functions.py,sha256=
|
|
6
|
+
catllm/text_functions.py,sha256=EL-jbVX6GJ9MX4yULz_RJOOhsYEjooaEK5lAagTeyWY,18083
|
|
7
7
|
catllm/images/circle.png,sha256=JWujAWAh08-TajAoEr_TAeFNLlfbryOLw6cgIBREBuQ,86202
|
|
8
8
|
catllm/images/cube.png,sha256=nFec3e5bmRe4zrBCJ8QK-HcJLrG7u7dYdKhmdMfacfE,77275
|
|
9
9
|
catllm/images/diamond.png,sha256=rJDZKtsnBGRO8FPA0iHuA8FvHFGi9PkI_DWSFdw6iv0,99568
|
|
10
10
|
catllm/images/overlapping_pentagons.png,sha256=VO5plI6eoVRnjfqinn1nNzsCP2WQhuQy71V0EASouW4,71208
|
|
11
11
|
catllm/images/rectangles.png,sha256=2XM16HO9EYWj2yHgN4bPXaCwPfl7iYQy0tQUGaJX9xg,40692
|
|
12
|
-
cat_llm-0.0.
|
|
13
|
-
cat_llm-0.0.
|
|
14
|
-
cat_llm-0.0.
|
|
15
|
-
cat_llm-0.0.
|
|
12
|
+
cat_llm-0.0.59.dist-info/METADATA,sha256=VzCCPeGKFoyTcewKlmqDO0OsnZTLcE46TJzpQ-nv9Fo,22370
|
|
13
|
+
cat_llm-0.0.59.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
14
|
+
cat_llm-0.0.59.dist-info/licenses/LICENSE,sha256=Vje2sS5WV4TnIwY5uQHrF4qnBAM3YOk1pGpdH0ot-2o,34969
|
|
15
|
+
cat_llm-0.0.59.dist-info/RECORD,,
|
catllm/__about__.py
CHANGED
catllm/build_web_research.py
CHANGED
|
@@ -88,13 +88,42 @@ def build_web_research_dataset(
|
|
|
88
88
|
if getattr(block, "type", "") == "text"
|
|
89
89
|
).strip()
|
|
90
90
|
link1.append(reply)
|
|
91
|
-
print(reply)
|
|
92
91
|
|
|
93
92
|
except Exception as e:
|
|
94
93
|
print(f"An error occurred: {e}")
|
|
95
94
|
link1.append(f"Error processing input: {e}")
|
|
95
|
+
|
|
96
|
+
elif model_source == "Google":
|
|
97
|
+
import requests
|
|
98
|
+
url = f"https://generativelanguage.googleapis.com/v1beta/models/{user_model}:generateContent"
|
|
99
|
+
try:
|
|
100
|
+
headers = {
|
|
101
|
+
"x-goog-api-key": api_key,
|
|
102
|
+
"Content-Type": "application/json"
|
|
103
|
+
}
|
|
104
|
+
payload = {
|
|
105
|
+
"contents": [{"parts": [{"text": prompt}]}],
|
|
106
|
+
"tools": [{"google_search": {}}] # Enable search grounding
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
response = requests.post(url, headers=headers, json=payload)
|
|
110
|
+
response.raise_for_status()
|
|
111
|
+
result = response.json()
|
|
112
|
+
|
|
113
|
+
# extract reply from Google's response structure
|
|
114
|
+
if "candidates" in result and result["candidates"]:
|
|
115
|
+
reply = result["candidates"][0]["content"]["parts"][0]["text"]
|
|
116
|
+
else:
|
|
117
|
+
reply = "No response generated"
|
|
118
|
+
|
|
119
|
+
link1.append(reply)
|
|
120
|
+
|
|
121
|
+
except Exception as e:
|
|
122
|
+
print(f"An error occurred: {e}")
|
|
123
|
+
link1.append(f"Error processing input: {e}")
|
|
124
|
+
|
|
96
125
|
else:
|
|
97
|
-
raise ValueError("Unknown source! Currently this function only supports 'Anthropic' as model_source.")
|
|
126
|
+
raise ValueError("Unknown source! Currently this function only supports 'Anthropic' or 'Google' as model_source.")
|
|
98
127
|
# in situation that no JSON is found
|
|
99
128
|
if reply is not None:
|
|
100
129
|
extracted_json = regex.findall(r'\{(?:[^{}]|(?R))*\}', reply, regex.DOTALL)
|
|
@@ -126,7 +155,7 @@ def build_web_research_dataset(
|
|
|
126
155
|
# Save progress so far
|
|
127
156
|
temp_df = pd.DataFrame({
|
|
128
157
|
'survey_response': search_input[:idx+1],
|
|
129
|
-
'
|
|
158
|
+
'model_response': link1,
|
|
130
159
|
'json': extracted_jsons
|
|
131
160
|
})
|
|
132
161
|
# Normalize processed jsons so far
|
catllm/text_functions.py
CHANGED
|
@@ -334,7 +334,6 @@ Provide your work in JSON format where the number belonging to each category is
|
|
|
334
334
|
reply = "No response generated"
|
|
335
335
|
|
|
336
336
|
link1.append(reply)
|
|
337
|
-
print(reply)
|
|
338
337
|
except Exception as e:
|
|
339
338
|
print(f"An error occurred: {e}")
|
|
340
339
|
link1.append(f"Error processing input: {e}")
|
|
File without changes
|
|
File without changes
|