sapiopycommons 2025.8.22a715__py3-none-any.whl → 2025.8.29a719__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.

@@ -24,7 +24,7 @@ _sym_db = _symbol_database.Default()
24
24
 
25
25
 
26
26
 
27
- DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n9sapiopycommons/ai/protoapi/plan/item/item_container.proto\"2\n\x0e\x43ontentTypePbo\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x12\n\nextensions\x18\x02 \x03(\t\"$\n\x13StepCsvHeaderRowPbo\x12\r\n\x05\x63\x65lls\x18\x01 \x03(\t\"\x1e\n\rStepCsvRowPbo\x12\r\n\x05\x63\x65lls\x18\x01 \x03(\t\"Z\n\x13StepCsvContainerPbo\x12$\n\x06header\x18\x0e \x01(\x0b\x32\x14.StepCsvHeaderRowPbo\x12\x1d\n\x05items\x18\x0f \x03(\x0b\x32\x0e.StepCsvRowPbo\"%\n\x14StepJsonContainerPbo\x12\r\n\x05items\x18\x0f \x03(\t\"%\n\x14StepTextContainerPbo\x12\r\n\x05items\x18\x0f \x03(\t\"\'\n\x16StepBinaryContainerPbo\x12\r\n\x05items\x18\x0f \x03(\x0c\"<\n\x15StepImageContainerPbo\x12\x14\n\x0cimage_format\x18\x01 \x01(\t\x12\r\n\x05items\x18\x0f \x03(\x0c\"\x94\x02\n\x14StepItemContainerPbo\x12%\n\x0c\x63ontent_type\x18\x02 \x01(\x0b\x32\x0f.ContentTypePbo\x12\x34\n\x10\x62inary_container\x18\xff\x0f \x01(\x0b\x32\x17.StepBinaryContainerPboH\x00\x12.\n\rcsv_container\x18\xfe\x0f \x01(\x0b\x32\x14.StepCsvContainerPboH\x00\x12\x30\n\x0ejson_container\x18\xfd\x0f \x01(\x0b\x32\x15.StepJsonContainerPboH\x00\x12\x30\n\x0etext_container\x18\xfc\x0f \x01(\x0b\x32\x15.StepTextContainerPboH\x00\x42\x0b\n\tcontainer*A\n\x0b\x44\x61taTypePbo\x12\n\n\x06\x42INARY\x10\x00\x12\x08\n\x04JSON\x10\x01\x12\x07\n\x03\x43SV\x10\x02\x12\x08\n\x04TEXT\x10\x03\x12\t\n\x05IMAGE\x10\x04\x42 \n\x1c\x63om.velox.protoapi.plan.itemP\x01\x62\x06proto3')
27
+ DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n9sapiopycommons/ai/protoapi/plan/item/item_container.proto\"2\n\x0e\x43ontentTypePbo\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x12\n\nextensions\x18\x02 \x03(\t\"$\n\x13StepCsvHeaderRowPbo\x12\r\n\x05\x63\x65lls\x18\x01 \x03(\t\"\x1e\n\rStepCsvRowPbo\x12\r\n\x05\x63\x65lls\x18\x01 \x03(\t\"Z\n\x13StepCsvContainerPbo\x12$\n\x06header\x18\x0e \x01(\x0b\x32\x14.StepCsvHeaderRowPbo\x12\x1d\n\x05items\x18\x0f \x03(\x0b\x32\x0e.StepCsvRowPbo\"%\n\x14StepJsonContainerPbo\x12\r\n\x05items\x18\x0f \x03(\t\"%\n\x14StepTextContainerPbo\x12\r\n\x05items\x18\x0f \x03(\t\"\'\n\x16StepBinaryContainerPbo\x12\r\n\x05items\x18\x0f \x03(\x0c\"<\n\x15StepImageContainerPbo\x12\x14\n\x0cimage_format\x18\x01 \x01(\t\x12\r\n\x05items\x18\x0f \x03(\x0c\"\xac\x02\n\x14StepItemContainerPbo\x12%\n\x0c\x63ontent_type\x18\x02 \x01(\x0b\x32\x0f.ContentTypePbo\x12\x16\n\x0e\x63ontainer_name\x18\x03 \x01(\t\x12\x34\n\x10\x62inary_container\x18\xff\x0f \x01(\x0b\x32\x17.StepBinaryContainerPboH\x00\x12.\n\rcsv_container\x18\xfe\x0f \x01(\x0b\x32\x14.StepCsvContainerPboH\x00\x12\x30\n\x0ejson_container\x18\xfd\x0f \x01(\x0b\x32\x15.StepJsonContainerPboH\x00\x12\x30\n\x0etext_container\x18\xfc\x0f \x01(\x0b\x32\x15.StepTextContainerPboH\x00\x42\x0b\n\tcontainer*A\n\x0b\x44\x61taTypePbo\x12\n\n\x06\x42INARY\x10\x00\x12\x08\n\x04JSON\x10\x01\x12\x07\n\x03\x43SV\x10\x02\x12\x08\n\x04TEXT\x10\x03\x12\t\n\x05IMAGE\x10\x04\x42 \n\x1c\x63om.velox.protoapi.plan.itemP\x01\x62\x06proto3')
28
28
 
