sunholo 0.76.2__tar.gz → 0.76.3__tar.gz
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-0.76.2 → sunholo-0.76.3}/PKG-INFO +2 -2
- {sunholo-0.76.2 → sunholo-0.76.3}/setup.py +1 -1
- sunholo-0.76.3/sunholo/auth/refresh.py +55 -0
- {sunholo-0.76.2 → sunholo-0.76.3}/sunholo/cli/vertex.py +2 -2
- {sunholo-0.76.2 → sunholo-0.76.3}/sunholo/gcs/download_url.py +4 -30
- {sunholo-0.76.2 → sunholo-0.76.3}/sunholo/vertex/extensions_class.py +5 -4
- {sunholo-0.76.2 → sunholo-0.76.3}/sunholo/vertex/init.py +7 -2
- {sunholo-0.76.2 → sunholo-0.76.3}/sunholo.egg-info/PKG-INFO +2 -2
- {sunholo-0.76.2 → sunholo-0.76.3}/sunholo.egg-info/SOURCES.txt +1 -0
- {sunholo-0.76.2 → sunholo-0.76.3}/LICENSE.txt +0 -0
- {sunholo-0.76.2 → sunholo-0.76.3}/MANIFEST.in +0 -0
- {sunholo-0.76.2 → sunholo-0.76.3}/README.md +0 -0
- {sunholo-0.76.2 → sunholo-0.76.3}/setup.cfg +0 -0
- {sunholo-0.76.2 → sunholo-0.76.3}/sunholo/__init__.py +0 -0
- {sunholo-0.76.2 → sunholo-0.76.3}/sunholo/agents/__init__.py +0 -0
- {sunholo-0.76.2 → sunholo-0.76.3}/sunholo/agents/chat_history.py +0 -0
- {sunholo-0.76.2 → sunholo-0.76.3}/sunholo/agents/dispatch_to_qa.py +0 -0
- {sunholo-0.76.2 → sunholo-0.76.3}/sunholo/agents/fastapi/__init__.py +0 -0
- {sunholo-0.76.2 → sunholo-0.76.3}/sunholo/agents/fastapi/base.py +0 -0
- {sunholo-0.76.2 → sunholo-0.76.3}/sunholo/agents/fastapi/qna_routes.py +0 -0
- {sunholo-0.76.2 → sunholo-0.76.3}/sunholo/agents/flask/__init__.py +0 -0
- {sunholo-0.76.2 → sunholo-0.76.3}/sunholo/agents/flask/base.py +0 -0
- {sunholo-0.76.2 → sunholo-0.76.3}/sunholo/agents/flask/qna_routes.py +0 -0
- {sunholo-0.76.2 → sunholo-0.76.3}/sunholo/agents/flask/vac_routes.py +0 -0
- {sunholo-0.76.2 → sunholo-0.76.3}/sunholo/agents/langserve.py +0 -0
- {sunholo-0.76.2 → sunholo-0.76.3}/sunholo/agents/pubsub.py +0 -0
- {sunholo-0.76.2 → sunholo-0.76.3}/sunholo/agents/route.py +0 -0
- {sunholo-0.76.2 → sunholo-0.76.3}/sunholo/agents/special_commands.py +0 -0
- {sunholo-0.76.2 → sunholo-0.76.3}/sunholo/agents/swagger.py +0 -0
- {sunholo-0.76.2 → sunholo-0.76.3}/sunholo/archive/__init__.py +0 -0
- {sunholo-0.76.2 → sunholo-0.76.3}/sunholo/archive/archive.py +0 -0
- {sunholo-0.76.2 → sunholo-0.76.3}/sunholo/auth/__init__.py +0 -0
- {sunholo-0.76.2 → sunholo-0.76.3}/sunholo/auth/gcloud.py +0 -0
- {sunholo-0.76.2 → sunholo-0.76.3}/sunholo/auth/run.py +0 -0
- {sunholo-0.76.2 → sunholo-0.76.3}/sunholo/azure/__init__.py +0 -0
- {sunholo-0.76.2 → sunholo-0.76.3}/sunholo/azure/event_grid.py +0 -0
- {sunholo-0.76.2 → sunholo-0.76.3}/sunholo/bots/__init__.py +0 -0
- {sunholo-0.76.2 → sunholo-0.76.3}/sunholo/bots/discord.py +0 -0
- {sunholo-0.76.2 → sunholo-0.76.3}/sunholo/bots/github_webhook.py +0 -0
- {sunholo-0.76.2 → sunholo-0.76.3}/sunholo/bots/webapp.py +0 -0
- {sunholo-0.76.2 → sunholo-0.76.3}/sunholo/chunker/__init__.py +0 -0
- {sunholo-0.76.2 → sunholo-0.76.3}/sunholo/chunker/azure.py +0 -0
- {sunholo-0.76.2 → sunholo-0.76.3}/sunholo/chunker/doc_handling.py +0 -0
- {sunholo-0.76.2 → sunholo-0.76.3}/sunholo/chunker/images.py +0 -0
- {sunholo-0.76.2 → sunholo-0.76.3}/sunholo/chunker/loaders.py +0 -0
- {sunholo-0.76.2 → sunholo-0.76.3}/sunholo/chunker/message_data.py +0 -0
- {sunholo-0.76.2 → sunholo-0.76.3}/sunholo/chunker/pdfs.py +0 -0
- {sunholo-0.76.2 → sunholo-0.76.3}/sunholo/chunker/process_chunker_data.py +0 -0
- {sunholo-0.76.2 → sunholo-0.76.3}/sunholo/chunker/publish.py +0 -0
- {sunholo-0.76.2 → sunholo-0.76.3}/sunholo/chunker/pubsub.py +0 -0
- {sunholo-0.76.2 → sunholo-0.76.3}/sunholo/chunker/splitter.py +0 -0
- {sunholo-0.76.2 → sunholo-0.76.3}/sunholo/cli/__init__.py +0 -0
- {sunholo-0.76.2 → sunholo-0.76.3}/sunholo/cli/chat_vac.py +0 -0
- {sunholo-0.76.2 → sunholo-0.76.3}/sunholo/cli/cli.py +0 -0
- {sunholo-0.76.2 → sunholo-0.76.3}/sunholo/cli/cli_init.py +0 -0
- {sunholo-0.76.2 → sunholo-0.76.3}/sunholo/cli/configs.py +0 -0
- {sunholo-0.76.2 → sunholo-0.76.3}/sunholo/cli/deploy.py +0 -0
- {sunholo-0.76.2 → sunholo-0.76.3}/sunholo/cli/embedder.py +0 -0
- {sunholo-0.76.2 → sunholo-0.76.3}/sunholo/cli/merge_texts.py +0 -0
- {sunholo-0.76.2 → sunholo-0.76.3}/sunholo/cli/run_proxy.py +0 -0
- {sunholo-0.76.2 → sunholo-0.76.3}/sunholo/cli/sun_rich.py +0 -0
- {sunholo-0.76.2 → sunholo-0.76.3}/sunholo/cli/swagger.py +0 -0
- {sunholo-0.76.2 → sunholo-0.76.3}/sunholo/components/__init__.py +0 -0
- {sunholo-0.76.2 → sunholo-0.76.3}/sunholo/components/llm.py +0 -0
- {sunholo-0.76.2 → sunholo-0.76.3}/sunholo/components/retriever.py +0 -0
- {sunholo-0.76.2 → sunholo-0.76.3}/sunholo/components/vectorstore.py +0 -0
- {sunholo-0.76.2 → sunholo-0.76.3}/sunholo/database/__init__.py +0 -0
- {sunholo-0.76.2 → sunholo-0.76.3}/sunholo/database/alloydb.py +0 -0
- {sunholo-0.76.2 → sunholo-0.76.3}/sunholo/database/alloydb_client.py +0 -0
- {sunholo-0.76.2 → sunholo-0.76.3}/sunholo/database/database.py +0 -0
- {sunholo-0.76.2 → sunholo-0.76.3}/sunholo/database/lancedb.py +0 -0
- {sunholo-0.76.2 → sunholo-0.76.3}/sunholo/database/sql/sb/create_function.sql +0 -0
- {sunholo-0.76.2 → sunholo-0.76.3}/sunholo/database/sql/sb/create_function_time.sql +0 -0
- {sunholo-0.76.2 → sunholo-0.76.3}/sunholo/database/sql/sb/create_table.sql +0 -0
- {sunholo-0.76.2 → sunholo-0.76.3}/sunholo/database/sql/sb/delete_source_row.sql +0 -0
- {sunholo-0.76.2 → sunholo-0.76.3}/sunholo/database/sql/sb/return_sources.sql +0 -0
- {sunholo-0.76.2 → sunholo-0.76.3}/sunholo/database/sql/sb/setup.sql +0 -0
- {sunholo-0.76.2 → sunholo-0.76.3}/sunholo/database/static_dbs.py +0 -0
- {sunholo-0.76.2 → sunholo-0.76.3}/sunholo/database/uuid.py +0 -0
- {sunholo-0.76.2 → sunholo-0.76.3}/sunholo/discovery_engine/__init__.py +0 -0
- {sunholo-0.76.2 → sunholo-0.76.3}/sunholo/discovery_engine/chunker_handler.py +0 -0
- {sunholo-0.76.2 → sunholo-0.76.3}/sunholo/discovery_engine/create_new.py +0 -0
- {sunholo-0.76.2 → sunholo-0.76.3}/sunholo/discovery_engine/discovery_engine_client.py +0 -0
- {sunholo-0.76.2 → sunholo-0.76.3}/sunholo/embedder/__init__.py +0 -0
- {sunholo-0.76.2 → sunholo-0.76.3}/sunholo/embedder/embed_chunk.py +0 -0
- {sunholo-0.76.2 → sunholo-0.76.3}/sunholo/gcs/__init__.py +0 -0
- {sunholo-0.76.2 → sunholo-0.76.3}/sunholo/gcs/add_file.py +0 -0
- {sunholo-0.76.2 → sunholo-0.76.3}/sunholo/gcs/metadata.py +0 -0
- {sunholo-0.76.2 → sunholo-0.76.3}/sunholo/invoke/__init__.py +0 -0
- {sunholo-0.76.2 → sunholo-0.76.3}/sunholo/invoke/invoke_vac_utils.py +0 -0
- {sunholo-0.76.2 → sunholo-0.76.3}/sunholo/langfuse/__init__.py +0 -0
- {sunholo-0.76.2 → sunholo-0.76.3}/sunholo/langfuse/callback.py +0 -0
- {sunholo-0.76.2 → sunholo-0.76.3}/sunholo/langfuse/prompts.py +0 -0
- {sunholo-0.76.2 → sunholo-0.76.3}/sunholo/llamaindex/__init__.py +0 -0
- {sunholo-0.76.2 → sunholo-0.76.3}/sunholo/llamaindex/generate.py +0 -0
- {sunholo-0.76.2 → sunholo-0.76.3}/sunholo/llamaindex/get_files.py +0 -0
- {sunholo-0.76.2 → sunholo-0.76.3}/sunholo/llamaindex/import_files.py +0 -0
- {sunholo-0.76.2 → sunholo-0.76.3}/sunholo/logging.py +0 -0
- {sunholo-0.76.2 → sunholo-0.76.3}/sunholo/lookup/__init__.py +0 -0
- {sunholo-0.76.2 → sunholo-0.76.3}/sunholo/lookup/model_lookup.yaml +0 -0
- {sunholo-0.76.2 → sunholo-0.76.3}/sunholo/patches/__init__.py +0 -0
- {sunholo-0.76.2 → sunholo-0.76.3}/sunholo/patches/langchain/__init__.py +0 -0
- {sunholo-0.76.2 → sunholo-0.76.3}/sunholo/patches/langchain/lancedb.py +0 -0
- {sunholo-0.76.2 → sunholo-0.76.3}/sunholo/patches/langchain/vertexai.py +0 -0
- {sunholo-0.76.2 → sunholo-0.76.3}/sunholo/pubsub/__init__.py +0 -0
- {sunholo-0.76.2 → sunholo-0.76.3}/sunholo/pubsub/process_pubsub.py +0 -0
- {sunholo-0.76.2 → sunholo-0.76.3}/sunholo/pubsub/pubsub_manager.py +0 -0
- {sunholo-0.76.2 → sunholo-0.76.3}/sunholo/qna/__init__.py +0 -0
- {sunholo-0.76.2 → sunholo-0.76.3}/sunholo/qna/parsers.py +0 -0
- {sunholo-0.76.2 → sunholo-0.76.3}/sunholo/qna/retry.py +0 -0
- {sunholo-0.76.2 → sunholo-0.76.3}/sunholo/streaming/__init__.py +0 -0
- {sunholo-0.76.2 → sunholo-0.76.3}/sunholo/streaming/content_buffer.py +0 -0
- {sunholo-0.76.2 → sunholo-0.76.3}/sunholo/streaming/langserve.py +0 -0
- {sunholo-0.76.2 → sunholo-0.76.3}/sunholo/streaming/stream_lookup.py +0 -0
- {sunholo-0.76.2 → sunholo-0.76.3}/sunholo/streaming/streaming.py +0 -0
- {sunholo-0.76.2 → sunholo-0.76.3}/sunholo/summarise/__init__.py +0 -0
- {sunholo-0.76.2 → sunholo-0.76.3}/sunholo/summarise/summarise.py +0 -0
- {sunholo-0.76.2 → sunholo-0.76.3}/sunholo/tools/__init__.py +0 -0
- {sunholo-0.76.2 → sunholo-0.76.3}/sunholo/tools/web_browser.py +0 -0
- {sunholo-0.76.2 → sunholo-0.76.3}/sunholo/utils/__init__.py +0 -0
- {sunholo-0.76.2 → sunholo-0.76.3}/sunholo/utils/api_key.py +0 -0
- {sunholo-0.76.2 → sunholo-0.76.3}/sunholo/utils/big_context.py +0 -0
- {sunholo-0.76.2 → sunholo-0.76.3}/sunholo/utils/config.py +0 -0
- {sunholo-0.76.2 → sunholo-0.76.3}/sunholo/utils/config_class.py +0 -0
- {sunholo-0.76.2 → sunholo-0.76.3}/sunholo/utils/config_schema.py +0 -0
- {sunholo-0.76.2 → sunholo-0.76.3}/sunholo/utils/gcp.py +0 -0
- {sunholo-0.76.2 → sunholo-0.76.3}/sunholo/utils/gcp_project.py +0 -0
- {sunholo-0.76.2 → sunholo-0.76.3}/sunholo/utils/parsers.py +0 -0
- {sunholo-0.76.2 → sunholo-0.76.3}/sunholo/utils/timedelta.py +0 -0
- {sunholo-0.76.2 → sunholo-0.76.3}/sunholo/utils/user_ids.py +0 -0
- {sunholo-0.76.2 → sunholo-0.76.3}/sunholo/utils/version.py +0 -0
- {sunholo-0.76.2 → sunholo-0.76.3}/sunholo/vertex/__init__.py +0 -0
- {sunholo-0.76.2 → sunholo-0.76.3}/sunholo/vertex/memory_tools.py +0 -0
- {sunholo-0.76.2 → sunholo-0.76.3}/sunholo/vertex/safety.py +0 -0
- {sunholo-0.76.2 → sunholo-0.76.3}/sunholo.egg-info/dependency_links.txt +0 -0
- {sunholo-0.76.2 → sunholo-0.76.3}/sunholo.egg-info/entry_points.txt +0 -0
- {sunholo-0.76.2 → sunholo-0.76.3}/sunholo.egg-info/requires.txt +0 -0
- {sunholo-0.76.2 → sunholo-0.76.3}/sunholo.egg-info/top_level.txt +0 -0
- {sunholo-0.76.2 → sunholo-0.76.3}/tests/test_chat_history.py +0 -0
- {sunholo-0.76.2 → sunholo-0.76.3}/tests/test_config.py +0 -0
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: sunholo
|
|
3
|
-
Version: 0.76.
|
|
3
|
+
Version: 0.76.3
|
|
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.3.tar.gz
|
|
7
7
|
Author: Holosun ApS
|
|
8
8
|
Author-email: multivac@sunholo.com
|
|
9
9
|
License: Apache License, Version 2.0
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
# needs to be in minimal to check gcp
|
|
2
|
+
import os
|
|
3
|
+
|
|
4
|
+
import google.auth
|
|
5
|
+
from google.auth.transport import requests
|
|
6
|
+
from ..utils.gcp import is_running_on_gcp
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
from ..logging import log
|
|
10
|
+
|
|
11
|
+
def get_default_email():
|
|
12
|
+
if not refresh_credentials():
|
|
13
|
+
log.error("Could not refresh the credentials properly.")
|
|
14
|
+
return None
|
|
15
|
+
# https://stackoverflow.com/questions/64234214/how-to-generate-a-blob-signed-url-in-google-cloud-run
|
|
16
|
+
|
|
17
|
+
gcs_credentials, project_id = get_default_creds()
|
|
18
|
+
|
|
19
|
+
service_account_email = getattr(gcs_credentials, 'service_account_email', None)
|
|
20
|
+
# If you use a service account credential, you can use the embedded email
|
|
21
|
+
if not service_account_email:
|
|
22
|
+
service_account_email = os.getenv('GCS_MAIL_USER')
|
|
23
|
+
if not service_account_email:
|
|
24
|
+
log.error("Could not create the credentials for signed requests - no credentials.service_account_email or GCS_MAIL_USER with roles/iam.serviceAccountTokenCreator")
|
|
25
|
+
|
|
26
|
+
return None
|
|
27
|
+
|
|
28
|
+
log.info(f"Found default email: {service_account_email=} for {project_id=}")
|
|
29
|
+
return service_account_email
|
|
30
|
+
|
|
31
|
+
def get_default_creds():
|
|
32
|
+
gcs_credentials = None
|
|
33
|
+
project_id = None
|
|
34
|
+
gcs_credentials, project_id = google.auth.default()
|
|
35
|
+
|
|
36
|
+
return gcs_credentials, project_id
|
|
37
|
+
|
|
38
|
+
def refresh_credentials():
|
|
39
|
+
if not is_running_on_gcp():
|
|
40
|
+
log.debug("Not running on Google Cloud so no credentials available for GCS.")
|
|
41
|
+
return False
|
|
42
|
+
|
|
43
|
+
gcs_credentials, project_id = get_default_creds()
|
|
44
|
+
|
|
45
|
+
if not gcs_credentials.token or gcs_credentials.expired or not gcs_credentials.valid:
|
|
46
|
+
try:
|
|
47
|
+
gcs_credentials.refresh(requests.Request())
|
|
48
|
+
|
|
49
|
+
return True
|
|
50
|
+
|
|
51
|
+
except Exception as e:
|
|
52
|
+
log.error(f"Failed to refresh gcs credentials: {e}")
|
|
53
|
+
|
|
54
|
+
return False
|
|
55
|
+
|
|
@@ -3,8 +3,8 @@ from ..vertex import VertexAIExtensions
|
|
|
3
3
|
from .sun_rich import console
|
|
4
4
|
|
|
5
5
|
def deploy_extension(args):
|
|
6
|
-
vex = VertexAIExtensions()
|
|
7
|
-
console.rule(f"Creating Vertex extension '{args.display_name}'")
|
|
6
|
+
vex = VertexAIExtensions(args.project)
|
|
7
|
+
console.rule(f"Creating Vertex extension '{args.display_name}' within '{args.project}'")
|
|
8
8
|
|
|
9
9
|
vex.create_extension(
|
|
10
10
|
args.display_name,
|
|
@@ -3,8 +3,6 @@ from urllib.parse import quote
|
|
|
3
3
|
from datetime import datetime, timedelta
|
|
4
4
|
|
|
5
5
|
# needs to be in minimal to check gcp
|
|
6
|
-
import google.auth
|
|
7
|
-
from google.auth.transport import requests
|
|
8
6
|
from google.auth.exceptions import RefreshError
|
|
9
7
|
|
|
10
8
|
try:
|
|
@@ -14,6 +12,7 @@ except ImportError:
|
|
|
14
12
|
|
|
15
13
|
from ..logging import log
|
|
16
14
|
from ..utils.gcp import is_running_on_gcp
|
|
15
|
+
from ..auth.refresh import refresh_credentials, get_default_creds, get_default_email
|
|
17
16
|
from io import BytesIO
|
|
18
17
|
try:
|
|
19
18
|
from PIL import Image
|
|
@@ -77,47 +76,22 @@ def get_bytes_from_gcs(gs_uri):
|
|
|
77
76
|
|
|
78
77
|
if is_running_on_gcp():
|
|
79
78
|
# Perform a refresh request to get the access token of the current credentials (Else, it's None)
|
|
80
|
-
gcs_credentials, project_id =
|
|
79
|
+
gcs_credentials, project_id = get_default_creds()
|
|
81
80
|
# Prepare global variables for client reuse
|
|
82
81
|
if storage:
|
|
83
82
|
gcs_client = storage.Client()
|
|
84
83
|
|
|
85
|
-
def refresh_credentials():
|
|
86
|
-
if not is_running_on_gcp():
|
|
87
|
-
log.debug("Not running on Google Cloud so no credentials available for GCS.")
|
|
88
|
-
return False
|
|
89
|
-
if not gcs_credentials.token or gcs_credentials.expired or not gcs_credentials.valid:
|
|
90
|
-
try:
|
|
91
|
-
gcs_credentials.refresh(requests.Request())
|
|
92
|
-
except Exception as e:
|
|
93
|
-
log.error(f"Failed to refresh gcs credentials: {e}")
|
|
94
|
-
return False
|
|
95
|
-
return True
|
|
96
|
-
|
|
97
|
-
refresh_credentials()
|
|
98
|
-
|
|
99
84
|
def get_bucket(bucket_name):
|
|
100
85
|
if bucket_name not in gcs_bucket_cache:
|
|
101
86
|
gcs_bucket_cache[bucket_name] = gcs_client.get_bucket(bucket_name)
|
|
102
87
|
return gcs_bucket_cache[bucket_name]
|
|
103
88
|
|
|
104
89
|
def sign_gcs_url(bucket_name:str, object_name:str, expiry_secs = 86400):
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
return None
|
|
108
|
-
# https://stackoverflow.com/questions/64234214/how-to-generate-a-blob-signed-url-in-google-cloud-run
|
|
90
|
+
|
|
91
|
+
service_account_email = get_default_email()
|
|
109
92
|
|
|
110
93
|
expires = datetime.now() + timedelta(seconds=expiry_secs)
|
|
111
94
|
|
|
112
|
-
service_account_email = getattr(gcs_credentials, 'service_account_email', None)
|
|
113
|
-
# If you use a service account credential, you can use the embedded email
|
|
114
|
-
if not service_account_email:
|
|
115
|
-
service_account_email = os.getenv('GCS_MAIL_USER')
|
|
116
|
-
if service_account_email is None:
|
|
117
|
-
log.error("For local testing must set a GCS_MAIL_USER to sign GCS URLs")
|
|
118
|
-
log.error("Could not create the credentials for signed requests - no credentials.service_account_email or GCS_MAIL_USER with roles/iam.serviceAccountTokenCreator")
|
|
119
|
-
return None
|
|
120
|
-
|
|
121
95
|
try:
|
|
122
96
|
bucket = get_bucket(bucket_name)
|
|
123
97
|
blob = bucket.blob(object_name)
|
|
@@ -50,7 +50,7 @@ class VertexAIExtensions:
|
|
|
50
50
|
operation_params = operation_params)
|
|
51
51
|
```
|
|
52
52
|
"""
|
|
53
|
-
def __init__(self):
|
|
53
|
+
def __init__(self, project_id=None):
|
|
54
54
|
if extensions is None:
|
|
55
55
|
raise ImportError("VertexAIExtensions needs vertexai.previewextensions to be installed. Install via `pip install sunholo[gcp]`")
|
|
56
56
|
|
|
@@ -70,6 +70,7 @@ class VertexAIExtensions:
|
|
|
70
70
|
self.manifest = {}
|
|
71
71
|
self.created_extensions = []
|
|
72
72
|
self.bucket_name = os.getenv('EXTENSIONS_BUCKET')
|
|
73
|
+
init_vertex(location=self.location, project_id=project_id)
|
|
73
74
|
|
|
74
75
|
def list_extensions(self, project_id:str=None):
|
|
75
76
|
project_id = project_id or get_gcp_project()
|
|
@@ -113,7 +114,7 @@ class VertexAIExtensions:
|
|
|
113
114
|
raise ValueError('Please specify env var EXTENSIONS_BUCKET for location to upload openapi spec')
|
|
114
115
|
|
|
115
116
|
|
|
116
|
-
self.openapi_file_gcs = self.upload_to_gcs(filename
|
|
117
|
+
self.openapi_file_gcs = self.upload_to_gcs(filename)
|
|
117
118
|
|
|
118
119
|
def load_tool_use_examples(self, filename: str):
|
|
119
120
|
import yaml
|
|
@@ -211,7 +212,7 @@ class VertexAIExtensions:
|
|
|
211
212
|
log.info(f"Setting extension bucket name to {bucket_name}")
|
|
212
213
|
self.bucket_name = bucket_name
|
|
213
214
|
|
|
214
|
-
listed_extensions = self.list_extensions()
|
|
215
|
+
listed_extensions = self.list_extensions(project_id)
|
|
215
216
|
log.info(f"Listing extensions:\n {listed_extensions}")
|
|
216
217
|
for ext in listed_extensions:
|
|
217
218
|
if ext.get('display_name') == display_name:
|
|
@@ -248,7 +249,7 @@ class VertexAIExtensions:
|
|
|
248
249
|
return extension.resource_name
|
|
249
250
|
|
|
250
251
|
def execute_extension(self, operation_id: str, operation_params: dict, extension_id: str=None, project_id: str=None):
|
|
251
|
-
init_vertex(location=self.location)
|
|
252
|
+
init_vertex(location=self.location, project_id=project_id)
|
|
252
253
|
|
|
253
254
|
if not extension_id:
|
|
254
255
|
extension_name = self.created_extension.resource_name
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
from ..logging import log
|
|
2
2
|
from ..utils.gcp_project import get_gcp_project
|
|
3
|
+
from ..auth.refresh import get_default_email
|
|
3
4
|
import os
|
|
4
5
|
|
|
5
6
|
def init_genai():
|
|
@@ -19,7 +20,7 @@ def init_genai():
|
|
|
19
20
|
|
|
20
21
|
genai.configure(api_key=GOOGLE_API_KEY)
|
|
21
22
|
|
|
22
|
-
def init_vertex(gcp_config=None, location="eu"):
|
|
23
|
+
def init_vertex(gcp_config=None, location="eu", project_id=None):
|
|
23
24
|
"""
|
|
24
25
|
Initializes the Vertex AI environment using the provided Google Cloud Platform configuration.
|
|
25
26
|
|
|
@@ -62,6 +63,10 @@ def init_vertex(gcp_config=None, location="eu"):
|
|
|
62
63
|
project_id = gcp_config.get('project_id')
|
|
63
64
|
location = gcp_config.get('location') or location
|
|
64
65
|
else:
|
|
65
|
-
project_id = get_gcp_project()
|
|
66
|
+
project_id = project_id or get_gcp_project()
|
|
67
|
+
|
|
68
|
+
log.info(f"Auth with email: {get_default_email()} in {project_id}")
|
|
66
69
|
|
|
67
70
|
vertexai.init(project=project_id, location=location)
|
|
71
|
+
|
|
72
|
+
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: sunholo
|
|
3
|
-
Version: 0.76.
|
|
3
|
+
Version: 0.76.3
|
|
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.3.tar.gz
|
|
7
7
|
Author: Holosun ApS
|
|
8
8
|
Author-email: multivac@sunholo.com
|
|
9
9
|
License: Apache License, Version 2.0
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|