gimlet-api 0.0.12__py3-none-any.whl → 0.0.13__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.
@@ -16,7 +16,7 @@ from gml.proto.src.common.typespb import uuid_pb2 as src_dot_common_dot_typespb_
16
16
  from gml.proto.src.api.corepb.v1 import model_exec_pb2 as src_dot_api_dot_corepb_dot_v1_dot_model__exec__pb2
17
17
 
18
18
 
19
- DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\'src/controlplane/model/mpb/v1/mpb.proto\x12\"gml.internal.controlplane.model.v1\x1a\x14gogoproto/gogo.proto\x1a\x1dsrc/common/typespb/uuid.proto\x1a\"src/api/corepb/v1/model_exec.proto\"\x81\x01\n\x0fGetModelRequest\x12\'\n\x02id\x18\x01 \x01(\x0b\x32\x0f.gml.types.UUIDB\x06\xe2\xde\x1f\x02IDR\x02id\x12\x12\n\x04name\x18\x02 \x01(\tR\x04name\x12\x31\n\x06org_id\x18\x03 \x01(\x0b\x32\x0f.gml.types.UUIDB\t\xe2\xde\x1f\x05OrgIDR\x05orgId\"\x7f\n\x10GetModelResponse\x12\x42\n\nmodel_info\x18\x01 \x01(\x0b\x32#.gml.internal.api.core.v1.ModelInfoR\tmodelInfo\x12\'\n\x02id\x18\x02 \x01(\x0b\x32\x0f.gml.types.UUIDB\x06\xe2\xde\x1f\x02IDR\x02id\"\x9f\x01\n\x12\x43reateModelRequest\x12\x31\n\x06org_id\x18\x01 \x01(\x0b\x32\x0f.gml.types.UUIDB\t\xe2\xde\x1f\x05OrgIDR\x05orgId\x12\x12\n\x04name\x18\x02 \x01(\tR\x04name\x12\x42\n\nmodel_info\x18\x03 \x01(\x0b\x32#.gml.internal.api.core.v1.ModelInfoR\tmodelInfo\">\n\x13\x43reateModelResponse\x12\'\n\x02id\x18\x01 \x01(\x0b\x32\x0f.gml.types.UUIDB\x06\xe2\xde\x1f\x02IDR\x02id2\x85\x02\n\x0cModelService\x12u\n\x08GetModel\x12\x33.gml.internal.controlplane.model.v1.GetModelRequest\x1a\x34.gml.internal.controlplane.model.v1.GetModelResponse\x12~\n\x0b\x43reateModel\x12\x36.gml.internal.controlplane.model.v1.CreateModelRequest\x1a\x37.gml.internal.controlplane.model.v1.CreateModelResponseB8Z6gimletlabs.ai/gimlet/src/controlplane/model/mpb/v1;mpbb\x06proto3')
19
+ DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\'src/controlplane/model/mpb/v1/mpb.proto\x12\"gml.internal.controlplane.model.v1\x1a\x14gogoproto/gogo.proto\x1a\x1dsrc/common/typespb/uuid.proto\x1a\"src/api/corepb/v1/model_exec.proto\"\x9e\x01\n\x0fGetModelRequest\x12\'\n\x02id\x18\x01 \x01(\x0b\x32\x0f.gml.types.UUIDB\x06\xe2\xde\x1f\x02IDR\x02id\x12\x12\n\x04name\x18\x02 \x01(\tR\x04name\x12\x33\n\x06org_id\x18\x03 \x01(\x0b\x32\x0f.gml.types.UUIDB\x0b\x18\x01\xe2\xde\x1f\x05OrgIDR\x05orgId\x12\x19\n\x08org_name\x18\x04 \x01(\tR\x07orgName\"\x7f\n\x10GetModelResponse\x12\x42\n\nmodel_info\x18\x01 \x01(\x0b\x32#.gml.internal.api.core.v1.ModelInfoR\tmodelInfo\x12\'\n\x02id\x18\x02 \x01(\x0b\x32\x0f.gml.types.UUIDB\x06\xe2\xde\x1f\x02IDR\x02id\"\x9f\x01\n\x12\x43reateModelRequest\x12\x31\n\x06org_id\x18\x01 \x01(\x0b\x32\x0f.gml.types.UUIDB\t\xe2\xde\x1f\x05OrgIDR\x05orgId\x12\x12\n\x04name\x18\x02 \x01(\tR\x04name\x12\x42\n\nmodel_info\x18\x03 \x01(\x0b\x32#.gml.internal.api.core.v1.ModelInfoR\tmodelInfo\">\n\x13\x43reateModelResponse\x12\'\n\x02id\x18\x01 \x01(\x0b\x32\x0f.gml.types.UUIDB\x06\xe2\xde\x1f\x02IDR\x02id\"\x94\x01\n\x11ShareModelRequest\x12\'\n\x02id\x18\x01 \x01(\x0b\x32\x0f.gml.types.UUIDB\x06\xe2\xde\x1f\x02IDR\x02id\x12\x1a\n\x08relation\x18\x02 \x01(\tR\x08relation\x12\x1b\n\tall_users\x18\x03 \x01(\x08R\x08\x61llUsers\x12\x1d\n\nuser_email\x18\x04 \x01(\tR\tuserEmail\"\x14\n\x12ShareModelResponse2\x82\x03\n\x0cModelService\x12u\n\x08GetModel\x12\x33.gml.internal.controlplane.model.v1.GetModelRequest\x1a\x34.gml.internal.controlplane.model.v1.GetModelResponse\x12~\n\x0b\x43reateModel\x12\x36.gml.internal.controlplane.model.v1.CreateModelRequest\x1a\x37.gml.internal.controlplane.model.v1.CreateModelResponse\x12{\n\nShareModel\x12\x35.gml.internal.controlplane.model.v1.ShareModelRequest\x1a\x36.gml.internal.controlplane.model.v1.ShareModelResponseB8Z6gimletlabs.ai/gimlet/src/controlplane/model/mpb/v1;mpbb\x06proto3')
20
20
 