29
29
  _globals = globals()
30
30
  _builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals)
@@ -32,8 +32,8 @@ _builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'sapiopycommons.ai.protoapi.
32
32
  if not _descriptor._USE_C_DESCRIPTORS:
33
33
  _globals['DESCRIPTOR']._loaded_options = None
34
34
  _globals['DESCRIPTOR']._serialized_options = b'\n\034com.velox.protoapi.plan.itemP\001'
35
- _globals['_DATATYPEPBO']._serialized_start=735
36
- _globals['_DATATYPEPBO']._serialized_end=800
35
+ _globals['_DATATYPEPBO']._serialized_start=759
36
+ _globals['_DATATYPEPBO']._serialized_end=824
37
37
  _globals['_CONTENTTYPEPBO']._serialized_start=61
38
38
  _globals['_CONTENTTYPEPBO']._serialized_end=111
39
39
  _globals['_STEPCSVHEADERROWPBO']._serialized_start=113
@@ -51,5 +51,5 @@ if not _descriptor._USE_C_DESCRIPTORS:
51
51
  _globals['_STEPIMAGECONTAINERPBO']._serialized_start=394
52
52
  _globals['_STEPIMAGECONTAINERPBO']._serialized_end=454
53
53
  _globals['_STEPITEMCONTAINERPBO']._serialized_start=457
54
- _globals['_STEPITEMCONTAINERPBO']._serialized_end=733
54
+ _globals['_STEPITEMCONTAINERPBO']._serialized_end=757
55
55
  # @@protoc_insertion_point(module_scope)
@@ -74,15 +74,17 @@ class StepImageContainerPbo(_message.Message):
74
74
  def __init__(self, image_format: _Optional[str] = ..., items: _Optional[_Iterable[bytes]] = ...) -> None: ...
75
75
 
76
76
  class StepItemContainerPbo(_message.Message):
77
- __slots__ = ("content_type", "binary_container", "csv_container", "json_container", "text_container")
77
+ __slots__ = ("content_type", "container_name", "binary_container", "csv_container", "json_container", "text_container")
78
78
  CONTENT_TYPE_FIELD_NUMBER: _ClassVar[int]
79
+ CONTAINER_NAME_FIELD_NUMBER: _ClassVar[int]
79
80
  BINARY_CONTAINER_FIELD_NUMBER: _ClassVar[int]
80
81
  CSV_CONTAINER_FIELD_NUMBER: _ClassVar[int]
81
82
  JSON_CONTAINER_FIELD_NUMBER: _ClassVar[int]
82
83
  TEXT_CONTAINER_FIELD_NUMBER: _ClassVar[int]
83
84
  content_type: ContentTypePbo
85
+ container_name: str
84
86
  binary_container: StepBinaryContainerPbo
85
87
  csv_container: StepCsvContainerPbo
86
88
  json_container: StepJsonContainerPbo
87
89
  text_container: StepTextContainerPbo
