sunholo 0.106.1__py3-none-any.whl → 0.106.3__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.
@@ -12,6 +12,7 @@ except ImportError:
12
12
 
13
13
  from ..custom_logging import log
14
14
  from typing import Optional, List
15
+ import asyncio
15
16
 
16
17
  class DiscoveryEngineClient:
17
18
  """
@@ -69,9 +70,15 @@ class DiscoveryEngineClient:
69
70
  self.store_client = discoveryengine.DataStoreServiceClient(client_options=client_options)
70
71
  self.doc_client = discoveryengine.DocumentServiceClient(client_options=client_options)
71
72
  self.search_client = discoveryengine.SearchServiceClient(client_options=client_options)
72
- self.async_search_client = discoveryengine.SearchServiceAsyncClient(client_options=client_options)
73
73
  self.engine_client = discoveryengine.EngineServiceClient(client_options=client_options)
74
-
74
+ # Initialize the async client only if there's an active event loop
75
+ try:
76
+ asyncio.get_running_loop()
77
+ self.async_search_client = discoveryengine.SearchServiceAsyncClient(client_options=client_options)
78
+ except RuntimeError:
79
+ # No event loop in non-async environment, set async client to None
80
+ log.info("No event loop detected; skipping async client initialization")
81
+ self.async_search_client = None
75
82
 
76
83
  @classmethod
77
84
  def my_retry(cls):
@@ -35,8 +35,9 @@ def get_all_chunks(question:str, config:ConfigManager):
35
35
  vector_name = new_vector_name
36
36
 
37
37
  num_chunks = value.get('num_chunks') or 3
38
-
39
- chunk = get_chunks(question, vector_name, num_chunks)
38
+ gcp_config = config.vacConfig("gcp_config")
39
+ project_id = gcp_config.get('project_id')
40
+ chunk = get_chunks(question, vector_name, num_chunks, project_id=project_id)
40
41
  if chunk:
41
42
  chunks.append(chunk)
42
43
  if chunks:
@@ -45,8 +46,8 @@ def get_all_chunks(question:str, config:ConfigManager):
45
46
  log.warning(f"No chunks found for {vector_name}")
46
47
  return None
47
48
 
48
- def get_chunks(question, vector_name, num_chunks):
49
- de = DiscoveryEngineClient(vector_name, project_id=get_gcp_project(include_config=True))
49
+ def get_chunks(question, vector_name, num_chunks, project_id=None):
50
+ de = DiscoveryEngineClient(vector_name, project_id=project_id or get_gcp_project(include_config=True))
50
51
  try:
51
52
  return de.get_chunks(question, num_previous_chunks=num_chunks, num_next_chunks=num_chunks)
52
53
  except Exception as err:
@@ -1,9 +1,9 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: sunholo
3
- Version: 0.106.1
3
+ Version: 0.106.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.106.1.tar.gz
6
+ Download-URL: https://github.com/sunholo-data/sunholo-py/archive/refs/tags/v0.106.3.tar.gz
7
7
  Author: Holosun ApS
8
8
  Author-email: multivac@sunholo.com
9
9
  License: Apache License, Version 2.0
@@ -73,8 +73,8 @@ sunholo/database/sql/sb/setup.sql,sha256=CvoFvZQev2uWjmFa3aj3m3iuPFzAAJZ0S7Qi3L3
73
73
  sunholo/discovery_engine/__init__.py,sha256=hLgqRDJ22Aov9o2QjAEfsVgnL3kMdM-g5p8RJ9OyKdQ,130
74
74
  sunholo/discovery_engine/chunker_handler.py,sha256=Fv4BLOBi_7ap3AiAy4TlTN48CLZSMurJ3TkvC75Euro,5123
75
75
  sunholo/discovery_engine/create_new.py,sha256=NzhSh6nG6nQ5J9gZh8IDph4JiEVT_DC5GGvP0GuwTWs,943
76
- sunholo/discovery_engine/discovery_engine_client.py,sha256=QpTkKaoNiHgVCVcKbMyXAPtCXzpLOIpriQcZxs8zATM,21620
77
- sunholo/discovery_engine/get_ai_search_chunks.py,sha256=27fLdDNqeac657PibHJ0XaTuSZi47fDv9FCxpPV4CaQ,3919
76
+ sunholo/discovery_engine/discovery_engine_client.py,sha256=jfIayVUOPM4svGF1S5Kk60rIG-xSo_e3zOHtBRg0nZA,22002
77
+ sunholo/discovery_engine/get_ai_search_chunks.py,sha256=7a83FnEDb5hn9j167XC_mN-3l-Sa-p_Yvivmu_DDN_0,4090
78
78
  sunholo/embedder/__init__.py,sha256=sI4N_CqgEVcrMDxXgxKp1FsfsB4FpjoXgPGkl4N_u4I,44
79
79
  sunholo/embedder/embed_chunk.py,sha256=_FdO4-9frUJlDPqXv2Ai49ejUrrMTMGti3D7bfJGfy8,6984
80
80
  sunholo/excel/__init__.py,sha256=AqTMN9K4qJYi4maEgoORc5oxDVGO_eqmwzDaVP37JgY,56
@@ -149,9 +149,9 @@ sunholo/vertex/init.py,sha256=1OQwcPBKZYBTDPdyU7IM4X4OmiXLdsNV30C-fee2scQ,2875
149
149
  sunholo/vertex/memory_tools.py,sha256=tBZxqVZ4InTmdBvLlOYwoSEWu4-kGquc-gxDwZCC4FA,7667
150
150
  sunholo/vertex/safety.py,sha256=S9PgQT1O_BQAkcqauWncRJaydiP8Q_Jzmu9gxYfy1VA,2482
151
151
  sunholo/vertex/type_dict_to_json.py,sha256=uTzL4o9tJRao4u-gJOFcACgWGkBOtqACmb6ihvCErL8,4694
152
- sunholo-0.106.1.dist-info/LICENSE.txt,sha256=SdE3QjnD3GEmqqg9EX3TM9f7WmtOzqS1KJve8rhbYmU,11345
153
- sunholo-0.106.1.dist-info/METADATA,sha256=LT-NrNweknkdB5XPQFE9yEPQ6Z421flnTD4utV8MjEM,8670
154
- sunholo-0.106.1.dist-info/WHEEL,sha256=OVMc5UfuAQiSplgO0_WdW7vXVGAt9Hdd6qtN4HotdyA,91
155
- sunholo-0.106.1.dist-info/entry_points.txt,sha256=bZuN5AIHingMPt4Ro1b_T-FnQvZ3teBes-3OyO0asl4,49
156
- sunholo-0.106.1.dist-info/top_level.txt,sha256=wt5tadn5--5JrZsjJz2LceoUvcrIvxjHJe-RxuudxAk,8
157
- sunholo-0.106.1.dist-info/RECORD,,
152
+ sunholo-0.106.3.dist-info/LICENSE.txt,sha256=SdE3QjnD3GEmqqg9EX3TM9f7WmtOzqS1KJve8rhbYmU,11345
153
+ sunholo-0.106.3.dist-info/METADATA,sha256=BgiMmvgSwpUsbrTpeoaB2KDwBTiBIypHvBcvbgFklGw,8670
154
+ sunholo-0.106.3.dist-info/WHEEL,sha256=P9jw-gEje8ByB7_hXoICnHtVCrEwMQh-630tKvQWehc,91
155
+ sunholo-0.106.3.dist-info/entry_points.txt,sha256=bZuN5AIHingMPt4Ro1b_T-FnQvZ3teBes-3OyO0asl4,49
156
+ sunholo-0.106.3.dist-info/top_level.txt,sha256=wt5tadn5--5JrZsjJz2LceoUvcrIvxjHJe-RxuudxAk,8
157
+ sunholo-0.106.3.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (75.2.0)
2
+ Generator: setuptools (75.3.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5