21
21
  _builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, globals())
22
22
  _builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'src.controlplane.model.mpb.v1.mpb_pb2', globals())
@@ -27,21 +27,27 @@ if _descriptor._USE_C_DESCRIPTORS == False:
27
27
  _GETMODELREQUEST.fields_by_name['id']._options = None
28
28
  _GETMODELREQUEST.fields_by_name['id']._serialized_options = b'\342\336\037\002ID'
29
29
  _GETMODELREQUEST.fields_by_name['org_id']._options = None
30
- _GETMODELREQUEST.fields_by_name['org_id']._serialized_options = b'\342\336\037\005OrgID'
30
+ _GETMODELREQUEST.fields_by_name['org_id']._serialized_options = b'\030\001\342\336\037\005OrgID'
31
31
  _GETMODELRESPONSE.fields_by_name['id']._options = None
32
32
  _GETMODELRESPONSE.fields_by_name['id']._serialized_options = b'\342\336\037\002ID'
33
33
  _CREATEMODELREQUEST.fields_by_name['org_id']._options = None
34
34
  _CREATEMODELREQUEST.fields_by_name['org_id']._serialized_options = b'\342\336\037\005OrgID'
35
35
  _CREATEMODELRESPONSE.fields_by_name['id']._options = None
36
36
  _CREATEMODELRESPONSE.fields_by_name['id']._serialized_options = b'\342\336\037\002ID'
37
+ _SHAREMODELREQUEST.fields_by_name['id']._options = None
38
+ _SHAREMODELREQUEST.fields_by_name['id']._serialized_options = b'\342\336\037\002ID'
37
39
  _GETMODELREQUEST._serialized_start=169
38
- _GETMODELREQUEST._serialized_end=298
39
- _GETMODELRESPONSE._serialized_start=300
40
- _GETMODELRESPONSE._serialized_end=427
41
- _CREATEMODELREQUEST._serialized_start=430
42
- _CREATEMODELREQUEST._serialized_end=589
43
- _CREATEMODELRESPONSE._serialized_start=591
44
- _CREATEMODELRESPONSE._serialized_end=653
45
- _MODELSERVICE._serialized_start=656
46
- _MODELSERVICE._serialized_end=917
40
+ _GETMODELREQUEST._serialized_end=327
41
+ _GETMODELRESPONSE._serialized_start=329
42
+ _GETMODELRESPONSE._serialized_end=456
43
+ _CREATEMODELREQUEST._serialized_start=459
44
+ _CREATEMODELREQUEST._serialized_end=618
45
+ _CREATEMODELRESPONSE._serialized_start=620
46
+ _CREATEMODELRESPONSE._serialized_end=682
47
+ _SHAREMODELREQUEST._serialized_start=685
48
+ _SHAREMODELREQUEST._serialized_end=833
49
+ _SHAREMODELRESPONSE._serialized_start=835
50
+ _SHAREMODELRESPONSE._serialized_end=855
51
+ _MODELSERVICE._serialized_start=858
52
+ _MODELSERVICE._serialized_end=1244
47
53
  # @@protoc_insertion_point(module_scope)
@@ -24,6 +24,11 @@ class ModelServiceStub(object):
24
24
  request_serializer=src_dot_controlplane_dot_model_dot_mpb_dot_v1_dot_mpb__pb2.CreateModelRequest.SerializeToString,
25
25
  response_deserializer=src_dot_controlplane_dot_model_dot_mpb_dot_v1_dot_mpb__pb2.CreateModelResponse.FromString,
