sapiopycommons 2025.8.15a704__py3-none-any.whl → 2025.8.15a706__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_of_tools.py +917 -0
- sapiopycommons/callbacks/callback_util.py +26 -16
- sapiopycommons/files/assay_plate_reader.py +93 -0
- sapiopycommons/files/file_text_converter.py +207 -0
- sapiopycommons/flowcyto/flow_cyto.py +2 -24
- sapiopycommons/general/accession_service.py +2 -28
- sapiopycommons/multimodal/multimodal.py +2 -24
- sapiopycommons/webhook/webservice_handlers.py +1 -1
- {sapiopycommons-2025.8.15a704.dist-info → sapiopycommons-2025.8.15a706.dist-info}/METADATA +2 -2
- {sapiopycommons-2025.8.15a704.dist-info → sapiopycommons-2025.8.15a706.dist-info}/RECORD +12 -43
- sapiopycommons/ai/api/fielddefinitions/proto/fields_pb2.py +0 -43
- sapiopycommons/ai/api/fielddefinitions/proto/fields_pb2.pyi +0 -31
- sapiopycommons/ai/api/fielddefinitions/proto/fields_pb2_grpc.py +0 -24
- sapiopycommons/ai/api/fielddefinitions/proto/velox_field_def_pb2.py +0 -123
- sapiopycommons/ai/api/fielddefinitions/proto/velox_field_def_pb2.pyi +0 -598
- sapiopycommons/ai/api/fielddefinitions/proto/velox_field_def_pb2_grpc.py +0 -24
- sapiopycommons/ai/api/plan/converter/proto/converter_pb2.py +0 -50
- sapiopycommons/ai/api/plan/converter/proto/converter_pb2.pyi +0 -61
- sapiopycommons/ai/api/plan/converter/proto/converter_pb2_grpc.py +0 -149
- sapiopycommons/ai/api/plan/item/proto/item_container_pb2.py +0 -55
- sapiopycommons/ai/api/plan/item/proto/item_container_pb2.pyi +0 -88
- sapiopycommons/ai/api/plan/item/proto/item_container_pb2_grpc.py +0 -24
- sapiopycommons/ai/api/plan/proto/step_output_pb2.py +0 -45
- sapiopycommons/ai/api/plan/proto/step_output_pb2.pyi +0 -42
- sapiopycommons/ai/api/plan/proto/step_output_pb2_grpc.py +0 -24
- sapiopycommons/ai/api/plan/proto/step_pb2.py +0 -43
- sapiopycommons/ai/api/plan/proto/step_pb2.pyi +0 -43
- sapiopycommons/ai/api/plan/proto/step_pb2_grpc.py +0 -24
- sapiopycommons/ai/api/plan/script/proto/script_pb2.py +0 -59
- sapiopycommons/ai/api/plan/script/proto/script_pb2.pyi +0 -102
- sapiopycommons/ai/api/plan/script/proto/script_pb2_grpc.py +0 -153
- sapiopycommons/ai/api/plan/tool/proto/entry_pb2.py +0 -41
- sapiopycommons/ai/api/plan/tool/proto/entry_pb2.pyi +0 -35
- sapiopycommons/ai/api/plan/tool/proto/entry_pb2_grpc.py +0 -24
- sapiopycommons/ai/api/plan/tool/proto/tool_pb2.py +0 -75
- sapiopycommons/ai/api/plan/tool/proto/tool_pb2.pyi +0 -237
- sapiopycommons/ai/api/plan/tool/proto/tool_pb2_grpc.py +0 -154
- sapiopycommons/ai/api/session/proto/sapio_conn_info_pb2.py +0 -39
- sapiopycommons/ai/api/session/proto/sapio_conn_info_pb2.pyi +0 -32
- sapiopycommons/ai/api/session/proto/sapio_conn_info_pb2_grpc.py +0 -24
- sapiopycommons/ai/converter_service_base.py +0 -116
- sapiopycommons/ai/protobuf_utils.py +0 -504
- sapiopycommons/ai/test_client.py +0 -334
- sapiopycommons/ai/tool_service_base.py +0 -917
- {sapiopycommons-2025.8.15a704.dist-info → sapiopycommons-2025.8.15a706.dist-info}/WHEEL +0 -0
- {sapiopycommons-2025.8.15a704.dist-info → sapiopycommons-2025.8.15a706.dist-info}/licenses/LICENSE +0 -0
|
@@ -1,237 +0,0 @@
|
|
|
1
|
-
from sapiopycommons.ai.api.fielddefinitions.proto import fields_pb2 as _fields_pb2
|
|
2
|
-
from sapiopycommons.ai.api.fielddefinitions.proto import velox_field_def_pb2 as _velox_field_def_pb2
|
|
3
|
-
from sapiopycommons.ai.api.plan.tool.proto import entry_pb2 as _entry_pb2
|
|
4
|
-
from sapiopycommons.ai.api.plan.item.proto import item_container_pb2 as _item_container_pb2
|
|
5
|
-
from sapiopycommons.ai.api.plan.proto import step_pb2 as _step_pb2
|
|
6
|
-
from sapiopycommons.ai.api.session.proto import sapio_conn_info_pb2 as _sapio_conn_info_pb2
|
|
7
|
-
from google.protobuf.internal import containers as _containers
|
|
8
|
-
from google.protobuf.internal import enum_type_wrapper as _enum_type_wrapper
|
|
9
|
-
from google.protobuf import descriptor as _descriptor
|
|
10
|
-
from google.protobuf import message as _message
|
|
11
|
-
from typing import ClassVar as _ClassVar, Iterable as _Iterable, Mapping as _Mapping, Optional as _Optional, Union as _Union
|
|
12
|
-
from sapiopycommons.ai.api.fielddefinitions.proto.fields_pb2 import FieldValuePbo as FieldValuePbo
|
|
13
|
-
from sapiopycommons.ai.api.fielddefinitions.proto.fields_pb2 import FieldValueMapPbo as FieldValueMapPbo
|
|
14
|
-
from sapiopycommons.ai.api.fielddefinitions.proto.velox_field_def_pb2 import FieldValidatorPbo as FieldValidatorPbo
|
|
15
|
-
from sapiopycommons.ai.api.fielddefinitions.proto.velox_field_def_pb2 import ColorRangePbo as ColorRangePbo
|
|
16
|
-
from sapiopycommons.ai.api.fielddefinitions.proto.velox_field_def_pb2 import BooleanDependentFieldEntryPbo as BooleanDependentFieldEntryPbo
|
|
17
|
-
from sapiopycommons.ai.api.fielddefinitions.proto.velox_field_def_pb2 import SelectionDependentFieldEntryPbo as SelectionDependentFieldEntryPbo
|
|
18
|
-
from sapiopycommons.ai.api.fielddefinitions.proto.velox_field_def_pb2 import EnumDependentFieldEntryPbo as EnumDependentFieldEntryPbo
|
|
19
|
-
from sapiopycommons.ai.api.fielddefinitions.proto.velox_field_def_pb2 import ProcessDetailEntryPbo as ProcessDetailEntryPbo
|
|
20
|
-
from sapiopycommons.ai.api.fielddefinitions.proto.velox_field_def_pb2 import BooleanPropertiesPbo as BooleanPropertiesPbo
|
|
21
|
-
from sapiopycommons.ai.api.fielddefinitions.proto.velox_field_def_pb2 import DatePropertiesPbo as DatePropertiesPbo
|
|
22
|
-
from sapiopycommons.ai.api.fielddefinitions.proto.velox_field_def_pb2 import DoublePropertiesPbo as DoublePropertiesPbo
|
|
23
|
-
from sapiopycommons.ai.api.fielddefinitions.proto.velox_field_def_pb2 import IntegerPropertiesPbo as IntegerPropertiesPbo
|
|
24
|
-
from sapiopycommons.ai.api.fielddefinitions.proto.velox_field_def_pb2 import LongPropertiesPbo as LongPropertiesPbo
|
|
25
|
-
from sapiopycommons.ai.api.fielddefinitions.proto.velox_field_def_pb2 import ShortPropertiesPbo as ShortPropertiesPbo
|
|
26
|
-
from sapiopycommons.ai.api.fielddefinitions.proto.velox_field_def_pb2 import SelectionPropertiesPbo as SelectionPropertiesPbo
|
|
27
|
-
from sapiopycommons.ai.api.fielddefinitions.proto.velox_field_def_pb2 import StringPropertiesPbo as StringPropertiesPbo
|
|
28
|
-
from sapiopycommons.ai.api.fielddefinitions.proto.velox_field_def_pb2 import SideLinkPropertiesPbo as SideLinkPropertiesPbo
|
|
29
|
-
from sapiopycommons.ai.api.fielddefinitions.proto.velox_field_def_pb2 import PickListPropertiesPbo as PickListPropertiesPbo
|
|
30
|
-
from sapiopycommons.ai.api.fielddefinitions.proto.velox_field_def_pb2 import ParentLinkPropertiesPbo as ParentLinkPropertiesPbo
|
|
31
|
-
from sapiopycommons.ai.api.fielddefinitions.proto.velox_field_def_pb2 import MultiParentPropertiesPbo as MultiParentPropertiesPbo
|
|
32
|
-
from sapiopycommons.ai.api.fielddefinitions.proto.velox_field_def_pb2 import IdentifierPropertiesPbo as IdentifierPropertiesPbo
|
|
33
|
-
from sapiopycommons.ai.api.fielddefinitions.proto.velox_field_def_pb2 import FileBlobPropertiesPbo as FileBlobPropertiesPbo
|
|
34
|
-
from sapiopycommons.ai.api.fielddefinitions.proto.velox_field_def_pb2 import EnumPropertiesPbo as EnumPropertiesPbo
|
|
35
|
-
from sapiopycommons.ai.api.fielddefinitions.proto.velox_field_def_pb2 import DateRangePropertiesPbo as DateRangePropertiesPbo
|
|
36
|
-
from sapiopycommons.ai.api.fielddefinitions.proto.velox_field_def_pb2 import ChildLinkPropertiesPbo as ChildLinkPropertiesPbo
|
|
37
|
-
from sapiopycommons.ai.api.fielddefinitions.proto.velox_field_def_pb2 import ActionStringPropertiesPbo as ActionStringPropertiesPbo
|
|
38
|
-
from sapiopycommons.ai.api.fielddefinitions.proto.velox_field_def_pb2 import ActionPropertiesPbo as ActionPropertiesPbo
|
|
39
|
-
from sapiopycommons.ai.api.fielddefinitions.proto.velox_field_def_pb2 import AccessionPropertiesPbo as AccessionPropertiesPbo
|
|
40
|
-
from sapiopycommons.ai.api.fielddefinitions.proto.velox_field_def_pb2 import VeloxFieldDefPbo as VeloxFieldDefPbo
|
|
41
|
-
from sapiopycommons.ai.api.fielddefinitions.proto.velox_field_def_pb2 import VeloxFieldDefListPbo as VeloxFieldDefListPbo
|
|
42
|
-
from sapiopycommons.ai.api.fielddefinitions.proto.velox_field_def_pb2 import FieldTypePbo as FieldTypePbo
|
|
43
|
-
from sapiopycommons.ai.api.fielddefinitions.proto.velox_field_def_pb2 import SortDirectionPbo as SortDirectionPbo
|
|
44
|
-
from sapiopycommons.ai.api.fielddefinitions.proto.velox_field_def_pb2 import FontSizePbo as FontSizePbo
|
|
45
|
-
from sapiopycommons.ai.api.fielddefinitions.proto.velox_field_def_pb2 import TextDecorationPbo as TextDecorationPbo
|
|
46
|
-
from sapiopycommons.ai.api.fielddefinitions.proto.velox_field_def_pb2 import StringFormatPbo as StringFormatPbo
|
|
47
|
-
from sapiopycommons.ai.api.fielddefinitions.proto.velox_field_def_pb2 import DoubleFormatPbo as DoubleFormatPbo
|
|
48
|
-
from sapiopycommons.ai.api.plan.tool.proto.entry_pb2 import StepInputBatchPbo as StepInputBatchPbo
|
|
49
|
-
from sapiopycommons.ai.api.plan.tool.proto.entry_pb2 import StepOutputBatchPbo as StepOutputBatchPbo
|
|
50
|
-
from sapiopycommons.ai.api.plan.proto.step_pb2 import StepIoInfoPbo as StepIoInfoPbo
|
|
51
|
-
from sapiopycommons.ai.api.plan.proto.step_pb2 import StepIoDetailsPbo as StepIoDetailsPbo
|
|
52
|
-
from sapiopycommons.ai.api.plan.proto.step_pb2 import StepInputDetailsPbo as StepInputDetailsPbo
|
|
53
|
-
from sapiopycommons.ai.api.plan.proto.step_pb2 import StepOutputDetailsPbo as StepOutputDetailsPbo
|
|
54
|
-
from sapiopycommons.ai.api.session.proto.sapio_conn_info_pb2 import SapioConnectionInfoPbo as SapioConnectionInfoPbo
|
|
55
|
-
from sapiopycommons.ai.api.session.proto.sapio_conn_info_pb2 import SapioUserSecretTypePbo as SapioUserSecretTypePbo
|
|
56
|
-
|
|
57
|
-
DESCRIPTOR: _descriptor.FileDescriptor
|
|
58
|
-
FIELD_TYPE_UNSPECIFIED: _velox_field_def_pb2.FieldTypePbo
|
|
59
|
-
BOOLEAN: _velox_field_def_pb2.FieldTypePbo
|
|
60
|
-
DOUBLE: _velox_field_def_pb2.FieldTypePbo
|
|
61
|
-
ENUM: _velox_field_def_pb2.FieldTypePbo
|
|
62
|
-
LONG: _velox_field_def_pb2.FieldTypePbo
|
|
63
|
-
INTEGER: _velox_field_def_pb2.FieldTypePbo
|
|
64
|
-
SHORT: _velox_field_def_pb2.FieldTypePbo
|
|
65
|
-
STRING: _velox_field_def_pb2.FieldTypePbo
|
|
66
|
-
DATE: _velox_field_def_pb2.FieldTypePbo
|
|
67
|
-
ACTION: _velox_field_def_pb2.FieldTypePbo
|
|
68
|
-
SELECTION: _velox_field_def_pb2.FieldTypePbo
|
|
69
|
-
PARENTLINK: _velox_field_def_pb2.FieldTypePbo
|
|
70
|
-
IDENTIFIER: _velox_field_def_pb2.FieldTypePbo
|
|
71
|
-
PICKLIST: _velox_field_def_pb2.FieldTypePbo
|
|
72
|
-
LINK: _velox_field_def_pb2.FieldTypePbo
|
|
73
|
-
MULTIPARENTLINK: _velox_field_def_pb2.FieldTypePbo
|
|
74
|
-
CHILDLINK: _velox_field_def_pb2.FieldTypePbo
|
|
75
|
-
AUTO_ACCESSION: _velox_field_def_pb2.FieldTypePbo
|
|
76
|
-
DATE_RANGE: _velox_field_def_pb2.FieldTypePbo
|
|
77
|
-
SIDE_LINK: _velox_field_def_pb2.FieldTypePbo
|
|
78
|
-
ACTION_STRING: _velox_field_def_pb2.FieldTypePbo
|
|
79
|
-
FILE_BLOB: _velox_field_def_pb2.FieldTypePbo
|
|
80
|
-
SORT_DIRECTION_UNSPECIFIED: _velox_field_def_pb2.SortDirectionPbo
|
|
81
|
-
SORT_DIRECTION_ASCENDING: _velox_field_def_pb2.SortDirectionPbo
|
|
82
|
-
SORT_DIRECTION_DESCENDING: _velox_field_def_pb2.SortDirectionPbo
|
|
83
|
-
SORT_DIRECTION_NONE: _velox_field_def_pb2.SortDirectionPbo
|
|
84
|
-
FONT_SIZE_UNSPECIFIED: _velox_field_def_pb2.FontSizePbo
|
|
85
|
-
FONT_SIZE_SMALL: _velox_field_def_pb2.FontSizePbo
|
|
86
|
-
FONT_SIZE_MEDIUM: _velox_field_def_pb2.FontSizePbo
|
|
87
|
-
FONT_SIZE_LARGE: _velox_field_def_pb2.FontSizePbo
|
|
88
|
-
TEXT_DECORATION_UNSPECIFIED: _velox_field_def_pb2.TextDecorationPbo
|
|
89
|
-
TEXT_DECORATION_NONE: _velox_field_def_pb2.TextDecorationPbo
|
|
90
|
-
TEXT_DECORATION_UNDERLINE: _velox_field_def_pb2.TextDecorationPbo
|
|
91
|
-
TEXT_DECORATION_STRIKETHROUGH: _velox_field_def_pb2.TextDecorationPbo
|
|
92
|
-
STRING_FORMAT_UNSPECIFIED: _velox_field_def_pb2.StringFormatPbo
|
|
93
|
-
STRING_FORMAT_PHONE: _velox_field_def_pb2.StringFormatPbo
|
|
94
|
-
STRING_FORMAT_EMAIL: _velox_field_def_pb2.StringFormatPbo
|
|
95
|
-
DOUBLE_FORMAT_UNSPECIFIED: _velox_field_def_pb2.DoubleFormatPbo
|
|
96
|
-
DOUBLE_FORMAT_CURRENCY: _velox_field_def_pb2.DoubleFormatPbo
|
|
97
|
-
DOUBLE_FORMAT_PERCENTAGE: _velox_field_def_pb2.DoubleFormatPbo
|
|
98
|
-
SESSION_TOKEN: _sapio_conn_info_pb2.SapioUserSecretTypePbo
|
|
99
|
-
PASSWORD: _sapio_conn_info_pb2.SapioUserSecretTypePbo
|
|
100
|
-
|
|
101
|
-
class ProcessStepResponseStatusPbo(int, metaclass=_enum_type_wrapper.EnumTypeWrapper):
|
|
102
|
-
__slots__ = ()
|
|
103
|
-
UNKNOWN: _ClassVar[ProcessStepResponseStatusPbo]
|
|
104
|
-
SUCCESS: _ClassVar[ProcessStepResponseStatusPbo]
|
|
105
|
-
FAILURE: _ClassVar[ProcessStepResponseStatusPbo]
|
|
106
|
-
UNKNOWN: ProcessStepResponseStatusPbo
|
|
107
|
-
SUCCESS: ProcessStepResponseStatusPbo
|
|
108
|
-
FAILURE: ProcessStepResponseStatusPbo
|
|
109
|
-
|
|
110
|
-
class ExampleContainerPbo(_message.Message):
|
|
111
|
-
__slots__ = ("text_example", "binary_example")
|
|
112
|
-
TEXT_EXAMPLE_FIELD_NUMBER: _ClassVar[int]
|
|
113
|
-
BINARY_EXAMPLE_FIELD_NUMBER: _ClassVar[int]
|
|
114
|
-
text_example: str
|
|
115
|
-
binary_example: bytes
|
|
116
|
-
def __init__(self, text_example: _Optional[str] = ..., binary_example: _Optional[bytes] = ...) -> None: ...
|
|
117
|
-
|
|
118
|
-
class ToolIoConfigBasePbo(_message.Message):
|
|
119
|
-
__slots__ = ("content_type", "io_number", "display_name", "description", "deprecated_old_example", "structure_example", "testing_example")
|
|
120
|
-
CONTENT_TYPE_FIELD_NUMBER: _ClassVar[int]
|
|
121
|
-
IO_NUMBER_FIELD_NUMBER: _ClassVar[int]
|
|
122
|
-
DISPLAY_NAME_FIELD_NUMBER: _ClassVar[int]
|
|
123
|
-
DESCRIPTION_FIELD_NUMBER: _ClassVar[int]
|
|
124
|
-
DEPRECATED_OLD_EXAMPLE_FIELD_NUMBER: _ClassVar[int]
|
|
125
|
-
STRUCTURE_EXAMPLE_FIELD_NUMBER: _ClassVar[int]
|
|
126
|
-
TESTING_EXAMPLE_FIELD_NUMBER: _ClassVar[int]
|
|
127
|
-
content_type: str
|
|
128
|
-
io_number: int
|
|
129
|
-
display_name: str
|
|
130
|
-
description: str
|
|
131
|
-
deprecated_old_example: str
|
|
132
|
-
structure_example: ExampleContainerPbo
|
|
133
|
-
testing_example: ExampleContainerPbo
|
|
134
|
-
def __init__(self, content_type: _Optional[str] = ..., io_number: _Optional[int] = ..., display_name: _Optional[str] = ..., description: _Optional[str] = ..., deprecated_old_example: _Optional[str] = ..., structure_example: _Optional[_Union[ExampleContainerPbo, _Mapping]] = ..., testing_example: _Optional[_Union[ExampleContainerPbo, _Mapping]] = ...) -> None: ...
|
|
135
|
-
|
|
136
|
-
class ToolInputDetailsPbo(_message.Message):
|
|
137
|
-
__slots__ = ("base_config", "validation", "min_input_count", "max_input_count", "paged", "min_page_size", "max_page_size", "max_request_bytes")
|
|
138
|
-
BASE_CONFIG_FIELD_NUMBER: _ClassVar[int]
|
|
139
|
-
VALIDATION_FIELD_NUMBER: _ClassVar[int]
|
|
140
|
-
MIN_INPUT_COUNT_FIELD_NUMBER: _ClassVar[int]
|
|
141
|
-
MAX_INPUT_COUNT_FIELD_NUMBER: _ClassVar[int]
|
|
142
|
-
PAGED_FIELD_NUMBER: _ClassVar[int]
|
|
143
|
-
MIN_PAGE_SIZE_FIELD_NUMBER: _ClassVar[int]
|
|
144
|
-
MAX_PAGE_SIZE_FIELD_NUMBER: _ClassVar[int]
|
|
145
|
-
MAX_REQUEST_BYTES_FIELD_NUMBER: _ClassVar[int]
|
|
146
|
-
base_config: ToolIoConfigBasePbo
|
|
147
|
-
validation: str
|
|
148
|
-
min_input_count: int
|
|
149
|
-
max_input_count: int
|
|
150
|
-
paged: bool
|
|
151
|
-
min_page_size: int
|
|
152
|
-
max_page_size: int
|
|
153
|
-
max_request_bytes: int
|
|
154
|
-
def __init__(self, base_config: _Optional[_Union[ToolIoConfigBasePbo, _Mapping]] = ..., validation: _Optional[str] = ..., min_input_count: _Optional[int] = ..., max_input_count: _Optional[int] = ..., paged: bool = ..., min_page_size: _Optional[int] = ..., max_page_size: _Optional[int] = ..., max_request_bytes: _Optional[int] = ...) -> None: ...
|
|
155
|
-
|
|
156
|
-
class ToolOutputDetailsPbo(_message.Message):
|
|
157
|
-
__slots__ = ("base_config",)
|
|
158
|
-
BASE_CONFIG_FIELD_NUMBER: _ClassVar[int]
|
|
159
|
-
base_config: ToolIoConfigBasePbo
|
|
160
|
-
def __init__(self, base_config: _Optional[_Union[ToolIoConfigBasePbo, _Mapping]] = ...) -> None: ...
|
|
161
|
-
|
|
162
|
-
class ProcessStepRequestPbo(_message.Message):
|
|
163
|
-
__slots__ = ("sapio_user", "tool_name", "plan_instance_id", "step_instance_id", "invocation_id", "input_configs", "output_configs", "config_field_values", "dry_run", "verbose_logging", "input")
|
|
164
|
-
class ConfigFieldValuesEntry(_message.Message):
|
|
165
|
-
__slots__ = ("key", "value")
|
|
166
|
-
KEY_FIELD_NUMBER: _ClassVar[int]
|
|
167
|
-
VALUE_FIELD_NUMBER: _ClassVar[int]
|
|
168
|
-
key: str
|
|
169
|
-
value: _fields_pb2.FieldValuePbo
|
|
170
|
-
def __init__(self, key: _Optional[str] = ..., value: _Optional[_Union[_fields_pb2.FieldValuePbo, _Mapping]] = ...) -> None: ...
|
|
171
|
-
SAPIO_USER_FIELD_NUMBER: _ClassVar[int]
|
|
172
|
-
TOOL_NAME_FIELD_NUMBER: _ClassVar[int]
|
|
173
|
-
PLAN_INSTANCE_ID_FIELD_NUMBER: _ClassVar[int]
|
|
174
|
-
STEP_INSTANCE_ID_FIELD_NUMBER: _ClassVar[int]
|
|
175
|
-
INVOCATION_ID_FIELD_NUMBER: _ClassVar[int]
|
|
176
|
-
INPUT_CONFIGS_FIELD_NUMBER: _ClassVar[int]
|
|
177
|
-
OUTPUT_CONFIGS_FIELD_NUMBER: _ClassVar[int]
|
|
178
|
-
CONFIG_FIELD_VALUES_FIELD_NUMBER: _ClassVar[int]
|
|
179
|
-
DRY_RUN_FIELD_NUMBER: _ClassVar[int]
|
|
180
|
-
VERBOSE_LOGGING_FIELD_NUMBER: _ClassVar[int]
|
|
181
|
-
INPUT_FIELD_NUMBER: _ClassVar[int]
|
|
182
|
-
sapio_user: _sapio_conn_info_pb2.SapioConnectionInfoPbo
|
|
183
|
-
tool_name: str
|
|
184
|
-
plan_instance_id: int
|
|
185
|
-
step_instance_id: int
|
|
186
|
-
invocation_id: int
|
|
187
|
-
input_configs: _containers.RepeatedCompositeFieldContainer[_step_pb2.StepIoInfoPbo]
|
|
188
|
-
output_configs: _containers.RepeatedCompositeFieldContainer[_step_pb2.StepIoInfoPbo]
|
|
189
|
-
config_field_values: _containers.MessageMap[str, _fields_pb2.FieldValuePbo]
|
|
190
|
-
dry_run: bool
|
|
191
|
-
verbose_logging: bool
|
|
192
|
-
input: _containers.RepeatedCompositeFieldContainer[_entry_pb2.StepInputBatchPbo]
|
|
193
|
-
def __init__(self, sapio_user: _Optional[_Union[_sapio_conn_info_pb2.SapioConnectionInfoPbo, _Mapping]] = ..., tool_name: _Optional[str] = ..., plan_instance_id: _Optional[int] = ..., step_instance_id: _Optional[int] = ..., invocation_id: _Optional[int] = ..., input_configs: _Optional[_Iterable[_Union[_step_pb2.StepIoInfoPbo, _Mapping]]] = ..., output_configs: _Optional[_Iterable[_Union[_step_pb2.StepIoInfoPbo, _Mapping]]] = ..., config_field_values: _Optional[_Mapping[str, _fields_pb2.FieldValuePbo]] = ..., dry_run: bool = ..., verbose_logging: bool = ..., input: _Optional[_Iterable[_Union[_entry_pb2.StepInputBatchPbo, _Mapping]]] = ...) -> None: ...
|
|
194
|
-
|
|
195
|
-
class ProcessStepResponsePbo(_message.Message):
|
|
196
|
-
__slots__ = ("status", "status_message", "new_records", "log", "output")
|
|
197
|
-
STATUS_FIELD_NUMBER: _ClassVar[int]
|
|
198
|
-
STATUS_MESSAGE_FIELD_NUMBER: _ClassVar[int]
|
|
199
|
-
NEW_RECORDS_FIELD_NUMBER: _ClassVar[int]
|
|
200
|
-
LOG_FIELD_NUMBER: _ClassVar[int]
|
|
201
|
-
OUTPUT_FIELD_NUMBER: _ClassVar[int]
|
|
202
|
-
status: ProcessStepResponseStatusPbo
|
|
203
|
-
status_message: str
|
|
204
|
-
new_records: _containers.RepeatedCompositeFieldContainer[_fields_pb2.FieldValueMapPbo]
|
|
205
|
-
log: _containers.RepeatedScalarFieldContainer[str]
|
|
206
|
-
output: _containers.RepeatedCompositeFieldContainer[_entry_pb2.StepOutputBatchPbo]
|
|
207
|
-
def __init__(self, status: _Optional[_Union[ProcessStepResponseStatusPbo, str]] = ..., status_message: _Optional[str] = ..., new_records: _Optional[_Iterable[_Union[_fields_pb2.FieldValueMapPbo, _Mapping]]] = ..., log: _Optional[_Iterable[str]] = ..., output: _Optional[_Iterable[_Union[_entry_pb2.StepOutputBatchPbo, _Mapping]]] = ...) -> None: ...
|
|
208
|
-
|
|
209
|
-
class ToolDetailsRequestPbo(_message.Message):
|
|
210
|
-
__slots__ = ("sapio_conn_info",)
|
|
211
|
-
SAPIO_CONN_INFO_FIELD_NUMBER: _ClassVar[int]
|
|
212
|
-
sapio_conn_info: _sapio_conn_info_pb2.SapioConnectionInfoPbo
|
|
213
|
-
def __init__(self, sapio_conn_info: _Optional[_Union[_sapio_conn_info_pb2.SapioConnectionInfoPbo, _Mapping]] = ...) -> None: ...
|
|
214
|
-
|
|
215
|
-
class ToolDetailsPbo(_message.Message):
|
|
216
|
-
__slots__ = ("name", "description", "output_data_type_name", "input_configs", "output_configs", "config_fields")
|
|
217
|
-
NAME_FIELD_NUMBER: _ClassVar[int]
|
|
218
|
-
DESCRIPTION_FIELD_NUMBER: _ClassVar[int]
|
|
219
|
-
OUTPUT_DATA_TYPE_NAME_FIELD_NUMBER: _ClassVar[int]
|
|
220
|
-
INPUT_CONFIGS_FIELD_NUMBER: _ClassVar[int]
|
|
221
|
-
OUTPUT_CONFIGS_FIELD_NUMBER: _ClassVar[int]
|
|
222
|
-
CONFIG_FIELDS_FIELD_NUMBER: _ClassVar[int]
|
|
223
|
-
name: str
|
|
224
|
-
description: str
|
|
225
|
-
output_data_type_name: str
|
|
226
|
-
input_configs: _containers.RepeatedCompositeFieldContainer[ToolInputDetailsPbo]
|
|
227
|
-
output_configs: _containers.RepeatedCompositeFieldContainer[ToolOutputDetailsPbo]
|
|
228
|
-
config_fields: _containers.RepeatedCompositeFieldContainer[_velox_field_def_pb2.VeloxFieldDefPbo]
|
|
229
|
-
def __init__(self, name: _Optional[str] = ..., description: _Optional[str] = ..., output_data_type_name: _Optional[str] = ..., input_configs: _Optional[_Iterable[_Union[ToolInputDetailsPbo, _Mapping]]] = ..., output_configs: _Optional[_Iterable[_Union[ToolOutputDetailsPbo, _Mapping]]] = ..., config_fields: _Optional[_Iterable[_Union[_velox_field_def_pb2.VeloxFieldDefPbo, _Mapping]]] = ...) -> None: ...
|
|
230
|
-
|
|
231
|
-
class ToolDetailsResponsePbo(_message.Message):
|
|
232
|
-
__slots__ = ("tool_framework_version", "tool_details")
|
|
233
|
-
TOOL_FRAMEWORK_VERSION_FIELD_NUMBER: _ClassVar[int]
|
|
234
|
-
TOOL_DETAILS_FIELD_NUMBER: _ClassVar[int]
|
|
235
|
-
tool_framework_version: int
|
|
236
|
-
tool_details: _containers.RepeatedCompositeFieldContainer[ToolDetailsPbo]
|
|
237
|
-
def __init__(self, tool_framework_version: _Optional[int] = ..., tool_details: _Optional[_Iterable[_Union[ToolDetailsPbo, _Mapping]]] = ...) -> None: ...
|
|
@@ -1,154 +0,0 @@
|
|
|
1
|
-
# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!
|
|
2
|
-
"""Client and server classes corresponding to protobuf-defined services."""
|
|
3
|
-
import grpc
|
|
4
|
-
import warnings
|
|
5
|
-
|
|
6
|
-
from sapiopycommons.ai.api.plan.tool.proto import tool_pb2 as sapiopycommons_dot_ai_dot_api_dot_plan_dot_tool_dot_proto_dot_tool__pb2
|
|
7
|
-
|
|
8
|
-
GRPC_GENERATED_VERSION = '1.70.0'
|
|
9
|
-
GRPC_VERSION = grpc.__version__
|
|
10
|
-
_version_not_supported = False
|
|
11
|
-
|
|
12
|
-
try:
|
|
13
|
-
from grpc._utilities import first_version_is_lower
|
|
14
|
-
_version_not_supported = first_version_is_lower(GRPC_VERSION, GRPC_GENERATED_VERSION)
|
|
15
|
-
except ImportError:
|
|
16
|
-
_version_not_supported = True
|
|
17
|
-
|
|
18
|
-
if _version_not_supported:
|
|
19
|
-
raise RuntimeError(
|
|
20
|
-
f'The grpc package installed is at version {GRPC_VERSION},'
|
|
21
|
-
+ f' but the generated code in sapiopycommons/ai/api/plan/tool/proto/tool_pb2_grpc.py depends on'
|
|
22
|
-
+ f' grpcio>={GRPC_GENERATED_VERSION}.'
|
|
23
|
-
+ f' Please upgrade your grpc module to grpcio>={GRPC_GENERATED_VERSION}'
|
|
24
|
-
+ f' or downgrade your generated code using grpcio-tools<={GRPC_VERSION}.'
|
|
25
|
-
)
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
class ToolServiceStub(object):
|
|
29
|
-
"""
|
|
30
|
-
This is the generic service interface that all tools must implement. We will use hostname routing to route the request to the correct tool.
|
|
31
|
-
The other option is for us to use gRPC metadata to route the request to the correct tool. We don't want to expose a bunch of ports and that's
|
|
32
|
-
a pain to manage. So we will use hostname routing for now.
|
|
33
|
-
"""
|
|
34
|
-
|
|
35
|
-
def __init__(self, channel):
|
|
36
|
-
"""Constructor.
|
|
37
|
-
|
|
38
|
-
Args:
|
|
39
|
-
channel: A grpc.Channel.
|
|
40
|
-
"""
|
|
41
|
-
self.GetToolDetails = channel.unary_unary(
|
|
42
|
-
'/ToolService/GetToolDetails',
|
|
43
|
-
request_serializer=sapiopycommons_dot_ai_dot_api_dot_plan_dot_tool_dot_proto_dot_tool__pb2.ToolDetailsRequestPbo.SerializeToString,
|
|
44
|
-
response_deserializer=sapiopycommons_dot_ai_dot_api_dot_plan_dot_tool_dot_proto_dot_tool__pb2.ToolDetailsResponsePbo.FromString,
|
|
45
|
-
_registered_method=True)
|
|
46
|
-
self.ProcessData = channel.unary_unary(
|
|
47
|
-
'/ToolService/ProcessData',
|
|
48
|
-
request_serializer=sapiopycommons_dot_ai_dot_api_dot_plan_dot_tool_dot_proto_dot_tool__pb2.ProcessStepRequestPbo.SerializeToString,
|
|
49
|
-
response_deserializer=sapiopycommons_dot_ai_dot_api_dot_plan_dot_tool_dot_proto_dot_tool__pb2.ProcessStepResponsePbo.FromString,
|
|
50
|
-
_registered_method=True)
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
class ToolServiceServicer(object):
|
|
54
|
-
"""
|
|
55
|
-
This is the generic service interface that all tools must implement. We will use hostname routing to route the request to the correct tool.
|
|
56
|
-
The other option is for us to use gRPC metadata to route the request to the correct tool. We don't want to expose a bunch of ports and that's
|
|
57
|
-
a pain to manage. So we will use hostname routing for now.
|
|
58
|
-
"""
|
|
59
|
-
|
|
60
|
-
def GetToolDetails(self, request, context):
|
|
61
|
-
"""This allows for a tool to self-describe itself, which allows for the UI to be automatically populated with this information
|
|
62
|
-
"""
|
|
63
|
-
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
|
|
64
|
-
context.set_details('Method not implemented!')
|
|
65
|
-
raise NotImplementedError('Method not implemented!')
|
|
66
|
-
|
|
67
|
-
def ProcessData(self, request, context):
|
|
68
|
-
"""This is the main entry point for a tool to be called
|
|
69
|
-
"""
|
|
70
|
-
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
|
|
71
|
-
context.set_details('Method not implemented!')
|
|
72
|
-
raise NotImplementedError('Method not implemented!')
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
def add_ToolServiceServicer_to_server(servicer, server):
|
|
76
|
-
rpc_method_handlers = {
|
|
77
|
-
'GetToolDetails': grpc.unary_unary_rpc_method_handler(
|
|
78
|
-
servicer.GetToolDetails,
|
|
79
|
-
request_deserializer=sapiopycommons_dot_ai_dot_api_dot_plan_dot_tool_dot_proto_dot_tool__pb2.ToolDetailsRequestPbo.FromString,
|
|
80
|
-
response_serializer=sapiopycommons_dot_ai_dot_api_dot_plan_dot_tool_dot_proto_dot_tool__pb2.ToolDetailsResponsePbo.SerializeToString,
|
|
81
|
-
),
|
|
82
|
-
'ProcessData': grpc.unary_unary_rpc_method_handler(
|
|
83
|
-
servicer.ProcessData,
|
|
84
|
-
request_deserializer=sapiopycommons_dot_ai_dot_api_dot_plan_dot_tool_dot_proto_dot_tool__pb2.ProcessStepRequestPbo.FromString,
|
|
85
|
-
response_serializer=sapiopycommons_dot_ai_dot_api_dot_plan_dot_tool_dot_proto_dot_tool__pb2.ProcessStepResponsePbo.SerializeToString,
|
|
86
|
-
),
|
|
87
|
-
}
|
|
88
|
-
generic_handler = grpc.method_handlers_generic_handler(
|
|
89
|
-
'ToolService', rpc_method_handlers)
|
|
90
|
-
server.add_generic_rpc_handlers((generic_handler,))
|
|
91
|
-
server.add_registered_method_handlers('ToolService', rpc_method_handlers)
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
# This class is part of an EXPERIMENTAL API.
|
|
95
|
-
class ToolService(object):
|
|
96
|
-
"""
|
|
97
|
-
This is the generic service interface that all tools must implement. We will use hostname routing to route the request to the correct tool.
|
|
98
|
-
The other option is for us to use gRPC metadata to route the request to the correct tool. We don't want to expose a bunch of ports and that's
|
|
99
|
-
a pain to manage. So we will use hostname routing for now.
|
|
100
|
-
"""
|
|
101
|
-
|
|
102
|
-
@staticmethod
|
|
103
|
-
def GetToolDetails(request,
|
|
104
|
-
target,
|
|
105
|
-
options=(),
|
|
106
|
-
channel_credentials=None,
|
|
107
|
-
call_credentials=None,
|
|
108
|
-
insecure=False,
|
|
109
|
-
compression=None,
|
|
110
|
-
wait_for_ready=None,
|
|
111
|
-
timeout=None,
|
|
112
|
-
metadata=None):
|
|
113
|
-
return grpc.experimental.unary_unary(
|
|
114
|
-
request,
|
|
115
|
-
target,
|
|
116
|
-
'/ToolService/GetToolDetails',
|
|
117
|
-
sapiopycommons_dot_ai_dot_api_dot_plan_dot_tool_dot_proto_dot_tool__pb2.ToolDetailsRequestPbo.SerializeToString,
|
|
118
|
-
sapiopycommons_dot_ai_dot_api_dot_plan_dot_tool_dot_proto_dot_tool__pb2.ToolDetailsResponsePbo.FromString,
|
|
119
|
-
options,
|
|
120
|
-
channel_credentials,
|
|
121
|
-
insecure,
|
|
122
|
-
call_credentials,
|
|
123
|
-
compression,
|
|
124
|
-
wait_for_ready,
|
|
125
|
-
timeout,
|
|
126
|
-
metadata,
|
|
127
|
-
_registered_method=True)
|
|
128
|
-
|
|
129
|
-
@staticmethod
|
|
130
|
-
def ProcessData(request,
|
|
131
|
-
target,
|
|
132
|
-
options=(),
|
|
133
|
-
channel_credentials=None,
|
|
134
|
-
call_credentials=None,
|
|
135
|
-
insecure=False,
|
|
136
|
-
compression=None,
|
|
137
|
-
wait_for_ready=None,
|
|
138
|
-
timeout=None,
|
|
139
|
-
metadata=None):
|
|
140
|
-
return grpc.experimental.unary_unary(
|
|
141
|
-
request,
|
|
142
|
-
target,
|
|
143
|
-
'/ToolService/ProcessData',
|
|
144
|
-
sapiopycommons_dot_ai_dot_api_dot_plan_dot_tool_dot_proto_dot_tool__pb2.ProcessStepRequestPbo.SerializeToString,
|
|
145
|
-
sapiopycommons_dot_ai_dot_api_dot_plan_dot_tool_dot_proto_dot_tool__pb2.ProcessStepResponsePbo.FromString,
|
|
146
|
-
options,
|
|
147
|
-
channel_credentials,
|
|
148
|
-
insecure,
|
|
149
|
-
call_credentials,
|
|
150
|
-
compression,
|
|
151
|
-
wait_for_ready,
|
|
152
|
-
timeout,
|
|
153
|
-
metadata,
|
|
154
|
-
_registered_method=True)
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
# -*- coding: utf-8 -*-
|
|
2
|
-
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
|
3
|
-
# NO CHECKED-IN PROTOBUF GENCODE
|
|
4
|
-
# source: sapiopycommons/ai/api/session/proto/sapio_conn_info.proto
|
|
5
|
-
# Protobuf Python Version: 5.29.0
|
|
6
|
-
"""Generated protocol buffer code."""
|
|
7
|
-
from google.protobuf import descriptor as _descriptor
|
|
8
|
-
from google.protobuf import descriptor_pool as _descriptor_pool
|
|
9
|
-
from google.protobuf import runtime_version as _runtime_version
|
|
10
|
-
from google.protobuf import symbol_database as _symbol_database
|
|
11
|
-
from google.protobuf.internal import builder as _builder
|
|
12
|
-
_runtime_version.ValidateProtobufRuntimeVersion(
|
|
13
|
-
_runtime_version.Domain.PUBLIC,
|
|
14
|
-
5,
|
|
15
|
-
29,
|
|
16
|
-
0,
|
|
17
|
-
'',
|
|
18
|
-
'sapiopycommons/ai/api/session/proto/sapio_conn_info.proto'
|
|
19
|
-
)
|
|
20
|
-
# @@protoc_insertion_point(imports)
|
|
21
|
-
|
|
22
|
-
_sym_db = _symbol_database.Default()
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n9sapiopycommons/ai/api/session/proto/sapio_conn_info.proto\"\xb6\x01\n\x16SapioConnectionInfoPbo\x12\x16\n\x0ewebservice_url\x18\x01 \x01(\t\x12\x10\n\x08rmi_host\x18\x02 \x03(\t\x12\x10\n\x08rmi_port\x18\x03 \x01(\x05\x12\x10\n\x08\x61pp_guid\x18\x04 \x01(\t\x12\x10\n\x08username\x18\x05 \x01(\t\x12,\n\x0bsecret_type\x18\x06 \x01(\x0e\x32\x17.SapioUserSecretTypePbo\x12\x0e\n\x06secret\x18\x07 \x01(\t*9\n\x16SapioUserSecretTypePbo\x12\x11\n\rSESSION_TOKEN\x10\x00\x12\x0c\n\x08PASSWORD\x10\x01\x42\x1f\n\x1b\x63om.velox.api.session.protoP\x01\x62\x06proto3')
|
|
28
|
-
|
|
29
|
-
_globals = globals()
|
|
30
|
-
_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals)
|
|
31
|
-
_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'sapiopycommons.ai.api.session.proto.sapio_conn_info_pb2', _globals)
|
|
32
|
-
if not _descriptor._USE_C_DESCRIPTORS:
|
|
33
|
-
_globals['DESCRIPTOR']._loaded_options = None
|
|
34
|
-
_globals['DESCRIPTOR']._serialized_options = b'\n\033com.velox.api.session.protoP\001'
|
|
35
|
-
_globals['_SAPIOUSERSECRETTYPEPBO']._serialized_start=246
|
|
36
|
-
_globals['_SAPIOUSERSECRETTYPEPBO']._serialized_end=303
|
|
37
|
-
_globals['_SAPIOCONNECTIONINFOPBO']._serialized_start=62
|
|
38
|
-
_globals['_SAPIOCONNECTIONINFOPBO']._serialized_end=244
|
|
39
|
-
# @@protoc_insertion_point(module_scope)
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
from google.protobuf.internal import containers as _containers
|
|
2
|
-
from google.protobuf.internal import enum_type_wrapper as _enum_type_wrapper
|
|
3
|
-
from google.protobuf import descriptor as _descriptor
|
|
4
|
-
from google.protobuf import message as _message
|
|
5
|
-
from typing import ClassVar as _ClassVar, Iterable as _Iterable, Optional as _Optional, Union as _Union
|
|
6
|
-
|
|
7
|
-
DESCRIPTOR: _descriptor.FileDescriptor
|
|
8
|
-
|
|
9
|
-
class SapioUserSecretTypePbo(int, metaclass=_enum_type_wrapper.EnumTypeWrapper):
|
|
10
|
-
__slots__ = ()
|
|
11
|
-
SESSION_TOKEN: _ClassVar[SapioUserSecretTypePbo]
|
|
12
|
-
PASSWORD: _ClassVar[SapioUserSecretTypePbo]
|
|
13
|
-
SESSION_TOKEN: SapioUserSecretTypePbo
|
|
14
|
-
PASSWORD: SapioUserSecretTypePbo
|
|
15
|
-
|
|
16
|
-
class SapioConnectionInfoPbo(_message.Message):
|
|
17
|
-
__slots__ = ("webservice_url", "rmi_host", "rmi_port", "app_guid", "username", "secret_type", "secret")
|
|
18
|
-
WEBSERVICE_URL_FIELD_NUMBER: _ClassVar[int]
|
|
19
|
-
RMI_HOST_FIELD_NUMBER: _ClassVar[int]
|
|
20
|
-
RMI_PORT_FIELD_NUMBER: _ClassVar[int]
|
|
21
|
-
APP_GUID_FIELD_NUMBER: _ClassVar[int]
|
|
22
|
-
USERNAME_FIELD_NUMBER: _ClassVar[int]
|
|
23
|
-
SECRET_TYPE_FIELD_NUMBER: _ClassVar[int]
|
|
24
|
-
SECRET_FIELD_NUMBER: _ClassVar[int]
|
|
25
|
-
webservice_url: str
|
|
26
|
-
rmi_host: _containers.RepeatedScalarFieldContainer[str]
|
|
27
|
-
rmi_port: int
|
|
28
|
-
app_guid: str
|
|
29
|
-
username: str
|
|
30
|
-
secret_type: SapioUserSecretTypePbo
|
|
31
|
-
secret: str
|
|
32
|
-
def __init__(self, webservice_url: _Optional[str] = ..., rmi_host: _Optional[_Iterable[str]] = ..., rmi_port: _Optional[int] = ..., app_guid: _Optional[str] = ..., username: _Optional[str] = ..., secret_type: _Optional[_Union[SapioUserSecretTypePbo, str]] = ..., secret: _Optional[str] = ...) -> None: ...
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!
|
|
2
|
-
"""Client and server classes corresponding to protobuf-defined services."""
|
|
3
|
-
import grpc
|
|
4
|
-
import warnings
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
GRPC_GENERATED_VERSION = '1.70.0'
|
|
8
|
-
GRPC_VERSION = grpc.__version__
|
|
9
|
-
_version_not_supported = False
|
|
10
|
-
|
|
11
|
-
try:
|
|
12
|
-
from grpc._utilities import first_version_is_lower
|
|
13
|
-
_version_not_supported = first_version_is_lower(GRPC_VERSION, GRPC_GENERATED_VERSION)
|
|
14
|
-
except ImportError:
|
|
15
|
-
_version_not_supported = True
|
|
16
|
-
|
|
17
|
-
if _version_not_supported:
|
|
18
|
-
raise RuntimeError(
|
|
19
|
-
f'The grpc package installed is at version {GRPC_VERSION},'
|
|
20
|
-
+ f' but the generated code in sapiopycommons/ai/api/session/proto/sapio_conn_info_pb2_grpc.py depends on'
|
|
21
|
-
+ f' grpcio>={GRPC_GENERATED_VERSION}.'
|
|
22
|
-
+ f' Please upgrade your grpc module to grpcio>={GRPC_GENERATED_VERSION}'
|
|
23
|
-
+ f' or downgrade your generated code using grpcio-tools<={GRPC_VERSION}.'
|
|
24
|
-
)
|
|
@@ -1,116 +0,0 @@
|
|
|
1
|
-
from __future__ import annotations
|
|
2
|
-
|
|
3
|
-
import traceback
|
|
4
|
-
from abc import ABC, abstractmethod
|
|
5
|
-
|
|
6
|
-
from grpc import ServicerContext
|
|
7
|
-
|
|
8
|
-
from sapiopycommons.ai.api.plan.converter.proto.converter_pb2 import ConverterDetailsResponsePbo, ConvertResponsePbo, \
|
|
9
|
-
ConvertRequestPbo, ConverterDetailsRequestPbo, ContentTypePairPbo
|
|
10
|
-
from sapiopycommons.ai.api.plan.converter.proto.converter_pb2_grpc import ConverterServiceServicer
|
|
11
|
-
from sapiopycommons.ai.api.plan.item.proto.item_container_pb2 import ContentTypePbo, StepItemContainerPbo
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
class ConverterServiceBase(ConverterServiceServicer, ABC):
|
|
15
|
-
def GetConverterDetails(self, request: ConverterDetailsRequestPbo, context: ServicerContext) \
|
|
16
|
-
-> ConverterDetailsResponsePbo:
|
|
17
|
-
try:
|
|
18
|
-
supported_types: list[ContentTypePairPbo] = []
|
|
19
|
-
for c in self.register_converters():
|
|
20
|
-
converter = c()
|
|
21
|
-
supported_types.append(ContentTypePairPbo(
|
|
22
|
-
input_content_type=converter.input_type_pbo(),
|
|
23
|
-
output_content_type=converter.output_type_pbo()
|
|
24
|
-
))
|
|
25
|
-
return ConverterDetailsResponsePbo(supported_types=supported_types)
|
|
26
|
-
except Exception as e:
|
|
27
|
-
print(f"CRITICAL ERROR: {e}")
|
|
28
|
-
print(traceback.format_exc())
|
|
29
|
-
return ConverterDetailsResponsePbo()
|
|
30
|
-
|
|
31
|
-
def ConvertContent(self, request: ConvertRequestPbo, context: ServicerContext) -> ConvertResponsePbo:
|
|
32
|
-
try:
|
|
33
|
-
input_container: StepItemContainerPbo = request.item_container
|
|
34
|
-
input_type: ContentTypePbo = input_container.content_type
|
|
35
|
-
target_type: ContentTypePbo = request.target_content_type
|
|
36
|
-
for c in self.register_converters():
|
|
37
|
-
converter = c()
|
|
38
|
-
if converter.can_convert(input_type, target_type):
|
|
39
|
-
return ConvertResponsePbo(item_container=converter.convert(input_container))
|
|
40
|
-
raise ValueError(f"No converter found for converting {input_type.name} ({', '.join(input_type.extensions)}) "
|
|
41
|
-
f"to {target_type.name} ({', '.join(target_type.extensions)}).")
|
|
42
|
-
except Exception as e:
|
|
43
|
-
print(f"CRITICAL ERROR: {e}")
|
|
44
|
-
print(traceback.format_exc())
|
|
45
|
-
return ConvertResponsePbo()
|
|
46
|
-
|
|
47
|
-
@abstractmethod
|
|
48
|
-
def register_converters(self) -> list[type[ConverterBase]]:
|
|
49
|
-
"""
|
|
50
|
-
Register converter types with this service. Provided converters should implement the ConverterBase class.
|
|
51
|
-
|
|
52
|
-
:return: A list of converters to register to this service.
|
|
53
|
-
"""
|
|
54
|
-
pass
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
class ConverterBase(ABC):
|
|
58
|
-
def input_type_pbo(self) -> ContentTypePbo:
|
|
59
|
-
"""
|
|
60
|
-
:return: The input content type this converter accepts as a ContentTypePbo.
|
|
61
|
-
"""
|
|
62
|
-
return ContentTypePbo(name=self.input_type(), extensions=self.input_file_extensions())
|
|
63
|
-
|
|
64
|
-
def output_type_pbo(self) -> ContentTypePbo:
|
|
65
|
-
"""
|
|
66
|
-
:return: The output content type this converter produces as a ContentTypePbo.
|
|
67
|
-
"""
|
|
68
|
-
return ContentTypePbo(name=self.output_type(), extensions=self.output_file_extensions())
|
|
69
|
-
|
|
70
|
-
@abstractmethod
|
|
71
|
-
def input_type(self) -> str:
|
|
72
|
-
"""
|
|
73
|
-
:return: The input content type this converter accepts.
|
|
74
|
-
"""
|
|
75
|
-
pass
|
|
76
|
-
|
|
77
|
-
@abstractmethod
|
|
78
|
-
def input_file_extensions(self) -> list[str]:
|
|
79
|
-
"""
|
|
80
|
-
:return: A list of file extensions this converter accepts as input.
|
|
81
|
-
"""
|
|
82
|
-
pass
|
|
83
|
-
|
|
84
|
-
@abstractmethod
|
|
85
|
-
def output_type(self) -> str:
|
|
86
|
-
"""
|
|
87
|
-
:return: The output content type this converter produces.
|
|
88
|
-
"""
|
|
89
|
-
pass
|
|
90
|
-
|
|
91
|
-
@abstractmethod
|
|
92
|
-
def output_file_extensions(self) -> list[str]:
|
|
93
|
-
"""
|
|
94
|
-
:return: A list of file extensions this converter produces as output.
|
|
95
|
-
"""
|
|
96
|
-
pass
|
|
97
|
-
|
|
98
|
-
def can_convert(self, input_type: ContentTypePbo, target_type: ContentTypePbo) -> bool:
|
|
99
|
-
"""
|
|
100
|
-
Check if this converter can convert from the input type to the target type.
|
|
101
|
-
|
|
102
|
-
:param input_type: The input content type.
|
|
103
|
-
:param target_type: The target content type.
|
|
104
|
-
:return: True if this converter can convert from the input type to the target type, False otherwise.
|
|
105
|
-
"""
|
|
106
|
-
return self.input_type() == input_type.name and self.output_type() == target_type.name
|
|
107
|
-
|
|
108
|
-
@abstractmethod
|
|
109
|
-
def convert(self, content: StepItemContainerPbo) -> StepItemContainerPbo:
|
|
110
|
-
"""
|
|
111
|
-
Convert the provided content from the input type to the output type.
|
|
112
|
-
|
|
113
|
-
:param content: The content to convert.
|
|
114
|
-
:return: The converted content.
|
|
115
|
-
"""
|
|
116
|
-
pass
|