sapiopycommons 2025.10.15a782__py3-none-any.whl → 2025.10.16a785__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/agent_service_base.py +79 -1
- {sapiopycommons-2025.10.15a782.dist-info → sapiopycommons-2025.10.16a785.dist-info}/METADATA +1 -1
- {sapiopycommons-2025.10.15a782.dist-info → sapiopycommons-2025.10.16a785.dist-info}/RECORD +5 -5
- {sapiopycommons-2025.10.15a782.dist-info → sapiopycommons-2025.10.16a785.dist-info}/WHEEL +0 -0
- {sapiopycommons-2025.10.15a782.dist-info → sapiopycommons-2025.10.16a785.dist-info}/licenses/LICENSE +0 -0
|
@@ -22,7 +22,7 @@ from sapiopycommons.ai.protoapi.externalcredentials.external_credentials_pb2 imp
|
|
|
22
22
|
from sapiopycommons.ai.protoapi.fielddefinitions.fields_pb2 import FieldValueMapPbo, FieldValuePbo
|
|
23
23
|
from sapiopycommons.ai.protoapi.fielddefinitions.velox_field_def_pb2 import VeloxFieldDefPbo, FieldTypePbo, \
|
|
24
24
|
SelectionPropertiesPbo, IntegerPropertiesPbo, DoublePropertiesPbo, BooleanPropertiesPbo, StringPropertiesPbo, \
|
|
25
|
-
FieldValidatorPbo
|
|
25
|
+
FieldValidatorPbo, DatePropertiesPbo
|
|
26
26
|
from sapiopycommons.ai.protoapi.plan.item.item_container_pb2 import ContentTypePbo
|
|
27
27
|
from sapiopycommons.ai.protoapi.plan.tool.entry_pb2 import StepOutputBatchPbo, StepItemContainerPbo, \
|
|
28
28
|
StepBinaryContainerPbo, StepCsvContainerPbo, StepCsvHeaderRowPbo, StepCsvRowPbo, StepJsonContainerPbo, \
|
|
@@ -782,6 +782,67 @@ class AgentBase(ABC):
|
|
|
782
782
|
)
|
|
783
783
|
))
|
|
784
784
|
|
|
785
|
+
def add_date_config_field(self, field_name: str, display_name: str, description: str, optional: bool = False,
|
|
786
|
+
date_time_format: str = "MMM dd, yyyy", default_to_today: bool = False,
|
|
787
|
+
is_static_date: bool = False) -> None:
|
|
788
|
+
"""
|
|
789
|
+
Add a date configuration field to the agent. This field will be used to configure the agent in the plan
|
|
790
|
+
manager.
|
|
791
|
+
|
|
792
|
+
:param field_name: The name of the field.
|
|
793
|
+
:param display_name: The display name of the field.
|
|
794
|
+
:param description: The description of the field.
|
|
795
|
+
:param date_time_format: The format that this date field should appear in. The date format is Java-style.
|
|
796
|
+
See https://docs.oracle.com/en/java/javase/18/docs/api/java.base/java/text/SimpleDateFormat.html for more
|
|
797
|
+
details.
|
|
798
|
+
:param default_to_today: If true, the default value of the field will be set to today's date. If false, the
|
|
799
|
+
default value will be None.
|
|
800
|
+
:param is_static_date: If true, the user will input the date as UTC. If false, the user will input the date
|
|
801
|
+
as local time.
|
|
802
|
+
:param optional: If true, this field is optional. If false, this field is required.
|
|
803
|
+
"""
|
|
804
|
+
self.config_fields.append(VeloxFieldDefPbo(
|
|
805
|
+
data_field_type=FieldTypePbo.DATE,
|
|
806
|
+
data_field_name=field_name,
|
|
807
|
+
display_name=display_name,
|
|
808
|
+
description=description,
|
|
809
|
+
required=not optional,
|
|
810
|
+
editable=True,
|
|
811
|
+
date_properties=DatePropertiesPbo(
|
|
812
|
+
default_value="@Today" if default_to_today else None,
|
|
813
|
+
static_date=is_static_date,
|
|
814
|
+
date_time_format=date_time_format
|
|
815
|
+
)
|
|
816
|
+
))
|
|
817
|
+
|
|
818
|
+
def add_credentials_config_field(self, field_name: str, display_name: str, description: str, optional: bool = False,
|
|
819
|
+
category: str | None = None) -> None:
|
|
820
|
+
"""
|
|
821
|
+
Add a list field that asks the user to choose which credentials to use. This field will be used to
|
|
822
|
+
configure the agent in the plan manager.
|
|
823
|
+
|
|
824
|
+
:param field_name: The name of the field.
|
|
825
|
+
:param display_name: The display name of the field.
|
|
826
|
+
:param description: The description of the field.
|
|
827
|
+
:param optional: If true, this field is optional. If false, this field is required.
|
|
828
|
+
:param category: If provided, only credentials in this category will be shown to the user.
|
|
829
|
+
"""
|
|
830
|
+
self.config_fields.append(VeloxFieldDefPbo(
|
|
831
|
+
data_field_type=FieldTypePbo.SELECTION,
|
|
832
|
+
data_field_name=field_name,
|
|
833
|
+
display_name=display_name,
|
|
834
|
+
description=description,
|
|
835
|
+
required=not optional,
|
|
836
|
+
editable=True,
|
|
837
|
+
selection_properties=SelectionPropertiesPbo(
|
|
838
|
+
# A credentials field is just a selection field with its list mode set to [ExternalCredentials].
|
|
839
|
+
list_mode=f"[ExternalCredentials]{category.strip() if category else ''}",
|
|
840
|
+
multi_select=False,
|
|
841
|
+
default_value=None,
|
|
842
|
+
direct_edit=False
|
|
843
|
+
)
|
|
844
|
+
))
|
|
845
|
+
|
|
785
846
|
def to_pbo(self) -> ToolDetailsPbo:
|
|
786
847
|
"""
|
|
787
848
|
:return: The ToolDetailsPbo proto object representing this agent.
|
|
@@ -910,6 +971,23 @@ class AgentBase(ABC):
|
|
|
910
971
|
|
|
911
972
|
return ExternalCredentials.from_pbo(matching_creds[0])
|
|
912
973
|
|
|
974
|
+
def get_credentials_from_config(self, value: str) -> ExternalCredentials:
|
|
975
|
+
"""
|
|
976
|
+
Get credentials given the value of a credentials config field.
|
|
977
|
+
|
|
978
|
+
:param value: The value of the credentials config field.
|
|
979
|
+
:return: An ExternalCredentials object containing the credentials.
|
|
980
|
+
"""
|
|
981
|
+
# Values should be of the format "Name (Identifier)"
|
|
982
|
+
match = re.match(r"^(.*) \((.*)\)$", value)
|
|
983
|
+
if not match:
|
|
984
|
+
raise ValueError(f"Invalid credentials value '{value}'. Expected format 'Name (Identifier)'.")
|
|
985
|
+
identifier: str = match.group(2)
|
|
986
|
+
for cred in self.request.external_credential:
|
|
987
|
+
if cred.id == identifier:
|
|
988
|
+
return ExternalCredentials.from_pbo(cred)
|
|
989
|
+
raise ValueError(f"No credentials found with identifier '{identifier}'.")
|
|
990
|
+
|
|
913
991
|
def call_subprocess(self,
|
|
914
992
|
args: str | bytes | PathLike[str] | PathLike[bytes] | Sequence[str | bytes | PathLike[str] | PathLike[bytes]],
|
|
915
993
|
cwd: str | bytes | PathLike[str] | PathLike[bytes] | None = None,
|
{sapiopycommons-2025.10.15a782.dist-info → sapiopycommons-2025.10.16a785.dist-info}/METADATA
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: sapiopycommons
|
|
3
|
-
Version: 2025.10.
|
|
3
|
+
Version: 2025.10.16a785
|
|
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>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
sapiopycommons/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
2
|
sapiopycommons/ai/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
3
|
-
sapiopycommons/ai/agent_service_base.py,sha256=
|
|
3
|
+
sapiopycommons/ai/agent_service_base.py,sha256=eTJunFQoxLc0risWiQIkQK946XpHzSFO38NzzRvOn9Q,60325
|
|
4
4
|
sapiopycommons/ai/converter_service_base.py,sha256=HiUXmwqv1STgyQeF9_eTFXzjIFXp5-NJ7sEhMpV3aAU,6351
|
|
5
5
|
sapiopycommons/ai/external_credentials.py,sha256=ki_xIH4J843b_sSwEa8YHr8vW9erVv-jowZJXSgPQs8,4347
|
|
6
6
|
sapiopycommons/ai/protobuf_utils.py,sha256=cBjbxoFAwU02kNUxEce95WnMU2CMuDD-qFaeWgvQJMQ,24599
|
|
@@ -106,7 +106,7 @@ sapiopycommons/webhook/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3
|
|
|
106
106
|
sapiopycommons/webhook/webhook_context.py,sha256=D793uLsb1691SalaPnBUk3rOSxn_hYLhdvkaIxjNXss,1909
|
|
107
107
|
sapiopycommons/webhook/webhook_handlers.py,sha256=7o_wXOruhT9auNh8OfhJAh4WhhiPKij67FMBSpGPICc,39939
|
|
108
108
|
sapiopycommons/webhook/webservice_handlers.py,sha256=cvW6Mk_110BzYqkbk63Kg7jWrltBCDALOlkJRu8h4VQ,14300
|
|
109
|
-
sapiopycommons-2025.10.
|
|
110
|
-
sapiopycommons-2025.10.
|
|
111
|
-
sapiopycommons-2025.10.
|
|
112
|
-
sapiopycommons-2025.10.
|
|
109
|
+
sapiopycommons-2025.10.16a785.dist-info/METADATA,sha256=2yQ4MjvJOysrdpojvELXBXHk9Pk_hDU7D1cl3k6zHKQ,3143
|
|
110
|
+
sapiopycommons-2025.10.16a785.dist-info/WHEEL,sha256=C2FUgwZgiLbznR-k0b_5k3Ai_1aASOXDss3lzCUsUug,87
|
|
111
|
+
sapiopycommons-2025.10.16a785.dist-info/licenses/LICENSE,sha256=HyVuytGSiAUQ6ErWBHTqt1iSGHhLmlC8fO7jTCuR8dU,16725
|
|
112
|
+
sapiopycommons-2025.10.16a785.dist-info/RECORD,,
|
|
File without changes
|
{sapiopycommons-2025.10.15a782.dist-info → sapiopycommons-2025.10.16a785.dist-info}/licenses/LICENSE
RENAMED
|
File without changes
|