sunholo 0.76.3__py3-none-any.whl → 0.76.4__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.
- sunholo/auth/__init__.py +1 -1
- sunholo/auth/run.py +7 -2
- sunholo/vertex/extensions_class.py +19 -2
- {sunholo-0.76.3.dist-info → sunholo-0.76.4.dist-info}/METADATA +2 -2
- {sunholo-0.76.3.dist-info → sunholo-0.76.4.dist-info}/RECORD +9 -9
- {sunholo-0.76.3.dist-info → sunholo-0.76.4.dist-info}/LICENSE.txt +0 -0
- {sunholo-0.76.3.dist-info → sunholo-0.76.4.dist-info}/WHEEL +0 -0
- {sunholo-0.76.3.dist-info → sunholo-0.76.4.dist-info}/entry_points.txt +0 -0
- {sunholo-0.76.3.dist-info → sunholo-0.76.4.dist-info}/top_level.txt +0 -0
sunholo/auth/__init__.py
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
from .run import get_header
|
|
1
|
+
from .run import get_header, get_cloud_run_token
|
|
2
2
|
from .gcloud import get_local_gcloud_token
|
sunholo/auth/run.py
CHANGED
|
@@ -39,8 +39,7 @@ def get_id_token(url: str) -> str:
|
|
|
39
39
|
|
|
40
40
|
return get_local_gcloud_token()
|
|
41
41
|
|
|
42
|
-
|
|
43
|
-
def get_header(vector_name) -> Optional[dict]:
|
|
42
|
+
def get_cloud_run_token(vector_name):
|
|
44
43
|
if has_multivac_api_key():
|
|
45
44
|
|
|
46
45
|
return {"x-api-key": get_multivac_api_key()}
|
|
@@ -67,6 +66,12 @@ def get_header(vector_name) -> Optional[dict]:
|
|
|
67
66
|
}
|
|
68
67
|
log.info(f"Authenticating for run_url {run_url} from {caller_frame.f_code.co_name}")
|
|
69
68
|
id_token = get_id_token(run_url)
|
|
69
|
+
|
|
70
|
+
return id_token
|
|
71
|
+
|
|
72
|
+
def get_header(vector_name) -> Optional[dict]:
|
|
73
|
+
id_token = get_cloud_run_token(vector_name)
|
|
74
|
+
|
|
70
75
|
headers = {"Authorization": f"Bearer {id_token}"}
|
|
71
76
|
#log.info(f"id_token {id_token}")
|
|
72
77
|
return headers
|
|
@@ -7,6 +7,7 @@ from .init import init_vertex
|
|
|
7
7
|
from ..logging import log
|
|
8
8
|
from ..utils.gcp_project import get_gcp_project
|
|
9
9
|
from ..utils.parsers import validate_extension_id
|
|
10
|
+
from ..utils import ConfigManager
|
|
10
11
|
import base64
|
|
11
12
|
import json
|
|
12
13
|
from io import StringIO
|
|
@@ -248,7 +249,14 @@ class VertexAIExtensions:
|
|
|
248
249
|
|
|
249
250
|
return extension.resource_name
|
|
250
251
|
|
|
251
|
-
def execute_extension(
|
|
252
|
+
def execute_extension(
|
|
253
|
+
self,
|
|
254
|
+
operation_id: str,
|
|
255
|
+
operation_params: dict,
|
|
256
|
+
extension_id: str=None,
|
|
257
|
+
project_id: str=None,
|
|
258
|
+
vac: str=None):
|
|
259
|
+
|
|
252
260
|
init_vertex(location=self.location, project_id=project_id)
|
|
253
261
|
|
|
254
262
|
if not extension_id:
|
|
@@ -272,12 +280,21 @@ class VertexAIExtensions:
|
|
|
272
280
|
auth_config=None # on cloud run it sorts itself out via default creds(?)
|
|
273
281
|
|
|
274
282
|
if not is_running_on_cloudrun():
|
|
275
|
-
from ..auth import get_local_gcloud_token
|
|
283
|
+
from ..auth import get_local_gcloud_token, get_cloud_run_token
|
|
276
284
|
log.warning("Using local authentication via gcloud")
|
|
277
285
|
auth_config = {
|
|
278
286
|
"authType": "OAUTH",
|
|
279
287
|
"oauth_config": {"access_token": f"'{get_local_gcloud_token()}'"}
|
|
280
288
|
}
|
|
289
|
+
elif vac:
|
|
290
|
+
log.info(f"Using authentication via Cloud Run via {vac=}")
|
|
291
|
+
|
|
292
|
+
auth_config = {
|
|
293
|
+
"authType": "OAUTH",
|
|
294
|
+
"oauth_config": {"access_token": f"'{get_cloud_run_token(vac)}'"}
|
|
295
|
+
}
|
|
296
|
+
else:
|
|
297
|
+
log.warning("No vac configuration and not running locally so no authentication being set for this extension API call")
|
|
281
298
|
|
|
282
299
|
response = extension.execute(
|
|
283
300
|
operation_id=operation_id,
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: sunholo
|
|
3
|
-
Version: 0.76.
|
|
3
|
+
Version: 0.76.4
|
|
4
4
|
Summary: Large Language Model DevOps - a package to help deploy LLMs to the Cloud.
|
|
5
5
|
Home-page: https://github.com/sunholo-data/sunholo-py
|
|
6
|
-
Download-URL: https://github.com/sunholo-data/sunholo-py/archive/refs/tags/v0.76.
|
|
6
|
+
Download-URL: https://github.com/sunholo-data/sunholo-py/archive/refs/tags/v0.76.4.tar.gz
|
|
7
7
|
Author: Holosun ApS
|
|
8
8
|
Author-email: multivac@sunholo.com
|
|
9
9
|
License: Apache License, Version 2.0
|
|
@@ -17,10 +17,10 @@ sunholo/agents/flask/qna_routes.py,sha256=nY0NFgezxw1pEGUq49AIJ5nqIx4lLcUJAMD_FE
|
|
|
17
17
|
sunholo/agents/flask/vac_routes.py,sha256=l2-w7x437F0Uu3QvwNueEYPtnKuIee6bHJ7LUMt_tkY,19520
|
|
18
18
|
sunholo/archive/__init__.py,sha256=qNHWm5rGPVOlxZBZCpA1wTYPbalizRT7f8X4rs2t290,31
|
|
19
19
|
sunholo/archive/archive.py,sha256=C-UhG5x-XtZ8VheQp92IYJqgD0V3NFQjniqlit94t18,1197
|
|
20
|
-
sunholo/auth/__init__.py,sha256=
|
|
20
|
+
sunholo/auth/__init__.py,sha256=TeP-OY0XGxYV_8AQcVGoh35bvyWhNUcMRfhuD5l44Sk,91
|
|
21
21
|
sunholo/auth/gcloud.py,sha256=PdbwkuTdRi4RKBmgG9uwsReegqC4VG15_tw5uzmA7Fs,298
|
|
22
22
|
sunholo/auth/refresh.py,sha256=uOdT7oQRVl0YsUP__NXj6PdUdLyXFSv2ylwF283esuw,1831
|
|
23
|
-
sunholo/auth/run.py,sha256=
|
|
23
|
+
sunholo/auth/run.py,sha256=TMuJrgHKm_4Tu9GafX844LNjDwOFfbEJRr7ve7H87kg,2724
|
|
24
24
|
sunholo/azure/__init__.py,sha256=S1WQ5jndzNgzhSBh9UpX_yw7hRVm3hCzkAWNxUdK4dA,48
|
|
25
25
|
sunholo/azure/event_grid.py,sha256=Gky7D5a-xxMzbcst_wOFfcI8AH5qOzWbKbt5iqOTr6U,2606
|
|
26
26
|
sunholo/bots/__init__.py,sha256=EMFd7e2z68l6pzYOnkzHbLd2xJRvxTKFRNCTuhZ8hIw,130
|
|
@@ -120,13 +120,13 @@ sunholo/utils/timedelta.py,sha256=BbLabEx7_rbErj_YbNM0MBcaFN76DC4PTe4zD2ucezg,49
|
|
|
120
120
|
sunholo/utils/user_ids.py,sha256=SQd5_H7FE7vcTZp9AQuQDWBXd4FEEd7TeVMQe1H4Ny8,292
|
|
121
121
|
sunholo/utils/version.py,sha256=P1QAJQdZfT2cMqdTSmXmcxrD2PssMPEGM-WI6083Fck,237
|
|
122
122
|
sunholo/vertex/__init__.py,sha256=XH7FUKxdIgN9H2iDcWxL3sRnVHC3297G24RqEn4Ob0Y,240
|
|
123
|
-
sunholo/vertex/extensions_class.py,sha256=
|
|
123
|
+
sunholo/vertex/extensions_class.py,sha256=uWoLmIGjoSR4kiKpUrKwhQ8_ouyUNahBgKhKBeaxIu0,18378
|
|
124
124
|
sunholo/vertex/init.py,sha256=aLdNjrX3bUPfnWRhKUg5KUxSu0Qnq2YvuFNsgml4QEY,2866
|
|
125
125
|
sunholo/vertex/memory_tools.py,sha256=pomHrDKqvY8MZxfUqoEwhdlpCvSGP6KmFJMVKOimXjs,6842
|
|
126
126
|
sunholo/vertex/safety.py,sha256=S9PgQT1O_BQAkcqauWncRJaydiP8Q_Jzmu9gxYfy1VA,2482
|
|
127
|
-
sunholo-0.76.
|
|
128
|
-
sunholo-0.76.
|
|
129
|
-
sunholo-0.76.
|
|
130
|
-
sunholo-0.76.
|
|
131
|
-
sunholo-0.76.
|
|
132
|
-
sunholo-0.76.
|
|
127
|
+
sunholo-0.76.4.dist-info/LICENSE.txt,sha256=SdE3QjnD3GEmqqg9EX3TM9f7WmtOzqS1KJve8rhbYmU,11345
|
|
128
|
+
sunholo-0.76.4.dist-info/METADATA,sha256=rhp2wTZu8pxnx9XDd9nNBZgB82QBikrxRMZMnbngTTI,7136
|
|
129
|
+
sunholo-0.76.4.dist-info/WHEEL,sha256=Z4pYXqR_rTB7OWNDYFOm1qRk0RX6GFP2o8LgvP453Hk,91
|
|
130
|
+
sunholo-0.76.4.dist-info/entry_points.txt,sha256=bZuN5AIHingMPt4Ro1b_T-FnQvZ3teBes-3OyO0asl4,49
|
|
131
|
+
sunholo-0.76.4.dist-info/top_level.txt,sha256=wt5tadn5--5JrZsjJz2LceoUvcrIvxjHJe-RxuudxAk,8
|
|
132
|
+
sunholo-0.76.4.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|