sunholo 0.69.4__py3-none-any.whl → 0.69.5__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/discovery_engine/chunker_handler.py +20 -9
- sunholo/discovery_engine/discovery_engine_client.py +2 -1
- {sunholo-0.69.4.dist-info → sunholo-0.69.5.dist-info}/METADATA +2 -2
- {sunholo-0.69.4.dist-info → sunholo-0.69.5.dist-info}/RECORD +8 -8
- {sunholo-0.69.4.dist-info → sunholo-0.69.5.dist-info}/LICENSE.txt +0 -0
- {sunholo-0.69.4.dist-info → sunholo-0.69.5.dist-info}/WHEEL +0 -0
- {sunholo-0.69.4.dist-info → sunholo-0.69.5.dist-info}/entry_points.txt +0 -0
- {sunholo-0.69.4.dist-info → sunholo-0.69.5.dist-info}/top_level.txt +0 -0
|
@@ -3,6 +3,7 @@ from ..utils.config import load_config_key
|
|
|
3
3
|
from ..components import load_memories
|
|
4
4
|
|
|
5
5
|
from .discovery_engine_client import DiscoveryEngineClient
|
|
6
|
+
from .create_new import create_new_discovery_engine
|
|
6
7
|
|
|
7
8
|
|
|
8
9
|
def do_discovery_engine(message_data, metadata, vector_name):
|
|
@@ -19,14 +20,11 @@ def do_discovery_engine(message_data, metadata, vector_name):
|
|
|
19
20
|
```
|
|
20
21
|
"""
|
|
21
22
|
|
|
23
|
+
global_gcp_config = load_config_key("gcp_config", vector_name="global", kind="vacConfig")
|
|
22
24
|
gcp_config = load_config_key("gcp_config", vector_name=vector_name, kind="vacConfig")
|
|
23
|
-
if not gcp_config:
|
|
25
|
+
if not gcp_config and not global_gcp_config:
|
|
24
26
|
raise ValueError(f"Need config.{vector_name}.gcp_config to configure discovery engine")
|
|
25
27
|
|
|
26
|
-
global_project_id = gcp_config.get('project_id')
|
|
27
|
-
#global_location = gcp_config.get('location')
|
|
28
|
-
global_data_store_id = gcp_config.get('data_store_id')
|
|
29
|
-
|
|
30
28
|
memories = load_memories(vector_name)
|
|
31
29
|
tools = []
|
|
32
30
|
|
|
@@ -40,12 +38,11 @@ def do_discovery_engine(message_data, metadata, vector_name):
|
|
|
40
38
|
vectorstore = value.get('vectorstore')
|
|
41
39
|
if vectorstore == "discovery_engine" or vectorstore == "vertex_ai_search":
|
|
42
40
|
log.info(f"Found vectorstore {vectorstore}")
|
|
43
|
-
|
|
44
|
-
project_id = gcp_config.get('project_id')
|
|
41
|
+
project_id = gcp_config.get('project_id') or global_gcp_config['project_id']
|
|
45
42
|
#location = gcp_config.get('location')
|
|
46
43
|
corpus = DiscoveryEngineClient(
|
|
47
|
-
data_store_id=
|
|
48
|
-
project_id=project_id
|
|
44
|
+
data_store_id=vector_name,
|
|
45
|
+
project_id=project_id,
|
|
49
46
|
# location needs to be 'eu' or 'us' which doesn't work with other configurations
|
|
50
47
|
#location=location or global_location
|
|
51
48
|
)
|
|
@@ -67,6 +64,20 @@ def do_discovery_engine(message_data, metadata, vector_name):
|
|
|
67
64
|
log.info(f"Imported file to corpus: {response} with metadata: {metadata}")
|
|
68
65
|
except Exception as err:
|
|
69
66
|
log.error(f"Error importing {message_data} - {corp=} - {str(err)}")
|
|
67
|
+
|
|
68
|
+
if str(err).startswith("404"):
|
|
69
|
+
log.info(f"Attempting to create a new DiscoveryEngine corpus: {vector_name}")
|
|
70
|
+
try:
|
|
71
|
+
new_corp = create_new_discovery_engine(vector_name)
|
|
72
|
+
except Exception as err:
|
|
73
|
+
log.error(f"Failed to create new DiscoveryEngine {vector_name} - {str(err)}")
|
|
74
|
+
continue
|
|
75
|
+
if new_corp:
|
|
76
|
+
log.info(f"Found new DiscoveryEngine {vector_name=} - {new_corp=}")
|
|
77
|
+
response = corp.import_documents(
|
|
78
|
+
gcs_uri=message_data
|
|
79
|
+
)
|
|
80
|
+
|
|
70
81
|
continue
|
|
71
82
|
|
|
72
83
|
metadata["source"] = message_data
|
|
@@ -124,8 +124,9 @@ class DiscoveryEngineClient:
|
|
|
124
124
|
# Make the request
|
|
125
125
|
operation = self.store_client.create_data_store(request=request)
|
|
126
126
|
|
|
127
|
-
log.info(f"Waiting for operation to complete: {operation.operation.name}")
|
|
127
|
+
log.info(f"Waiting for datastore operation to complete: {operation.operation.name}")
|
|
128
128
|
response = operation.result()
|
|
129
|
+
log.info(f"Datastore operation creation complete: {response=}")
|
|
129
130
|
|
|
130
131
|
# Once the operation is complete,
|
|
131
132
|
# get information from operation metadata
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: sunholo
|
|
3
|
-
Version: 0.69.
|
|
3
|
+
Version: 0.69.5
|
|
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.69.
|
|
6
|
+
Download-URL: https://github.com/sunholo-data/sunholo-py/archive/refs/tags/v0.69.5.tar.gz
|
|
7
7
|
Author: Holosun ApS
|
|
8
8
|
Author-email: multivac@sunholo.com
|
|
9
9
|
License: Apache License, Version 2.0
|
|
@@ -61,9 +61,9 @@ sunholo/database/sql/sb/delete_source_row.sql,sha256=r6fEuUKdbiLHCDGKSbKINDCpJjs
|
|
|
61
61
|
sunholo/database/sql/sb/return_sources.sql,sha256=89KAnxfK8n_qGK9jy1OQT8f9n4uYUtYL5cCxbC2mj_c,255
|
|
62
62
|
sunholo/database/sql/sb/setup.sql,sha256=CvoFvZQev2uWjmFa3aj3m3iuPFzAAJZ0S7Qi3L3-zZI,89
|
|
63
63
|
sunholo/discovery_engine/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
64
|
-
sunholo/discovery_engine/chunker_handler.py,sha256=
|
|
64
|
+
sunholo/discovery_engine/chunker_handler.py,sha256=eqRI8R-AVIhtqpzw62glCucvX_r1MXzdrF_DAKcPhtM,4793
|
|
65
65
|
sunholo/discovery_engine/create_new.py,sha256=6sowAvblLDBZq6skYwdc6n99YlyHvNLaIs6kYMnkdO8,921
|
|
66
|
-
sunholo/discovery_engine/discovery_engine_client.py,sha256=
|
|
66
|
+
sunholo/discovery_engine/discovery_engine_client.py,sha256=PDoRO-6uc9u3lYUy6oUc-jbgxijfJMNaitScoz5nUCk,11775
|
|
67
67
|
sunholo/embedder/__init__.py,sha256=sI4N_CqgEVcrMDxXgxKp1FsfsB4FpjoXgPGkl4N_u4I,44
|
|
68
68
|
sunholo/embedder/embed_chunk.py,sha256=P744zUQJgqrjILunzaqtTerB9AwoXFU6tXBtz4rjWgQ,6673
|
|
69
69
|
sunholo/gcs/__init__.py,sha256=DtVw_AZwQn-IguR5BJuIi2XJeF_FQXizhJikzRNrXiE,50
|
|
@@ -111,9 +111,9 @@ sunholo/vertex/__init__.py,sha256=JvHcGFuv6R_nAhY2AdoqqhMpJ5ugeWPZ_svGhWrObBk,13
|
|
|
111
111
|
sunholo/vertex/init.py,sha256=JDMUaBRdednzbKF-5p33qqLit2LMsvgvWW-NRz0AqO0,1801
|
|
112
112
|
sunholo/vertex/memory_tools.py,sha256=8F1iTWnqEK9mX4W5RzCVKIjydIcNp6OFxjn_dtQ3GXo,5379
|
|
113
113
|
sunholo/vertex/safety.py,sha256=3meAX0HyGZYrH7rXPUAHxtI_3w_zoy_RX7Shtkoa660,1275
|
|
114
|
-
sunholo-0.69.
|
|
115
|
-
sunholo-0.69.
|
|
116
|
-
sunholo-0.69.
|
|
117
|
-
sunholo-0.69.
|
|
118
|
-
sunholo-0.69.
|
|
119
|
-
sunholo-0.69.
|
|
114
|
+
sunholo-0.69.5.dist-info/LICENSE.txt,sha256=SdE3QjnD3GEmqqg9EX3TM9f7WmtOzqS1KJve8rhbYmU,11345
|
|
115
|
+
sunholo-0.69.5.dist-info/METADATA,sha256=z_-h8LDKsg8u64WDv7MY41Id1MYczH7HJabwdfOeW5Y,6155
|
|
116
|
+
sunholo-0.69.5.dist-info/WHEEL,sha256=mguMlWGMX-VHnMpKOjjQidIo1ssRlCFu4a4mBpz1s2M,91
|
|
117
|
+
sunholo-0.69.5.dist-info/entry_points.txt,sha256=bZuN5AIHingMPt4Ro1b_T-FnQvZ3teBes-3OyO0asl4,49
|
|
118
|
+
sunholo-0.69.5.dist-info/top_level.txt,sha256=wt5tadn5--5JrZsjJz2LceoUvcrIvxjHJe-RxuudxAk,8
|
|
119
|
+
sunholo-0.69.5.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|