sunholo 0.71.6__py3-none-any.whl → 0.71.10__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.
@@ -0,0 +1 @@
1
+ from .discovery_engine_client import DiscoveryEngineClient
@@ -11,7 +11,7 @@ except ImportError:
11
11
  SearchResponse = None
12
12
 
13
13
  from ..logging import log
14
- from typing import Optional
14
+ from typing import Optional, List
15
15
 
16
16
  class DiscoveryEngineClient:
17
17
  """
@@ -69,6 +69,7 @@ class DiscoveryEngineClient:
69
69
  self.store_client = discoveryengine.DataStoreServiceClient(client_options=client_options)
70
70
  self.doc_client = discoveryengine.DocumentServiceClient(client_options=client_options)
71
71
  self.search_client = discoveryengine.SearchServiceClient(client_options=client_options)
72
+ self.engine_client = discoveryengine.EngineServiceClient(client_options=client_options)
72
73
 
73
74
  @classmethod
74
75
  def my_retry(cls):
@@ -261,6 +262,59 @@ class DiscoveryEngineClient:
261
262
  result_string = "\n".join(all_chunks)
262
263
 
263
264
  return result_string
265
+
266
+ def create_engine(self,
267
+ engine_id: str,
268
+ data_store_ids: List[str],
269
+ solution_type=None,
270
+ search_tier=None,
271
+ search_add_ons=None,
272
+ ) -> str:
273
+
274
+ # The full resource name of the collection
275
+ # e.g. projects/{project}/locations/{location}/collections/default_collection
276
+ parent = self.data_store_path()
277
+
278
+ engine = discoveryengine.Engine(
279
+ display_name=engine_id,
280
+ # Options: GENERIC, MEDIA, HEALTHCARE_FHIR
281
+ industry_vertical=discoveryengine.IndustryVertical.GENERIC,
282
+ # Options: SOLUTION_TYPE_RECOMMENDATION, SOLUTION_TYPE_SEARCH, SOLUTION_TYPE_CHAT, SOLUTION_TYPE_GENERATIVE_CHAT
283
+ solution_type=solution_type or discoveryengine.SolutionType.SOLUTION_TYPE_SEARCH,
284
+ # For search apps only
285
+ search_engine_config=discoveryengine.Engine.SearchEngineConfig(
286
+ # Options: SEARCH_TIER_STANDARD, SEARCH_TIER_ENTERPRISE
287
+ search_tier=search_tier or discoveryengine.SearchTier.SEARCH_TIER_ENTERPRISE,
288
+ # Options: SEARCH_ADD_ON_LLM, SEARCH_ADD_ON_UNSPECIFIED
289
+ search_add_ons=search_add_ons or [discoveryengine.SearchAddOn.SEARCH_ADD_ON_UNSPECIFIED],
290
+ ),
291
+ # For generic recommendation apps only
292
+ # similar_documents_config=discoveryengine.Engine.SimilarDocumentsEngineConfig,
293
+ data_store_ids=data_store_ids,
294
+ )
295
+
296
+ request = discoveryengine.CreateEngineRequest(
297
+ parent=parent,
298
+ engine=engine,
299
+ engine_id=engine_id,
300
+ )
301
+
302
+ # Make the request
303
+ operation = self.engine_client.create_engine(request=request)
304
+
305
+ log.info(f"Waiting for create vertex ai search operation to complete: {operation.operation.name}")
306
+ response = operation.result()
307
+
308
+ # Once the operation is complete,
309
+ # get information from operation metadata
310
+ metadata = discoveryengine.CreateEngineMetadata(operation.metadata)
311
+
312
+ # Handle the response
313
+ log.info(f"{response=} {metadata=}")
314
+
315
+ return operation.operation.name
316
+
317
+
264
318
 
265
319
  def import_documents(self,
266
320
  gcs_uri: Optional[str] = None,
@@ -1,9 +1,9 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: sunholo
3
- Version: 0.71.6
3
+ Version: 0.71.10
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.71.6.tar.gz
6
+ Download-URL: https://github.com/sunholo-data/sunholo-py/archive/refs/tags/v0.71.10.tar.gz
7
7
  Author: Holosun ApS
8
8
  Author-email: multivac@sunholo.com
9
9
  License: Apache License, Version 2.0
@@ -60,10 +60,10 @@ sunholo/database/sql/sb/create_table.sql,sha256=SbcOrf5tUiVKGUohu1lau7IsbDRbTFbr
60
60
  sunholo/database/sql/sb/delete_source_row.sql,sha256=r6fEuUKdbiLHCDGKSbKINDCpJjsmfHZNNOo1ptwLLSo,75
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
- sunholo/discovery_engine/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
63
+ sunholo/discovery_engine/__init__.py,sha256=qUKWzuHApDRJIUoynukVdGRBEq8eC9T7l9a3bWckgI0,59
64
64
  sunholo/discovery_engine/chunker_handler.py,sha256=H1HHDqWMCkchJER1_oU9TOLxqf2PygiMO6CL3uKZP64,4563
65
65
  sunholo/discovery_engine/create_new.py,sha256=7oZG78T6lW0EspRzlo7-qRyXFSuFxDn2dfSAVEaqlqY,978
66
- sunholo/discovery_engine/discovery_engine_client.py,sha256=cUdyXdXvFS_IxNqwJkGdGpXH-k18MQDKuUFn_7E7pKo,14922
66
+ sunholo/discovery_engine/discovery_engine_client.py,sha256=-e3rzmqYcVmb-Q7scq-ae1NF7hQGfJCIU1ym2Cu2u6g,17167
67
67
  sunholo/embedder/__init__.py,sha256=sI4N_CqgEVcrMDxXgxKp1FsfsB4FpjoXgPGkl4N_u4I,44
68
68
  sunholo/embedder/embed_chunk.py,sha256=d_dIzeNF630Q0Ar-u1hxos60s0tLIImJccAvuo_LTIw,6814
69
69
  sunholo/gcs/__init__.py,sha256=DtVw_AZwQn-IguR5BJuIi2XJeF_FQXizhJikzRNrXiE,50
@@ -113,9 +113,9 @@ sunholo/vertex/extensions_class.py,sha256=0-XMrMvfhMN380ZdGXl11Mt7R9kCu9rB4Vduif
113
113
  sunholo/vertex/init.py,sha256=RLjQppTUwubWgwf2PoAke-EtcwlVkFPaPMYvUsMw1KQ,2029
114
114
  sunholo/vertex/memory_tools.py,sha256=sipBI7TFttbYzobSWS_1TzWFVTPnJckz3NvLVbTepMc,6345
115
115
  sunholo/vertex/safety.py,sha256=3meAX0HyGZYrH7rXPUAHxtI_3w_zoy_RX7Shtkoa660,1275
116
- sunholo-0.71.6.dist-info/LICENSE.txt,sha256=SdE3QjnD3GEmqqg9EX3TM9f7WmtOzqS1KJve8rhbYmU,11345
117
- sunholo-0.71.6.dist-info/METADATA,sha256=mF32bponOP0fNr7dvWPiIWOAlTf1-csaIxTIy_oSBDA,6613
118
- sunholo-0.71.6.dist-info/WHEEL,sha256=mguMlWGMX-VHnMpKOjjQidIo1ssRlCFu4a4mBpz1s2M,91
119
- sunholo-0.71.6.dist-info/entry_points.txt,sha256=bZuN5AIHingMPt4Ro1b_T-FnQvZ3teBes-3OyO0asl4,49
120
- sunholo-0.71.6.dist-info/top_level.txt,sha256=wt5tadn5--5JrZsjJz2LceoUvcrIvxjHJe-RxuudxAk,8
121
- sunholo-0.71.6.dist-info/RECORD,,
116
+ sunholo-0.71.10.dist-info/LICENSE.txt,sha256=SdE3QjnD3GEmqqg9EX3TM9f7WmtOzqS1KJve8rhbYmU,11345
117
+ sunholo-0.71.10.dist-info/METADATA,sha256=LIiaYAQSZmRw9v6rhqq3i-GZjIP_K9zZItlJ-j9cxW0,6615
118
+ sunholo-0.71.10.dist-info/WHEEL,sha256=mguMlWGMX-VHnMpKOjjQidIo1ssRlCFu4a4mBpz1s2M,91
119
+ sunholo-0.71.10.dist-info/entry_points.txt,sha256=bZuN5AIHingMPt4Ro1b_T-FnQvZ3teBes-3OyO0asl4,49
120
+ sunholo-0.71.10.dist-info/top_level.txt,sha256=wt5tadn5--5JrZsjJz2LceoUvcrIvxjHJe-RxuudxAk,8
121
+ sunholo-0.71.10.dist-info/RECORD,,