88
- def __init__(self, content_type: _Optional[_Union[ContentTypePbo, _Mapping]] = ..., binary_container: _Optional[_Union[StepBinaryContainerPbo, _Mapping]] = ..., csv_container: _Optional[_Union[StepCsvContainerPbo, _Mapping]] = ..., json_container: _Optional[_Union[StepJsonContainerPbo, _Mapping]] = ..., text_container: _Optional[_Union[StepTextContainerPbo, _Mapping]] = ...) -> None: ...
90
+ def __init__(self, content_type: _Optional[_Union[ContentTypePbo, _Mapping]] = ..., container_name: _Optional[str] = ..., binary_container: _Optional[_Union[StepBinaryContainerPbo, _Mapping]] = ..., csv_container: _Optional[_Union[StepCsvContainerPbo, _Mapping]] = ..., json_container: _Optional[_Union[StepJsonContainerPbo, _Mapping]] = ..., text_container: _Optional[_Union[StepTextContainerPbo, _Mapping]] = ...) -> None: ...
@@ -53,21 +53,26 @@ class BinaryResult(SapioToolResult):
53
53
  binary_data: list[bytes]
54
54
  content_type: str
55
55
  file_extensions: list[str]
56
+ name: str
56
57
 
57
- def __init__(self, binary_data: list[bytes], content_type: str = "binary", file_extensions: list[str] = None):
58
+ def __init__(self, binary_data: list[bytes], content_type: str = "binary", file_extensions: list[str] = None,
59
+ name: str | None = None):
58
60
  """
59
61
  :param binary_data: The binary data as a list of bytes.
60
62
  :param content_type: The content type of the data.
61
63
  :param file_extensions: A list of file extensions that this binary data can be saved as.
64
+ :param name: An optional identifying name for this result that will be accessible to the next tool.
62
65
  """
63
66
  self.binary_data = binary_data
64
67
  self.content_type = content_type
65
68
  self.file_extensions = file_extensions if file_extensions else []
69
+ self.name = name
66
70
 
67
71
  def to_proto(self) -> StepOutputBatchPbo | list[FieldValueMapPbo]:
68
72
  return StepOutputBatchPbo(
69
73
  item_container=StepItemContainerPbo(
70
74
  content_type=ContentTypePbo(name=self.content_type, extensions=self.file_extensions),
75
+ container_name=self.name,
71
76
  binary_container=StepBinaryContainerPbo(items=self.binary_data)
72
77
  )
73
78
  )
@@ -80,21 +85,26 @@ class CsvResult(SapioToolResult):
80
85
  csv_data: list[dict[str, Any]]
81
86
  content_type: str
82
87
  file_extensions: list[str]
88
+ name: str
83
89
 
84
- def __init__(self, csv_data: list[dict[str, Any]], content_type: str = "csv", file_extensions: list[str] = None):
90
+ def __init__(self, csv_data: list[dict[str, Any]], content_type: str = "csv", file_extensions: list[str] = None,
91
+ name: str | None = None):
85
92
  """
86
93
  :param csv_data: The list of CSV data results, provided as a list of dictionaries of column name to value.
87
94
  :param content_type: The content type of the data.
88
95
  :param file_extensions: A list of file extensions that this binary data can be saved as.
96
+ :param name: An optional identifying name for this result that will be accessible to the next tool.
89
97
  """
90
98
  self.csv_data = csv_data
91
99
  self.content_type = content_type
92
100
  self.file_extensions = file_extensions if file_extensions else ["csv"]
101
+ self.name = name
93
102
 
94
103
  def to_proto(self) -> StepOutputBatchPbo | list[FieldValueMapPbo]:
