sunholo 0.79.2__py3-none-any.whl → 0.79.4__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.
@@ -1,4 +1,4 @@
1
- from ..utils import load_config_key
1
+ from ..utils import load_config_key, ConfigManager
2
2
  from ..custom_logging import log
3
3
  from ..database.alloydb import add_document_if_not_exists
4
4
  from ..database.uuid import generate_uuid_from_object_id
@@ -109,8 +109,10 @@ def summarise_docs(docs, vector_name, summary_threshold_default=10000, model_lim
109
109
 
110
110
  if not docs:
111
111
  return None
112
+
113
+ config = ConfigManager(vector_name)
112
114
 
113
- chunker_config = load_config_key("chunker", vector_name=vector_name, kind="vacConfig")
115
+ chunker_config = config.vacConfig("chunker")
114
116
  summarise_chunking_config = chunker_config.get("summarise") if chunker_config else None
115
117
 
116
118
  if not summarise_chunking_config:
@@ -122,7 +124,7 @@ def summarise_docs(docs, vector_name, summary_threshold_default=10000, model_lim
122
124
  summary_threshold = summarise_chunking_config.get("threshold") if summarise_chunking_config.get("threshold") else summary_threshold_default
123
125
  model_limit = summarise_chunking_config.get("model_limit") if summarise_chunking_config.get("model_limit") else model_limit_default
124
126
 
125
- summary_llm = llm_str_to_llm(summary_llm_str, model=model)
127
+ summary_llm = llm_str_to_llm(summary_llm_str, model=model, config=config)
126
128
 
127
129
  doc_summaries = {}
128
130
  for doc in docs:
@@ -6,7 +6,7 @@ from collections import defaultdict
6
6
  from .timedelta import format_timedelta
7
7
 
8
8
  class ConfigManager:
9
- def __init__(self, vector_name: str):
9
+ def __init__(self, vector_name: str, validate:bool=True):
10
10
  """
11
11
  Initialize the ConfigManager with a vector name.
12
12
  Requires a local config/ folder holding your configuration files or the env var VAC_CONFIG_FOLDER to be set.
@@ -15,6 +15,7 @@ class ConfigManager:
15
15
 
16
16
  Args:
17
17
  vector_name (str): The name of the vector in the configuration files.
18
+ validate (bool): Whether to validate the configurations
18
19
 
19
20
  Example:
20
21
  ```python
@@ -38,7 +39,7 @@ class ConfigManager:
38
39
  self.configs_by_kind = self.load_all_configs()
39
40
 
40
41
  test_agent = self.vacConfig("agent")
41
- if not test_agent and self.vector_name != "global":
42
+ if not test_agent and self.vector_name != "global" and validate:
42
43
  print(f"WARNING: No vacConfig.agent found for {self.vector_name} - are you in right folder? {local_config_folder=} {self.config_folder=}")
43
44
 
44
45
  def load_all_configs(self):
@@ -10,7 +10,7 @@ def dynamic_extension_call(question, config:ConfigManager, project_id:str=None,
10
10
 
11
11
  extensions = config.vacConfig('extensions')
12
12
  if not extensions:
13
- log.warning(f"No extensions founded for vac: {ConfigManager.vector_name}")
13
+ log.warning(f"No extensions founded for vac: {config.vector_name}")
14
14
 
15
15
  return None
16
16
 
@@ -12,7 +12,7 @@ from ..discovery_engine.discovery_engine_client import DiscoveryEngineClient
12
12
  from ..utils.gcp_project import get_gcp_project
13
13
  from ..utils import ConfigManager
14
14
 
15
- def get_vertex_memories(vector_name:str=None, config:ConfigManager=None):
15
+ def get_vertex_memories(config:ConfigManager):
16
16
  """
17
17
  Retrieves a LlamaIndex corpus from Vertex AI based on the provided Google Cloud configuration.
18
18
 
@@ -40,10 +40,6 @@ def get_vertex_memories(vector_name:str=None, config:ConfigManager=None):
40
40
  print("Error fetching corpus:", str(e))
41
41
  ```
42
42
  """
43
- if config is None:
44
- if vector_name is None:
45
- raise ValueError("config or vector_name are required")
46
- config = ConfigManager(vector_name)
47
43
 
48
44
  gcp_config = config.vacConfig("gcp_config")
49
45
 
@@ -52,7 +48,7 @@ def get_vertex_memories(vector_name:str=None, config:ConfigManager=None):
52
48
 
53
49
  global_location = gcp_config.get('location')
54
50
 
55
- memories = load_memories(vector_name)
51
+ memories = load_memories(config=config)
56
52
  tools = []
57
53
 
58
54
  if not memories:
@@ -70,15 +66,19 @@ def get_vertex_memories(vector_name:str=None, config:ConfigManager=None):
70
66
 
71
67
  if rag_id:
72
68
  log.info("Using rag_id for using vectorstore: llamaindex")
73
- corpus = fetch_corpus(
74
- project_id=project_id or get_gcp_project(),
75
- location=location or global_location,
76
- rag_id=rag_id
77
- )
69
+ try:
70
+ corpus = fetch_corpus(
71
+ project_id=project_id or get_gcp_project(),
72
+ location=location or global_location,
73
+ rag_id=rag_id
74
+ )
75
+ except Exception as err:
76
+ log.error(f"Skipping - No rag found for {rag_id=} - {str(err)}")
77
+ continue
78
78
  else:
79
- log.info(f"Using display_name {vector_name} to derive rag_id")
79
+ log.info(f"Using display_name {config.vector_name} to derive rag_id")
80
80
  manager = LlamaIndexVertexCorpusManager(project_id=project_id, location=location)
81
- corpus = manager.find_corpus_from_list(vector_name)
81
+ corpus = manager.find_corpus_from_list(config.vector_name)
82
82
 
83
83
  try:
84
84
  corpus_tool = Tool.from_retrieval(
@@ -1,9 +1,9 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: sunholo
3
- Version: 0.79.2
3
+ Version: 0.79.4
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.79.2.tar.gz
6
+ Download-URL: https://github.com/sunholo-data/sunholo-py/archive/refs/tags/v0.79.4.tar.gz
7
7
  Author: Holosun ApS
8
8
  Author-email: multivac@sunholo.com
9
9
  License: Apache License, Version 2.0
@@ -31,7 +31,7 @@ sunholo/bots/github_webhook.py,sha256=5pQPRLM_wxxcILVaIzUDV8Kt7Arcm2dL1r1kMMHA52
31
31
  sunholo/bots/webapp.py,sha256=EIMxdAJ_xtufwJmvnn7N_Fb_1hZ9DjhJ0Kf_hp02vEU,1926
32
32
  sunholo/chunker/__init__.py,sha256=A5canS0XPgisHu0OZ7sVdILgEHGzgH9kpkDi4oBwLZk,135
33
33
  sunholo/chunker/azure.py,sha256=MVF9_-QdKUoJqlpEJ49pv2sdjMDxEiMNxzmO7w5nWDQ,3270
34
- sunholo/chunker/doc_handling.py,sha256=7NdRWIlyAdsd_xZTKrXiviRI3Jl3pQgomemLNrtdxfw,8701
34
+ sunholo/chunker/doc_handling.py,sha256=UAf9BmUMpKCKRlAMl1qNZK6xDNYWk1z3ARoftWoa_54,8734
35
35
  sunholo/chunker/encode_metadata.py,sha256=hxxd9KU35Xi0Z_EL8kt_oD66pKfBLhEjBImC16ew-Eo,1919
36
36
  sunholo/chunker/images.py,sha256=id2PBu6XyGEOtgafq2v0c9_O6kxaC_pYFMnbsIitkSg,1868
37
37
  sunholo/chunker/loaders.py,sha256=CCB0IGigNAWT__2ImVin_j83W3eGS2Qe5I6U18YQzoM,10275
@@ -116,7 +116,7 @@ sunholo/utils/__init__.py,sha256=Hv02T5L2zYWvCso5hzzwm8FQogwBq0OgtUbN_7Quzqc,89
116
116
  sunholo/utils/api_key.py,sha256=Ct4bIAQZxzPEw14hP586LpVxBAVi_W9Serpy0BK-7KI,244
117
117
  sunholo/utils/big_context.py,sha256=gJIP7_ZL-YSLhOMq8jmFTMqH1wq8eB1NK7oKPeZAq2s,5578
118
118
  sunholo/utils/config.py,sha256=aG29MXcL5qzQMtCMqcdy-2ysDCYf9Zn_ZLk5NNOQNSE,8982
119
- sunholo/utils/config_class.py,sha256=BewBxf59vSKJs4jcYvuLi6PW9M6so8w3qz9HfNFIu0M,8862
119
+ sunholo/utils/config_class.py,sha256=DEY2w7ks5fXmtJ4SwqELhUF4NJFVOuRwxeVFZJlYPf0,8963
120
120
  sunholo/utils/config_schema.py,sha256=Wv-ncitzljOhgbDaq9qnFqH5LCuxNv59dTGDWgd1qdk,4189
121
121
  sunholo/utils/gcp.py,sha256=uueODEpA-P6O15-t0hmcGC9dONLO_hLfzSsSoQnkUss,4854
122
122
  sunholo/utils/gcp_project.py,sha256=0ozs6tzI4qEvEeXb8MxLnCdEVoWKxlM6OH05htj7_tc,1325
@@ -125,16 +125,16 @@ sunholo/utils/timedelta.py,sha256=BbLabEx7_rbErj_YbNM0MBcaFN76DC4PTe4zD2ucezg,49
125
125
  sunholo/utils/user_ids.py,sha256=SQd5_H7FE7vcTZp9AQuQDWBXd4FEEd7TeVMQe1H4Ny8,292
126
126
  sunholo/utils/version.py,sha256=P1QAJQdZfT2cMqdTSmXmcxrD2PssMPEGM-WI6083Fck,237
127
127
  sunholo/vertex/__init__.py,sha256=tMd7ysJ1uwBjfFSn8JL0uS3-s6h_X4GAUBz8AArZEF0,339
128
- sunholo/vertex/extensions_call.py,sha256=VIVBYpJPMaDzGWxuBU5RF9GfAbrvrskGWH4eXpJbzIc,13823
128
+ sunholo/vertex/extensions_call.py,sha256=QeQbL3aAHlc4_-SynOzooZ_3xkQWAlcgNmFBSwLNtN8,13816
129
129
  sunholo/vertex/extensions_class.py,sha256=2QGW28lNjoMEnaoVb3QcqEDwphclIsZthnpLUi5_Ivo,21033
130
130
  sunholo/vertex/genai_functions.py,sha256=2z6grM9H0Z79Yzx88l8mE1wXck3bRa0TWvnqZZ9ifDc,2051
131
131
  sunholo/vertex/init.py,sha256=1OQwcPBKZYBTDPdyU7IM4X4OmiXLdsNV30C-fee2scQ,2875
132
- sunholo/vertex/memory_tools.py,sha256=7nDQXjrF9IpCPKbX3Focn4A2PdKb7JhfZDLv4le5kWc,7498
132
+ sunholo/vertex/memory_tools.py,sha256=pgSahVDh7GPEulu3nl-w0jb5lTClb4TCnVxPnMokNZY,7533
133
133
  sunholo/vertex/safety.py,sha256=S9PgQT1O_BQAkcqauWncRJaydiP8Q_Jzmu9gxYfy1VA,2482
134
134
  sunholo/vertex/type_dict_to_json.py,sha256=uTzL4o9tJRao4u-gJOFcACgWGkBOtqACmb6ihvCErL8,4694
135
- sunholo-0.79.2.dist-info/LICENSE.txt,sha256=SdE3QjnD3GEmqqg9EX3TM9f7WmtOzqS1KJve8rhbYmU,11345
136
- sunholo-0.79.2.dist-info/METADATA,sha256=qtezkTfwv1CJNsCg-T2vPY1zsZMixC7t-teHOjFwPI0,7348
137
- sunholo-0.79.2.dist-info/WHEEL,sha256=R0nc6qTxuoLk7ShA2_Y-UWkN8ZdfDBG2B6Eqpz2WXbs,91
138
- sunholo-0.79.2.dist-info/entry_points.txt,sha256=bZuN5AIHingMPt4Ro1b_T-FnQvZ3teBes-3OyO0asl4,49
139
- sunholo-0.79.2.dist-info/top_level.txt,sha256=wt5tadn5--5JrZsjJz2LceoUvcrIvxjHJe-RxuudxAk,8
140
- sunholo-0.79.2.dist-info/RECORD,,
135
+ sunholo-0.79.4.dist-info/LICENSE.txt,sha256=SdE3QjnD3GEmqqg9EX3TM9f7WmtOzqS1KJve8rhbYmU,11345
136
+ sunholo-0.79.4.dist-info/METADATA,sha256=-mV_Y5Er002Y0OS4lEz913p-XMfqTuifDtkRMlExgA4,7348
137
+ sunholo-0.79.4.dist-info/WHEEL,sha256=R0nc6qTxuoLk7ShA2_Y-UWkN8ZdfDBG2B6Eqpz2WXbs,91
138
+ sunholo-0.79.4.dist-info/entry_points.txt,sha256=bZuN5AIHingMPt4Ro1b_T-FnQvZ3teBes-3OyO0asl4,49
139
+ sunholo-0.79.4.dist-info/top_level.txt,sha256=wt5tadn5--5JrZsjJz2LceoUvcrIvxjHJe-RxuudxAk,8
140
+ sunholo-0.79.4.dist-info/RECORD,,