sapiopycommons 2025.7.23a659__py3-none-any.whl → 2025.7.30a660__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/protobuf_utils.py +0 -2
- sapiopycommons/ai/test_client.py +1 -2
- sapiopycommons/ai/tool_service_base.py +17 -9
- {sapiopycommons-2025.7.23a659.dist-info → sapiopycommons-2025.7.30a660.dist-info}/METADATA +1 -1
- {sapiopycommons-2025.7.23a659.dist-info → sapiopycommons-2025.7.30a660.dist-info}/RECORD +7 -7
- {sapiopycommons-2025.7.23a659.dist-info → sapiopycommons-2025.7.30a660.dist-info}/WHEEL +0 -0
- {sapiopycommons-2025.7.23a659.dist-info → sapiopycommons-2025.7.30a660.dist-info}/licenses/LICENSE +0 -0
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
from typing import Any
|
|
2
|
-
|
|
3
1
|
from sapiopylib.rest.pojo.Sort import SortDirection
|
|
4
2
|
from sapiopylib.rest.pojo.datatype.FieldDefinition import AbstractVeloxFieldDefinition, FieldType, \
|
|
5
3
|
VeloxBooleanFieldDefinition, VeloxDateFieldDefinition, VeloxAccessionFieldDefinition, VeloxActionFieldDefinition, \
|
sapiopycommons/ai/test_client.py
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import base64
|
|
2
2
|
import json
|
|
3
|
-
from typing import
|
|
3
|
+
from typing import Any
|
|
4
4
|
|
|
5
5
|
import grpc
|
|
6
6
|
from sapiopylib.rest.User import SapioUser
|
|
7
7
|
|
|
8
|
-
from sapiopycommons.ai.api.fielddefinitions.proto.fields_pb2 import FieldValuePbo
|
|
9
8
|
from sapiopycommons.ai.api.plan.tool.proto.entry_pb2 import DataTypePbo, StepBinaryContainerPbo, StepCsvRowPbo, \
|
|
10
9
|
StepCsvHeaderRowPbo, StepCsvContainerPbo, StepJsonContainerPbo, StepImageContainerPbo, StepTextContainerPbo, \
|
|
11
10
|
StepItemContainerPbo, StepInputBatchPbo
|
|
@@ -289,14 +289,18 @@ class ToolServiceBase(ToolServiceServicer, ABC):
|
|
|
289
289
|
generated by the tool.
|
|
290
290
|
"""
|
|
291
291
|
# Locate the tool named in the request.
|
|
292
|
-
|
|
293
|
-
for t in self.register_tools()
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
292
|
+
find_tool: str = request.tool_name
|
|
293
|
+
registered_tools: dict[str, type[ToolBase]] = {t.name(): t for t in self.register_tools()}
|
|
294
|
+
if find_tool not in registered_tools:
|
|
295
|
+
# If the tool is not found, list all of the registered tools for this service so that the LLM can correct
|
|
296
|
+
# the tool it is requesting.
|
|
297
|
+
all_tool_names: str = "\n".join(registered_tools.keys())
|
|
298
|
+
msg: str = (f"Tool \"{find_tool}\" not found in the registered tools for this service. The registered tools "
|
|
299
|
+
f"for this service are: \n{all_tool_names}")
|
|
300
|
+
return False, msg, [], []
|
|
301
|
+
|
|
302
|
+
# Instantiate the tool class.
|
|
303
|
+
tool: ToolBase = registered_tools[find_tool]()
|
|
300
304
|
try:
|
|
301
305
|
# Setup the tool with details from the request.
|
|
302
306
|
tool.setup(user, request, context)
|
|
@@ -893,7 +897,11 @@ class ToolBase(ABC):
|
|
|
893
897
|
if field_name not in raw_configs:
|
|
894
898
|
config_fields[field_name] = ProtobufUtils.field_def_pbo_to_default_value(field_def)
|
|
895
899
|
else:
|
|
896
|
-
|
|
900
|
+
field_value: Any = ProtobufUtils.field_pbo_to_value(raw_configs[field_name])
|
|
901
|
+
if field_value is not None:
|
|
902
|
+
config_fields[field_name] = field_value
|
|
903
|
+
else:
|
|
904
|
+
config_fields[field_name] = ProtobufUtils.field_def_pbo_to_default_value(field_def)
|
|
897
905
|
return config_fields
|
|
898
906
|
|
|
899
907
|
@staticmethod
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: sapiopycommons
|
|
3
|
-
Version: 2025.7.
|
|
3
|
+
Version: 2025.7.30a660
|
|
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,8 +1,8 @@
|
|
|
1
1
|
sapiopycommons/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
2
|
sapiopycommons/ai/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
3
|
-
sapiopycommons/ai/protobuf_utils.py,sha256=
|
|
4
|
-
sapiopycommons/ai/test_client.py,sha256=
|
|
5
|
-
sapiopycommons/ai/tool_service_base.py,sha256=
|
|
3
|
+
sapiopycommons/ai/protobuf_utils.py,sha256=yJkKolSfH2a-zk1k7juGh9-xQz6mmsoaJtM91meQIgk,24645
|
|
4
|
+
sapiopycommons/ai/test_client.py,sha256=TBlXeWVAx2OUtCZNry8dNjY9I3NOkySYj_QdQd7xx1A,12050
|
|
5
|
+
sapiopycommons/ai/tool_service_base.py,sha256=n_8UiLD6vuvkobJAHEGybvq5AY-itFCN1IjTiuyjmrU,42584
|
|
6
6
|
sapiopycommons/ai/api/fielddefinitions/proto/fields_pb2.py,sha256=YcZjb_YM-XeLErM8hEC_S7vGMVGvcXAMGs2b-u5zvOE,2377
|
|
7
7
|
sapiopycommons/ai/api/fielddefinitions/proto/fields_pb2.pyi,sha256=FwtXmNAf7iYGEFm4kbqb04v77jNHbZg18ZmEDhle_bU,1444
|
|
8
8
|
sapiopycommons/ai/api/fielddefinitions/proto/fields_pb2_grpc.py,sha256=wPImJPdCUZNVEVoUWzsba9kGIXjEKPdUkawP5SnVyiU,932
|
|
@@ -90,7 +90,7 @@ sapiopycommons/webhook/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3
|
|
|
90
90
|
sapiopycommons/webhook/webhook_context.py,sha256=D793uLsb1691SalaPnBUk3rOSxn_hYLhdvkaIxjNXss,1909
|
|
91
91
|
sapiopycommons/webhook/webhook_handlers.py,sha256=7o_wXOruhT9auNh8OfhJAh4WhhiPKij67FMBSpGPICc,39939
|
|
92
92
|
sapiopycommons/webhook/webservice_handlers.py,sha256=cvW6Mk_110BzYqkbk63Kg7jWrltBCDALOlkJRu8h4VQ,14300
|
|
93
|
-
sapiopycommons-2025.7.
|
|
94
|
-
sapiopycommons-2025.7.
|
|
95
|
-
sapiopycommons-2025.7.
|
|
96
|
-
sapiopycommons-2025.7.
|
|
93
|
+
sapiopycommons-2025.7.30a660.dist-info/METADATA,sha256=ARGB8aFkiawv1p5UphWDTJ-5xpFvVjZqoaGLe09mwgE,3143
|
|
94
|
+
sapiopycommons-2025.7.30a660.dist-info/WHEEL,sha256=C2FUgwZgiLbznR-k0b_5k3Ai_1aASOXDss3lzCUsUug,87
|
|
95
|
+
sapiopycommons-2025.7.30a660.dist-info/licenses/LICENSE,sha256=HyVuytGSiAUQ6ErWBHTqt1iSGHhLmlC8fO7jTCuR8dU,16725
|
|
96
|
+
sapiopycommons-2025.7.30a660.dist-info/RECORD,,
|
|
File without changes
|
{sapiopycommons-2025.7.23a659.dist-info → sapiopycommons-2025.7.30a660.dist-info}/licenses/LICENSE
RENAMED
|
File without changes
|