95
104
  return StepOutputBatchPbo(
96
105
  item_container=StepItemContainerPbo(
97
106
  content_type=ContentTypePbo(name=self.content_type, extensions=self.file_extensions),
107
+ container_name=self.name,
98
108
  csv_container=StepCsvContainerPbo(
99
109
  header=StepCsvHeaderRowPbo(cells=self.csv_data[0].keys()),
100
110
  items=[StepCsvRowPbo(cells=[str(x) for x in row.values()]) for row in self.csv_data]
@@ -143,22 +153,27 @@ class JsonResult(SapioToolResult):
143
153
  json_data: list[Any]
144
154
  content_type: str
145
155
  file_extensions: list[str]
156
+ name: str
146
157
 
147
- def __init__(self, json_data: list[Any], content_type: str = "json", file_extensions: list[str] = None):
158
+ def __init__(self, json_data: list[Any], content_type: str = "json", file_extensions: list[str] = None,
159
+ name: str | None = None):
148
160
  """
149
161
  :param json_data: The list of JSON data results. Each entry in the list represents a separate JSON object.
150
162
  These entries must be able to be serialized to JSON using json.dumps().
151
163
  :param content_type: The content type of the data.
152
164
  :param file_extensions: A list of file extensions that this binary data can be saved as.
165
+ :param name: An optional identifying name for this result that will be accessible to the next tool.
153
166
  """
154
167
  self.json_data = json_data
155
168
  self.content_type = content_type
156
169
  self.file_extensions = file_extensions if file_extensions else ["json"]
170
+ self.name = name
157
171
 
158
172
  def to_proto(self) -> StepOutputBatchPbo | list[FieldValueMapPbo]:
159
173
  return StepOutputBatchPbo(
160
174
  item_container=StepItemContainerPbo(
161
175
  content_type=ContentTypePbo(name=self.content_type, extensions=self.file_extensions),
176
+ container_name=self.name,
162
177
  json_container=StepJsonContainerPbo(items=[json.dumps(x) for x in self.json_data])
163
178
  )
164
179
  )
@@ -171,21 +186,26 @@ class TextResult(SapioToolResult):
171
186
  text_data: list[str]
172
187
  content_type: str
173
188
  file_extensions: list[str]
189
+ name: str
174
190
 
175
- def __init__(self, text_data: list[str], content_type: str = "text", file_extensions: list[str] = None):
191
+ def __init__(self, text_data: list[str], content_type: str = "text", file_extensions: list[str] = None,
192
+ name: str | None = None):
176
193
  """
177
194
  :param text_data: The text data as a list of strings.
178
195
  :param content_type: The content type of the data.
179
196
  :param file_extensions: A list of file extensions that this binary data can be saved as.
197
+ :param name: An optional identifying name for this result that will be accessible to the next tool.
180
198
  """
181
199
  self.text_data = text_data
182
200
  self.content_type = content_type
183
201
  self.file_extensions = file_extensions if file_extensions else ["txt"]
202
+ self.name = name
184
203
 
185
204
  def to_proto(self) -> StepOutputBatchPbo | list[FieldValueMapPbo]:
186
205
  return StepOutputBatchPbo(
187
206
  item_container=StepItemContainerPbo(
188
207
  content_type=ContentTypePbo(name=self.content_type, extensions=self.file_extensions),
208
+ container_name=self.name,
189
209
  text_container=StepTextContainerPbo(items=self.text_data)
190
210
  )
191
211
  )
@@ -817,6 +837,15 @@ class ToolBase(ABC):
817
837
  self.logs.append(f"EXCEPTION: {self._name}: {message} - {e}")
818
838
  self.logger.error(f"{message}\n{traceback.format_exc()}")
819
839
 
840
+ def get_input_name(self, index: int = 0) -> str | None:
841
+ """
842
+ Get the name of the input from the request object.
843
+
844
+ :param index: The index of the input to parse. Defaults to 0. Used for tools that accept multiple inputs.
845
+ :return: The name of the input from the request object, or None if no name is set.
846
+ """
847
+ return self.request.input[index].item_container.container_name
848
+
820
849
  def get_input_binary(self, index: int = 0) -> list[bytes]:
821
850
  """
822
851
  Get the binary data from the request object.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: sapiopycommons
3
- Version: 2025.8.22a715
3
+ Version: 2025.8.29a719
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>
@@ -4,7 +4,7 @@ sapiopycommons/ai/converter_service_base.py,sha256=A9DkouIT2S-SgcsphEuCpA0Jr6Yjx
4
4
  sapiopycommons/ai/protobuf_utils.py,sha256=cBjbxoFAwU02kNUxEce95WnMU2CMuDD-qFaeWgvQJMQ,24599
5
5
  sapiopycommons/ai/server.py,sha256=w70KUENxrYoMyDRFunCAlxhhwXXWBNngCwG40Po7vTU,4212
6
6
  sapiopycommons/ai/test_client.py,sha256=iPhn7cvKNLmDAXrjpmIkZpW2pDWlUhJZHDLHJbEoWsg,15673
7
- sapiopycommons/ai/tool_service_base.py,sha256=oXxhhxeKiEq3QtlJEjsWnO8wrUPruz5M2Ti3ipyBf4E,43991
7
+ sapiopycommons/ai/tool_service_base.py,sha256=Cj4ewRfBSiW1Tdzn4hkm9P-gDa6NS6fh4jc4TUmvNMs,45336
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
10
10
  sapiopycommons/ai/protoapi/fielddefinitions/fields_pb2_grpc.py,sha256=uO25bcnfGqXpP4ggUur54Nr73Wj-DGWftExzLNcxdHI,931
@@ -20,8 +20,8 @@ sapiopycommons/ai/protoapi/plan/step_pb2_grpc.py,sha256=1CBna5NBBxPwQhrkN8-Fim_j
20
20
  sapiopycommons/ai/protoapi/plan/converter/converter_pb2.py,sha256=rZYBRfR0umwDYvBdYnzxR1VZSutRqunhd3QsdtQXiCM,3593
21
21
  sapiopycommons/ai/protoapi/plan/converter/converter_pb2.pyi,sha256=_35yHfKTJH3SMdA5_c6qF6OZG6UwFWXpNh6dwRFDKkk,4250
22
22
  sapiopycommons/ai/protoapi/plan/converter/converter_pb2_grpc.py,sha256=6T5FCmT_vEFSywUVlAlWWfBDPaILb0Dq8yCGuO_Q-BU,6448
23
- sapiopycommons/ai/protoapi/plan/item/item_container_pb2.py,sha256=oAMgQ2R5iYjjPPfR_npySS2P0H9zB1mj-Unb0hhXNbE,3816
24
- sapiopycommons/ai/protoapi/plan/item/item_container_pb2.pyi,sha256=K8Y0dvNY7V0MLOegC1ODXqc1g4lH1NY70EGH2UWN9vQ,4118
23
+ sapiopycommons/ai/protoapi/plan/item/item_container_pb2.py,sha256=VIXmIw8-9jtH7peJZ16BEmGDfaVjjxTKhmlfcHWT82M,3863
24
+ sapiopycommons/ai/protoapi/plan/item/item_container_pb2.pyi,sha256=bbPNQDwfFDd7_S7yU99Co1O7sRhxjle-RM0_nK8jgjc,4246
25
25
  sapiopycommons/ai/protoapi/plan/item/item_container_pb2_grpc.py,sha256=1NzBWBUINC0Rk-NGYZ-97BVKvVUxcn_I44IjQO2h-nQ,932
26
26
  sapiopycommons/ai/protoapi/plan/script/script_pb2.py,sha256=swyahlxM7fKm-RqtgMd1Czqd1JrbXRw3sYqFTkjbbyM,5144
27
27
  sapiopycommons/ai/protoapi/plan/script/script_pb2.pyi,sha256=GqlqLf9UX_B5vCR9cm-VoYLHFJNmZjJafcPJ6EDa8Qw,6192
@@ -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.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,,
101
+ sapiopycommons-2025.8.29a719.dist-info/METADATA,sha256=t5N5pSwIbvZeE-6QXT-ocrcF60BM31hV5nZskKiD79g,3143
102
+ sapiopycommons-2025.8.29a719.dist-info/WHEEL,sha256=C2FUgwZgiLbznR-k0b_5k3Ai_1aASOXDss3lzCUsUug,87
103
+ sapiopycommons-2025.8.29a719.dist-info/licenses/LICENSE,sha256=HyVuytGSiAUQ6ErWBHTqt1iSGHhLmlC8fO7jTCuR8dU,16725
104
+ sapiopycommons-2025.8.29a719.dist-info/RECORD,,