26
26
  )
27
+ self.ShareModel = channel.unary_unary(
28
+ '/gml.internal.controlplane.model.v1.ModelService/ShareModel',
29
+ request_serializer=src_dot_controlplane_dot_model_dot_mpb_dot_v1_dot_mpb__pb2.ShareModelRequest.SerializeToString,
30
+ response_deserializer=src_dot_controlplane_dot_model_dot_mpb_dot_v1_dot_mpb__pb2.ShareModelResponse.FromString,
31
+ )
27
32
 
28
33
 
29
34
  class ModelServiceServicer(object):
@@ -41,6 +46,12 @@ class ModelServiceServicer(object):
41
46
  context.set_details('Method not implemented!')
42
47
  raise NotImplementedError('Method not implemented!')
43
48
 
49
+ def ShareModel(self, request, context):
50
+ """Missing associated documentation comment in .proto file."""
51
+ context.set_code(grpc.StatusCode.UNIMPLEMENTED)
52
+ context.set_details('Method not implemented!')
53
+ raise NotImplementedError('Method not implemented!')
54
+
44
55
 
45
56
  def add_ModelServiceServicer_to_server(servicer, server):
46
57
  rpc_method_handlers = {
@@ -54,6 +65,11 @@ def add_ModelServiceServicer_to_server(servicer, server):
54
65
  request_deserializer=src_dot_controlplane_dot_model_dot_mpb_dot_v1_dot_mpb__pb2.CreateModelRequest.FromString,
55
66
  response_serializer=src_dot_controlplane_dot_model_dot_mpb_dot_v1_dot_mpb__pb2.CreateModelResponse.SerializeToString,
56
67
  ),
68
+ 'ShareModel': grpc.unary_unary_rpc_method_handler(
69
+ servicer.ShareModel,
70
+ request_deserializer=src_dot_controlplane_dot_model_dot_mpb_dot_v1_dot_mpb__pb2.ShareModelRequest.FromString,
71
+ response_serializer=src_dot_controlplane_dot_model_dot_mpb_dot_v1_dot_mpb__pb2.ShareModelResponse.SerializeToString,
72
+ ),
57
73
  }
58
74
  generic_handler = grpc.method_handlers_generic_handler(
59
75
  'gml.internal.controlplane.model.v1.ModelService', rpc_method_handlers)
@@ -97,3 +113,20 @@ class ModelService(object):
97
113
  src_dot_controlplane_dot_model_dot_mpb_dot_v1_dot_mpb__pb2.CreateModelResponse.FromString,
98
114
  options, channel_credentials,
99
115
  insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
116
+
117
+ @staticmethod
118
+ def ShareModel(request,
119
+ target,
120
+ options=(),
121
+ channel_credentials=None,
122
+ call_credentials=None,
123
+ insecure=False,
124
+ compression=None,
125
+ wait_for_ready=None,
126
+ timeout=None,
127
+ metadata=None):
128
+ return grpc.experimental.unary_unary(request, target, '/gml.internal.controlplane.model.v1.ModelService/ShareModel',
129
+ src_dot_controlplane_dot_model_dot_mpb_dot_v1_dot_mpb__pb2.ShareModelRequest.SerializeToString,
130
+ src_dot_controlplane_dot_model_dot_mpb_dot_v1_dot_mpb__pb2.ShareModelResponse.FromString,
131
+ options, channel_credentials,
132
+ insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
gml/version_utils.py ADDED
@@ -0,0 +1,43 @@
1
+ # Copyright 2023- Gimlet Labs, Inc.
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+ #
15
+ # SPDX-License-Identifier: Apache-2.0
16
+
17
+ import functools
18
+ import importlib.metadata
19
+
20
+ from packaging import version
21
+
22
+
23
+ def _is_version_greater_or_equal(pkg: str, target_version: str) -> bool:
24
+ """
25
+ Check if the installed package version is greater than or equal to the specified version.
26
+ Args:
27
+ pkg (str): The package name to check, e.g., 'torch', 'transformers'.
28
+ target_version (str): The version to compare against, in the format 'major.minor.patch'.
29
+ Returns:
30
+ bool: True if the installed package version is greater than or equal to `target_version`, False otherwise.
31
+ """
32
+ pkg_version_w_dev = importlib.metadata.version(pkg)
33
+ # ignore dev suffixes.
34
+ pkg_version = version.parse(version.parse(pkg_version_w_dev).base_version)
35
+ return pkg_version >= version.parse(target_version)
36
+
37
+
38
+ is_torch_version_greater_or_equal = functools.partial(
39
+ _is_version_greater_or_equal, "torch"
40
+ )
41
+ is_transformers_version_greater_or_equal = functools.partial(
42
+ _is_version_greater_or_equal, "transformers"
43
+ )