sapiopycommons 2025.9.9a738__py3-none-any.whl → 2025.9.10a743__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/tool_service_base.py +19 -7
- {sapiopycommons-2025.9.9a738.dist-info → sapiopycommons-2025.9.10a743.dist-info}/METADATA +1 -1
- {sapiopycommons-2025.9.9a738.dist-info → sapiopycommons-2025.9.10a743.dist-info}/RECORD +5 -5
- {sapiopycommons-2025.9.9a738.dist-info → sapiopycommons-2025.9.10a743.dist-info}/WHEEL +0 -0
- {sapiopycommons-2025.9.9a738.dist-info → sapiopycommons-2025.9.10a743.dist-info}/licenses/LICENSE +0 -0
|
@@ -12,11 +12,12 @@ from typing import Any, Iterable, Mapping
|
|
|
12
12
|
|
|
13
13
|
from grpc import ServicerContext
|
|
14
14
|
from sapiopylib.rest.User import SapioUser, ensure_logger_initialized
|
|
15
|
-
from sapiopylib.rest.pojo.datatype.FieldDefinition import AbstractVeloxFieldDefinition
|
|
15
|
+
from sapiopylib.rest.pojo.datatype.FieldDefinition import AbstractVeloxFieldDefinition, FieldValidator
|
|
16
16
|
|
|
17
17
|
from sapiopycommons.ai.protoapi.fielddefinitions.fields_pb2 import FieldValueMapPbo, FieldValuePbo
|
|
18
18
|
from sapiopycommons.ai.protoapi.fielddefinitions.velox_field_def_pb2 import VeloxFieldDefPbo, FieldTypePbo, \
|
|
19
|
-
SelectionPropertiesPbo, IntegerPropertiesPbo, DoublePropertiesPbo, BooleanPropertiesPbo, StringPropertiesPbo
|
|
19
|
+
SelectionPropertiesPbo, IntegerPropertiesPbo, DoublePropertiesPbo, BooleanPropertiesPbo, StringPropertiesPbo, \
|
|
20
|
+
FieldValidatorPbo
|
|
20
21
|
from sapiopycommons.ai.protoapi.plan.item.item_container_pb2 import ContentTypePbo
|
|
21
22
|
from sapiopycommons.ai.protoapi.plan.tool.entry_pb2 import StepOutputBatchPbo, StepItemContainerPbo, \
|
|
22
23
|
StepBinaryContainerPbo, StepCsvContainerPbo, StepCsvHeaderRowPbo, StepCsvRowPbo, StepJsonContainerPbo, \
|
|
@@ -637,8 +638,8 @@ class ToolBase(ABC):
|
|
|
637
638
|
))
|
|
638
639
|
|
|
639
640
|
def add_string_config_field(self, field_name: str, display_name: str, description: str,
|
|
640
|
-
default_value: str | None = None, max_length: int = 1000, optional: bool = False
|
|
641
|
-
|
|
641
|
+
default_value: str | None = None, max_length: int = 1000, optional: bool = False,
|
|
642
|
+
validation_regex: str | None = None, error_msg: str | None = None) -> None:
|
|
642
643
|
"""
|
|
643
644
|
Add a string configuration field to the tool. This field will be used to configure the tool in the plan
|
|
644
645
|
manager.
|
|
@@ -649,6 +650,8 @@ class ToolBase(ABC):
|
|
|
649
650
|
:param default_value: The default value of the field.
|
|
650
651
|
:param max_length: The maximum length of the field.
|
|
651
652
|
:param optional: If true, this field is optional. If false, this field is required.
|
|
653
|
+
:param validation_regex: An optional regex that the field value must match.
|
|
654
|
+
:param error_msg: An optional error message to display if the field value does not match the regex.
|
|
652
655
|
"""
|
|
653
656
|
self.config_fields.append(VeloxFieldDefPbo(
|
|
654
657
|
data_field_type=FieldTypePbo.STRING,
|
|
@@ -659,13 +662,15 @@ class ToolBase(ABC):
|
|
|
659
662
|
editable=True,
|
|
660
663
|
string_properties=StringPropertiesPbo(
|
|
661
664
|
default_value=default_value,
|
|
662
|
-
max_length=max_length
|
|
665
|
+
max_length=max_length,
|
|
666
|
+
field_validator=FieldValidatorPbo(validation_regex, error_msg) if validation_regex else None
|
|
663
667
|
)
|
|
664
668
|
))
|
|
665
669
|
|
|
666
670
|
def add_list_config_field(self, field_name: str, display_name: str, description: str,
|
|
667
671
|
default_value: str | None = None, allowed_values: list[str] | None = None,
|
|
668
|
-
direct_edit: bool = False, optional: bool = False
|
|
672
|
+
direct_edit: bool = False, optional: bool = False,
|
|
673
|
+
validation_regex: str | None = None, error_msg: str | None = None) -> None:
|
|
669
674
|
"""
|
|
670
675
|
Add a list configuration field to the tool. This field will be used to configure the tool in the plan
|
|
671
676
|
manager.
|
|
@@ -678,6 +683,8 @@ class ToolBase(ABC):
|
|
|
678
683
|
:param direct_edit: If true, the user can enter a value that is not in the list of allowed values. If false,
|
|
679
684
|
the user can only select from the list of allowed values.
|
|
680
685
|
:param optional: If true, this field is optional. If false, this field is required.
|
|
686
|
+
:param validation_regex: An optional regex that the field value must match.
|
|
687
|
+
:param error_msg: An optional error message to display if the field value does not match the regex.
|
|
681
688
|
"""
|
|
682
689
|
self.config_fields.append(VeloxFieldDefPbo(
|
|
683
690
|
data_field_type=FieldTypePbo.SELECTION,
|
|
@@ -690,12 +697,14 @@ class ToolBase(ABC):
|
|
|
690
697
|
default_value=default_value,
|
|
691
698
|
static_list_values=allowed_values,
|
|
692
699
|
direct_edit=direct_edit,
|
|
700
|
+
field_validator=FieldValidatorPbo(validation_regex, error_msg) if validation_regex else None
|
|
693
701
|
)
|
|
694
702
|
))
|
|
695
703
|
|
|
696
704
|
def add_multi_list_config_field(self, field_name: str, display_name: str, description: str,
|
|
697
705
|
default_value: list[str] | None = None, allowed_values: list[str] | None = None,
|
|
698
|
-
direct_edit: bool = False, optional: bool = False
|
|
706
|
+
direct_edit: bool = False, optional: bool = False,
|
|
707
|
+
validation_regex: str | None = None, error_msg: str | None = None) -> None:
|
|
699
708
|
"""
|
|
700
709
|
Add a multi-select list configuration field to the tool. This field will be used to configure the tool in the
|
|
701
710
|
plan manager.
|
|
@@ -708,6 +717,8 @@ class ToolBase(ABC):
|
|
|
708
717
|
:param direct_edit: If true, the user can enter a value that is not in the list of allowed values. If false,
|
|
709
718
|
the user can only select from the list of allowed values.
|
|
710
719
|
:param optional: If true, this field is optional. If false, this field is required.
|
|
720
|
+
:param validation_regex: An optional regex that the field value must match.
|
|
721
|
+
:param error_msg: An optional error message to display if the field value does not match the regex.
|
|
711
722
|
"""
|
|
712
723
|
self.config_fields.append(VeloxFieldDefPbo(
|
|
713
724
|
data_field_type=FieldTypePbo.SELECTION,
|
|
@@ -721,6 +732,7 @@ class ToolBase(ABC):
|
|
|
721
732
|
static_list_values=allowed_values,
|
|
722
733
|
multi_select=True,
|
|
723
734
|
direct_edit=direct_edit,
|
|
735
|
+
field_validator=FieldValidatorPbo(validation_regex, error_msg) if validation_regex else None
|
|
724
736
|
)
|
|
725
737
|
))
|
|
726
738
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: sapiopycommons
|
|
3
|
-
Version: 2025.9.
|
|
3
|
+
Version: 2025.9.10a743
|
|
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=TMSyEekbbqMk9dRuAtLlSJ1sA1H8K
|
|
|
4
4
|
sapiopycommons/ai/protobuf_utils.py,sha256=cBjbxoFAwU02kNUxEce95WnMU2CMuDD-qFaeWgvQJMQ,24599
|
|
5
5
|
sapiopycommons/ai/server.py,sha256=XDm_mj1yWHw-xQRFsFRHnsGw2JU0wsW2mR22P8PB09A,5744
|
|
6
6
|
sapiopycommons/ai/test_client.py,sha256=-kMXXU_f5FAB7n4UX66NT8I8G52M0eZjn-hpESN_io8,16330
|
|
7
|
-
sapiopycommons/ai/tool_service_base.py,sha256=
|
|
7
|
+
sapiopycommons/ai/tool_service_base.py,sha256=9YI2MzjXIHmzhCsB-VIUOI3Gad0HNG26KxSUwmM01cs,49851
|
|
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
|
|
@@ -99,7 +99,7 @@ sapiopycommons/webhook/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3
|
|
|
99
99
|
sapiopycommons/webhook/webhook_context.py,sha256=D793uLsb1691SalaPnBUk3rOSxn_hYLhdvkaIxjNXss,1909
|
|
100
100
|
sapiopycommons/webhook/webhook_handlers.py,sha256=7o_wXOruhT9auNh8OfhJAh4WhhiPKij67FMBSpGPICc,39939
|
|
101
101
|
sapiopycommons/webhook/webservice_handlers.py,sha256=cvW6Mk_110BzYqkbk63Kg7jWrltBCDALOlkJRu8h4VQ,14300
|
|
102
|
-
sapiopycommons-2025.9.
|
|
103
|
-
sapiopycommons-2025.9.
|
|
104
|
-
sapiopycommons-2025.9.
|
|
105
|
-
sapiopycommons-2025.9.
|
|
102
|
+
sapiopycommons-2025.9.10a743.dist-info/METADATA,sha256=InFBl-Vd6Qxi0CC0H5T3Q-Jw1L8V6lF7Ioai5f4fXEs,3143
|
|
103
|
+
sapiopycommons-2025.9.10a743.dist-info/WHEEL,sha256=C2FUgwZgiLbznR-k0b_5k3Ai_1aASOXDss3lzCUsUug,87
|
|
104
|
+
sapiopycommons-2025.9.10a743.dist-info/licenses/LICENSE,sha256=HyVuytGSiAUQ6ErWBHTqt1iSGHhLmlC8fO7jTCuR8dU,16725
|
|
105
|
+
sapiopycommons-2025.9.10a743.dist-info/RECORD,,
|
|
File without changes
|
{sapiopycommons-2025.9.9a738.dist-info → sapiopycommons-2025.9.10a743.dist-info}/licenses/LICENSE
RENAMED
|
File without changes
|