sunholo 0.71.5__py3-none-any.whl → 0.71.8__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.
@@ -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,3 +1,3 @@
1
1
  from .init import init_vertex
2
- from .memory_tools import get_vertex_memories, print_grounding_response
2
+ from .memory_tools import get_vertex_memories, print_grounding_response, get_google_search_grounding
3
3
  from .safety import vertex_safety
@@ -106,6 +106,17 @@ def get_vertex_memories(vector_name):
106
106
 
107
107
  return tools
108
108
 
109
+ def get_google_search_grounding(vector_name):
110
+ # can't have this and llamaindex memories?
111
+ ground = load_config_key("grounding", vector_name=vector_name, kind="vacConfig")
112
+ if ground and ground.get("google_search"):
113
+ gs_tool = Tool.from_google_search_retrieval(grounding.GoogleSearchRetrieval())
114
+ log.info(f"Got Search Tool: {gs_tool}")
115
+ return gs_tool
116
+
117
+ log.info(f"No google search config available for {vector_name}")
118
+ return None
119
+
109
120
  def print_grounding_response(response):
110
121
  """Prints Gemini response with grounding citations."""
111
122
  grounding_metadata = response.candidates[0].grounding_metadata
@@ -1,9 +1,9 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: sunholo
3
- Version: 0.71.5
3
+ Version: 0.71.8
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.5.tar.gz
6
+ Download-URL: https://github.com/sunholo-data/sunholo-py/archive/refs/tags/v0.71.8.tar.gz
7
7
  Author: Holosun ApS
8
8
  Author-email: multivac@sunholo.com
9
9
  License: Apache License, Version 2.0
@@ -63,7 +63,7 @@ sunholo/database/sql/sb/setup.sql,sha256=CvoFvZQev2uWjmFa3aj3m3iuPFzAAJZ0S7Qi3L3
63
63
  sunholo/discovery_engine/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
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
@@ -107,15 +107,15 @@ sunholo/utils/parsers.py,sha256=z98cQ1v2_ScnqHxCtApNeAN2the8MdvS6RpKL6vWyOU,5287
107
107
  sunholo/utils/timedelta.py,sha256=BbLabEx7_rbErj_YbNM0MBcaFN76DC4PTe4zD2ucezg,493
108
108
  sunholo/utils/user_ids.py,sha256=SQd5_H7FE7vcTZp9AQuQDWBXd4FEEd7TeVMQe1H4Ny8,292
109
109
  sunholo/utils/version.py,sha256=P1QAJQdZfT2cMqdTSmXmcxrD2PssMPEGM-WI6083Fck,237
110
- sunholo/vertex/__init__.py,sha256=JvHcGFuv6R_nAhY2AdoqqhMpJ5ugeWPZ_svGhWrObBk,136
110
+ sunholo/vertex/__init__.py,sha256=dZa4xWYo-KU6br7SHZJPzfB4T6ICGkw_FshDs1tvnCA,165
111
111
  sunholo/vertex/extensions.py,sha256=d-Ikt9gHFf-jUMPmyU-xHwYe22QtEyr90Ua1LDKgTws,11026
112
112
  sunholo/vertex/extensions_class.py,sha256=0-XMrMvfhMN380ZdGXl11Mt7R9kCu9rB4Vduiflk8QA,9202
113
113
  sunholo/vertex/init.py,sha256=RLjQppTUwubWgwf2PoAke-EtcwlVkFPaPMYvUsMw1KQ,2029
114
- sunholo/vertex/memory_tools.py,sha256=x4Z4Hlpd1VNFu_DfA7xtF0ySF0-IXbkLJJLa6RTpks0,5871
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.5.dist-info/LICENSE.txt,sha256=SdE3QjnD3GEmqqg9EX3TM9f7WmtOzqS1KJve8rhbYmU,11345
117
- sunholo-0.71.5.dist-info/METADATA,sha256=tcQaaxDVPDG1_y0ku5bN12OEoicVYLSmfaFEYbF-qWM,6613
118
- sunholo-0.71.5.dist-info/WHEEL,sha256=mguMlWGMX-VHnMpKOjjQidIo1ssRlCFu4a4mBpz1s2M,91
119
- sunholo-0.71.5.dist-info/entry_points.txt,sha256=bZuN5AIHingMPt4Ro1b_T-FnQvZ3teBes-3OyO0asl4,49
120
- sunholo-0.71.5.dist-info/top_level.txt,sha256=wt5tadn5--5JrZsjJz2LceoUvcrIvxjHJe-RxuudxAk,8
121
- sunholo-0.71.5.dist-info/RECORD,,
116
+ sunholo-0.71.8.dist-info/LICENSE.txt,sha256=SdE3QjnD3GEmqqg9EX3TM9f7WmtOzqS1KJve8rhbYmU,11345
117
+ sunholo-0.71.8.dist-info/METADATA,sha256=0E4ymtqS_ZQf_em3l97Y44zLaxZV8GMEi21hLCfM_N4,6613
118
+ sunholo-0.71.8.dist-info/WHEEL,sha256=mguMlWGMX-VHnMpKOjjQidIo1ssRlCFu4a4mBpz1s2M,91
119
+ sunholo-0.71.8.dist-info/entry_points.txt,sha256=bZuN5AIHingMPt4Ro1b_T-FnQvZ3teBes-3OyO0asl4,49
120
+ sunholo-0.71.8.dist-info/top_level.txt,sha256=wt5tadn5--5JrZsjJz2LceoUvcrIvxjHJe-RxuudxAk,8
121
+ sunholo-0.71.8.dist-info/RECORD,,