sapiopycommons 2025.8.20a713__py3-none-any.whl → 2025.8.22a715__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.
Potentially problematic release.
This version of sapiopycommons might be problematic. Click here for more details.
- sapiopycommons/ai/test_client.py +47 -30
- {sapiopycommons-2025.8.20a713.dist-info → sapiopycommons-2025.8.22a715.dist-info}/METADATA +1 -1
- {sapiopycommons-2025.8.20a713.dist-info → sapiopycommons-2025.8.22a715.dist-info}/RECORD +5 -5
- {sapiopycommons-2025.8.20a713.dist-info → sapiopycommons-2025.8.22a715.dist-info}/WHEEL +0 -0
- {sapiopycommons-2025.8.20a713.dist-info → sapiopycommons-2025.8.22a715.dist-info}/licenses/LICENSE +0 -0
sapiopycommons/ai/test_client.py
CHANGED
|
@@ -43,10 +43,10 @@ class ToolOutput:
|
|
|
43
43
|
status: str
|
|
44
44
|
message: str
|
|
45
45
|
|
|
46
|
-
binary_output: list[bytes]
|
|
47
|
-
csv_output: list[dict[str, Any]]
|
|
48
|
-
json_output: list[Any]
|
|
49
|
-
text_output: list[str]
|
|
46
|
+
binary_output: list[list[bytes]]
|
|
47
|
+
csv_output: list[list[dict[str, Any]]]
|
|
48
|
+
json_output: list[list[Any]]
|
|
49
|
+
text_output: list[list[str]]
|
|
50
50
|
|
|
51
51
|
new_records: list[dict[str, FieldValue]]
|
|
52
52
|
|
|
@@ -67,24 +67,35 @@ class ToolOutput:
|
|
|
67
67
|
ret_val += f"\tMessage: {self.message}\n"
|
|
68
68
|
ret_val += "-" * 25 + "\n"
|
|
69
69
|
|
|
70
|
-
ret_val += f"Binary Output: {len(self.binary_output)} item(s)\n"
|
|
71
|
-
for
|
|
72
|
-
|
|
73
|
-
ret_val += f"\
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
ret_val += f"
|
|
86
|
-
for
|
|
87
|
-
|
|
70
|
+
ret_val += f"Binary Output: {sum(len(x) for x in self.binary_output)} item(s) across {len(self.binary_output)} outputs\n"
|
|
71
|
+
for i, output in enumerate(self.binary_output, start=1):
|
|
72
|
+
output: list[bytes]
|
|
73
|
+
ret_val += f"\tBinary Output {i}:\n"
|
|
74
|
+
for binary in output:
|
|
75
|
+
ret_val += f"\t\t{len(binary)} byte(s): {binary[:50]}...\n"
|
|
76
|
+
|
|
77
|
+
ret_val += f"CSV Output: {sum(len(x) for x in self.csv_output)} item(s) across {len(self.csv_output)} outputs\n"
|
|
78
|
+
for i, output in enumerate(self.csv_output, start=1):
|
|
79
|
+
output: list[dict[str, Any]]
|
|
80
|
+
ret_val += f"\tCSV Output {i}:\n"
|
|
81
|
+
ret_val += f"\t\tHeaders: {', '.join(output[0].keys())}\n"
|
|
82
|
+
for j, csv_row in enumerate(output):
|
|
83
|
+
ret_val += f"\t\t{j}: {', '.join(f'{v}' for k, v in csv_row.items())}\n"
|
|
84
|
+
|
|
85
|
+
ret_val += f"JSON Output: {sum(len(x) for x in self.json_output)} item(s) across {len(self.json_output)} outputs\n"
|
|
86
|
+
for i, output in enumerate(self.json_output, start=1):
|
|
87
|
+
output: list[Any]
|
|
88
|
+
ret_val += f"\tJSON Output {i}:\n"
|
|
89
|
+
for json_obj in output:
|
|
90
|
+
ret_val += f"\t\t"
|
|
91
|
+
ret_val += json.dumps(json_obj, indent=2).replace("\n", "\n\t\t") + "\n"
|
|
92
|
+
|
|
93
|
+
ret_val += f"Text Output: {sum(len(x) for x in self.text_output)} item(s) across {len(self.text_output)} outputs\n"
|
|
94
|
+
for i, output in enumerate(self.text_output, start=1):
|
|
95
|
+
output: list[str]
|
|
96
|
+
ret_val += f"\tText Output {i}:\n"
|
|
97
|
+
for text in output:
|
|
98
|
+
ret_val += f"\t\t{text}\n"
|
|
88
99
|
|
|
89
100
|
ret_val += f"New Records: {len(self.new_records)} item(s)\n"
|
|
90
101
|
for record in self.new_records:
|
|
@@ -277,14 +288,20 @@ class TestClient:
|
|
|
277
288
|
for item in response.output:
|
|
278
289
|
container = item.item_container
|
|
279
290
|
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
291
|
+
if container.HasField("binary_container"):
|
|
292
|
+
results.binary_output.append(list(container.binary_container.items))
|
|
293
|
+
elif container.HasField("csv_container"):
|
|
294
|
+
csv_output: list[dict[str, Any]] = []
|
|
295
|
+
for header in container.csv_container.header.cells:
|
|
296
|
+
output_row: dict[str, Any] = {}
|
|
297
|
+
for i, row in enumerate(container.csv_container.items):
|
|
298
|
+
output_row[header] = row.cells[i]
|
|
299
|
+
csv_output.append(output_row)
|
|
300
|
+
results.csv_output.append(csv_output)
|
|
301
|
+
elif container.HasField("json_container"):
|
|
302
|
+
results.json_output.append([json.loads(x) for x in container.json_container.items])
|
|
303
|
+
elif container.HasField("text_container"):
|
|
304
|
+
results.text_output.append(list(container.text_container.items))
|
|
288
305
|
|
|
289
306
|
for record in response.new_records:
|
|
290
307
|
field_map: dict[str, Any] = {x: ProtobufUtils.field_pbo_to_value(y) for x, y in record.fields.items()}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: sapiopycommons
|
|
3
|
-
Version: 2025.8.
|
|
3
|
+
Version: 2025.8.22a715
|
|
4
4
|
Summary: Official Sapio Python API Utilities Package
|
|
5
5
|
Project-URL: Homepage, https://github.com/sapiosciences
|
|
6
6
|
Author-email: Jonathan Steck <jsteck@sapiosciences.com>, Yechen Qiao <yqiao@sapiosciences.com>
|
|
@@ -3,7 +3,7 @@ sapiopycommons/ai/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU
|
|
|
3
3
|
sapiopycommons/ai/converter_service_base.py,sha256=A9DkouIT2S-SgcsphEuCpA0Jr6YjxubPVYETQXjIBLI,5065
|
|
4
4
|
sapiopycommons/ai/protobuf_utils.py,sha256=cBjbxoFAwU02kNUxEce95WnMU2CMuDD-qFaeWgvQJMQ,24599
|
|
5
5
|
sapiopycommons/ai/server.py,sha256=w70KUENxrYoMyDRFunCAlxhhwXXWBNngCwG40Po7vTU,4212
|
|
6
|
-
sapiopycommons/ai/test_client.py,sha256=
|
|
6
|
+
sapiopycommons/ai/test_client.py,sha256=iPhn7cvKNLmDAXrjpmIkZpW2pDWlUhJZHDLHJbEoWsg,15673
|
|
7
7
|
sapiopycommons/ai/tool_service_base.py,sha256=oXxhhxeKiEq3QtlJEjsWnO8wrUPruz5M2Ti3ipyBf4E,43991
|
|
8
8
|
sapiopycommons/ai/protoapi/fielddefinitions/fields_pb2.py,sha256=8tKXwLXcqFGdQHHSEBSi6Fd7dcaCFoOqmhjzqhenb_M,2372
|
|
9
9
|
sapiopycommons/ai/protoapi/fielddefinitions/fields_pb2.pyi,sha256=FwtXmNAf7iYGEFm4kbqb04v77jNHbZg18ZmEDhle_bU,1444
|
|
@@ -98,7 +98,7 @@ sapiopycommons/webhook/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3
|
|
|
98
98
|
sapiopycommons/webhook/webhook_context.py,sha256=D793uLsb1691SalaPnBUk3rOSxn_hYLhdvkaIxjNXss,1909
|
|
99
99
|
sapiopycommons/webhook/webhook_handlers.py,sha256=7o_wXOruhT9auNh8OfhJAh4WhhiPKij67FMBSpGPICc,39939
|
|
100
100
|
sapiopycommons/webhook/webservice_handlers.py,sha256=cvW6Mk_110BzYqkbk63Kg7jWrltBCDALOlkJRu8h4VQ,14300
|
|
101
|
-
sapiopycommons-2025.8.
|
|
102
|
-
sapiopycommons-2025.8.
|
|
103
|
-
sapiopycommons-2025.8.
|
|
104
|
-
sapiopycommons-2025.8.
|
|
101
|
+
sapiopycommons-2025.8.22a715.dist-info/METADATA,sha256=JIOs3zY0NNzYdznbZjlqM8I-wCYl7Qr-S_PRAMYfVnQ,3143
|
|
102
|
+
sapiopycommons-2025.8.22a715.dist-info/WHEEL,sha256=C2FUgwZgiLbznR-k0b_5k3Ai_1aASOXDss3lzCUsUug,87
|
|
103
|
+
sapiopycommons-2025.8.22a715.dist-info/licenses/LICENSE,sha256=HyVuytGSiAUQ6ErWBHTqt1iSGHhLmlC8fO7jTCuR8dU,16725
|
|
104
|
+
sapiopycommons-2025.8.22a715.dist-info/RECORD,,
|
|
File without changes
|
{sapiopycommons-2025.8.20a713.dist-info → sapiopycommons-2025.8.22a715.dist-info}/licenses/LICENSE
RENAMED
|
File without changes
|