sunholo 0.77.1__py3-none-any.whl → 0.77.2__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/components/llm.py CHANGED
@@ -12,7 +12,7 @@
12
12
  # See the License for the specific language governing permissions and
13
13
  # limitations under the License.
14
14
  from ..logging import log
15
- from ..utils.config import load_config_key
15
+ from ..utils import load_config_key, ConfigManager
16
16
 
17
17
  import os
18
18
 
@@ -57,7 +57,14 @@ def pick_streaming(vector_name):
57
57
  return False
58
58
 
59
59
 
60
- def llm_str_to_llm(llm_str, model=None, vector_name=None):
60
+ def llm_str_to_llm(llm_str, model=None, vector_name=None, config=None):
61
+
62
+ if llm_str is None:
63
+ raise NotImplementedError("llm_str was None")
64
+
65
+ if vector_name:
66
+ config = ConfigManager(vector_name)
67
+
61
68
  if llm_str == 'openai':
62
69
  # Setup for OpenAI LLM
63
70
  from langchain_openai import ChatOpenAI
@@ -70,7 +77,7 @@ def llm_str_to_llm(llm_str, model=None, vector_name=None):
70
77
 
71
78
  elif llm_str == 'vertex':
72
79
  # Setup for Vertex LLM
73
- from langchain_community.llms import VertexAI
80
+ from langchain_google_vertexai import VertexAI
74
81
  if model is None:
75
82
  model = 'text-unicorn'
76
83
  log.info(f"No 'model' value in config file - selecting default {model}")
@@ -79,7 +86,7 @@ def llm_str_to_llm(llm_str, model=None, vector_name=None):
79
86
 
80
87
  elif llm_str == 'model_garden':
81
88
  from ..patches.langchain.vertexai import VertexAIModelGarden
82
- model_garden_config = load_config_key("gcp_config", vector_name, kind="vacConfig")
89
+ model_garden_config = config.vacConfig("gcp_config")
83
90
  if model_garden_config is None:
84
91
  raise ValueError("llm='model_garden' requires a gcp_config entry in config yaml file")
85
92
 
@@ -97,16 +104,18 @@ def llm_str_to_llm(llm_str, model=None, vector_name=None):
97
104
  if llm_str is None:
98
105
  raise NotImplementedError(f'No llm implemented for {llm_str}')
99
106
 
100
- def get_llm(vector_name, model=None):
101
- llm_str = load_config_key("llm", vector_name, kind="vacConfig")
102
- #model_lookup_filepath = get_module_filepath("lookup/model_lookup.yaml")
103
- #model_lookup, _ = load_config(model_lookup_filepath)
107
+ def get_llm(vector_name=None, model=None, config=None):
108
+
109
+ if vector_name:
110
+ config = ConfigManager(vector_name)
111
+
112
+ llm_str = config.vacConfig("llm")
104
113
 
105
114
  if not model:
106
- model = load_config_key("model", vector_name, kind="vacConfig")
115
+ model = config.vacConfig("model")
107
116
 
108
117
  log.debug(f"Chose LLM: {llm_str}")
109
- return llm_str_to_llm(llm_str, model=model, vector_name=vector_name)
118
+ return llm_str_to_llm(llm_str, model=model, config=config)
110
119
 
111
120
  def get_llm_chat(vector_name, model=None):
112
121
  llm_str = load_config_key("llm", vector_name, kind="vacConfig")
@@ -21,7 +21,7 @@ def invoke_vac_qa(vac_input: dict, vac_name: str, chat_history=[], stream=False)
21
21
  image_uri = vac_input.get('image_url') or vac_input.get('image_uri')
22
22
 
23
23
  if not stream:
24
- log.info(f'Batch invoke_vac_qa with {vac_input=}')
24
+ log.warning(f'Batch invoke_vac_qa with {vac_input=}')
25
25
  vac_response = send_to_qa(
26
26
  vac_input["user_input"],
27
27
  vector_name=vac_name,
@@ -40,7 +40,8 @@ def invoke_vac_qa(vac_input: dict, vac_name: str, chat_history=[], stream=False)
40
40
  },
41
41
  user_id=user_id,
42
42
  session_id=session_id,
43
- message_source="sunholo.invoke_vac_qa.invoke")
43
+ message_source="sunholo.invoke_vac_qa.invoke",
44
+ stream=False)
44
45
 
45
46
  # ensures {'answer': answer}
46
47
  answer = parse_output(vac_response)
@@ -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("No extensions founded for vac: {vac}")
13
+ log.warning(f"No extensions founded for vac: {ConfigManager.vector_name}")
14
14
 
15
15
  return None
16
16
 
@@ -1,9 +1,9 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: sunholo
3
- Version: 0.77.1
3
+ Version: 0.77.2
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.77.1.tar.gz
6
+ Download-URL: https://github.com/sunholo-data/sunholo-py/archive/refs/tags/v0.77.2.tar.gz
7
7
  Author: Holosun ApS
8
8
  Author-email: multivac@sunholo.com
9
9
  License: Apache License, Version 2.0
@@ -54,6 +54,7 @@ Requires-Dist: langchain-openai ; extra == 'all'
54
54
  Requires-Dist: langchain-google-genai ; extra == 'all'
55
55
  Requires-Dist: langchain-google-alloydb-pg ; extra == 'all'
56
56
  Requires-Dist: langchain-anthropic >=0.1.13 ; extra == 'all'
57
+ Requires-Dist: langchain-google-vertexai ; extra == 'all'
57
58
  Requires-Dist: langfuse ; extra == 'all'
58
59
  Requires-Dist: pg8000 ; extra == 'all'
59
60
  Requires-Dist: pgvector ; extra == 'all'
@@ -102,6 +103,7 @@ Requires-Dist: google-cloud-discoveryengine ; extra == 'gcp'
102
103
  Requires-Dist: google-generativeai >=0.7.1 ; extra == 'gcp'
103
104
  Requires-Dist: langchain-google-genai >=1.0.5 ; extra == 'gcp'
104
105
  Requires-Dist: langchain-google-alloydb-pg >=0.2.2 ; extra == 'gcp'
106
+ Requires-Dist: langchain-google-vertexai ; extra == 'gcp'
105
107
  Requires-Dist: pillow ; extra == 'gcp'
106
108
  Provides-Extra: http
107
109
  Requires-Dist: fastapi ; extra == 'http'
@@ -51,7 +51,7 @@ sunholo/cli/sun_rich.py,sha256=UpMqeJ0C8i0pkue1AHnnyyX0bFJ9zZeJ7HBR6yhuA8A,54
51
51
  sunholo/cli/swagger.py,sha256=absYKAU-7Yd2eiVNUY-g_WLl2zJfeRUNdWQ0oH8M_HM,1564
52
52
  sunholo/cli/vertex.py,sha256=8130YCarxHL1UC3aqblNmUwGZTXbkdL4Y_FOnZJsWiI,2056
53
53
  sunholo/components/__init__.py,sha256=IDoylb74zFKo6NIS3RQqUl0PDFBGVxM1dfUmO7OJ44U,176
54
- sunholo/components/llm.py,sha256=T4we3tGmqUj4tPwxQr9M6AXv_BALqZV_dRSvINan-oU,10374
54
+ sunholo/components/llm.py,sha256=WPzZQ-S4D6S5ULH2dK6ps1Qy9Jp6qMXt3dGd9iNBUNY,10394
55
55
  sunholo/components/retriever.py,sha256=BFUw_6turT3CQJZWv_uXylmH5fHdb0gKfKJrQ_j6MGY,6533
56
56
  sunholo/components/vectorstore.py,sha256=zUJ90L1S4IyxLB0JUWopeuwVjcsSqdhj1QreEfsJhsE,5548
57
57
  sunholo/database/__init__.py,sha256=Zz0Shcq-CtStf9rJGIYB_Ybzb8rY_Q9mfSj-nviM490,241
@@ -79,7 +79,7 @@ sunholo/gcs/download_folder.py,sha256=mfntDA3Gl-7quMK9_eSTWvUOY1330jF--1cb62C0K1
79
79
  sunholo/gcs/download_url.py,sha256=iCIPESi2viQ-TcCINpbJXxUt7XJFFpF0KiVgSA6zFis,5228
80
80
  sunholo/gcs/metadata.py,sha256=C9sMPsHsq1ETetdQCqB3EBs3Kws8b8QHS9L7ei_v5aw,891
81
81
  sunholo/invoke/__init__.py,sha256=Dxivd9cU92X4v2JAZet4f7L2RJ5l_30rt9t2NiD-iLA,55
82
- sunholo/invoke/invoke_vac_utils.py,sha256=0JkCZDBEkRImzuB-nf70dF75t0WKtgA9G4TdaQJUB08,5240
82
+ sunholo/invoke/invoke_vac_utils.py,sha256=MLqmHVIqde7c5Qf1DvZYO5JITbjV7oWWIblaD8a_RSM,5269
83
83
  sunholo/langfuse/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
84
84
  sunholo/langfuse/callback.py,sha256=CTaos8sYcrga949BG6lIZ4I62DiiQSHxwz5re9XjDWQ,1677
85
85
  sunholo/langfuse/prompts.py,sha256=EkbzSw9Jr05ULMsRDoGOp-frbtCZpnvdYSJEYNpzfX8,1293
@@ -121,16 +121,16 @@ sunholo/utils/timedelta.py,sha256=BbLabEx7_rbErj_YbNM0MBcaFN76DC4PTe4zD2ucezg,49
121
121
  sunholo/utils/user_ids.py,sha256=SQd5_H7FE7vcTZp9AQuQDWBXd4FEEd7TeVMQe1H4Ny8,292
122
122
  sunholo/utils/version.py,sha256=P1QAJQdZfT2cMqdTSmXmcxrD2PssMPEGM-WI6083Fck,237
123
123
  sunholo/vertex/__init__.py,sha256=tMd7ysJ1uwBjfFSn8JL0uS3-s6h_X4GAUBz8AArZEF0,339
124
- sunholo/vertex/extensions_call.py,sha256=W20AMcPdyJYQvkTdIEo0VTMiuvreRNoTsVd7vcMJfCE,13793
124
+ sunholo/vertex/extensions_call.py,sha256=eUPVoWtsEnQqUYYY28sGgJcRh1GLz31-ylxmyzzzUV8,13816
125
125
  sunholo/vertex/extensions_class.py,sha256=a1EEP3SHyHCVeA_tcYkud_oG1hw6liBsFsJpEaqs4MA,21026
126
126
  sunholo/vertex/genai_functions.py,sha256=EODgy8_5KlKuhNY4h63F3vbEcpp5qcleabKm6maVvGk,2044
127
127
  sunholo/vertex/init.py,sha256=uyg76EqS39jWJ2gxMqXOLWP6MQ2hc81wFdwgG86ZoCM,2868
128
128
  sunholo/vertex/memory_tools.py,sha256=pomHrDKqvY8MZxfUqoEwhdlpCvSGP6KmFJMVKOimXjs,6842
129
129
  sunholo/vertex/safety.py,sha256=S9PgQT1O_BQAkcqauWncRJaydiP8Q_Jzmu9gxYfy1VA,2482
130
130
  sunholo/vertex/type_dict_to_json.py,sha256=uTzL4o9tJRao4u-gJOFcACgWGkBOtqACmb6ihvCErL8,4694
131
- sunholo-0.77.1.dist-info/LICENSE.txt,sha256=SdE3QjnD3GEmqqg9EX3TM9f7WmtOzqS1KJve8rhbYmU,11345
132
- sunholo-0.77.1.dist-info/METADATA,sha256=KvkeVR7-RfMUBwj0WH_c40XSYpjaO1lwbc1Vp76AD-k,7136
133
- sunholo-0.77.1.dist-info/WHEEL,sha256=Z4pYXqR_rTB7OWNDYFOm1qRk0RX6GFP2o8LgvP453Hk,91
134
- sunholo-0.77.1.dist-info/entry_points.txt,sha256=bZuN5AIHingMPt4Ro1b_T-FnQvZ3teBes-3OyO0asl4,49
135
- sunholo-0.77.1.dist-info/top_level.txt,sha256=wt5tadn5--5JrZsjJz2LceoUvcrIvxjHJe-RxuudxAk,8
136
- sunholo-0.77.1.dist-info/RECORD,,
131
+ sunholo-0.77.2.dist-info/LICENSE.txt,sha256=SdE3QjnD3GEmqqg9EX3TM9f7WmtOzqS1KJve8rhbYmU,11345
132
+ sunholo-0.77.2.dist-info/METADATA,sha256=xS_n1x1FYlsji1Wg46phwsE938jCS0c2OdFn3w9QN48,7252
133
+ sunholo-0.77.2.dist-info/WHEEL,sha256=Z4pYXqR_rTB7OWNDYFOm1qRk0RX6GFP2o8LgvP453Hk,91
134
+ sunholo-0.77.2.dist-info/entry_points.txt,sha256=bZuN5AIHingMPt4Ro1b_T-FnQvZ3teBes-3OyO0asl4,49
135
+ sunholo-0.77.2.dist-info/top_level.txt,sha256=wt5tadn5--5JrZsjJz2LceoUvcrIvxjHJe-RxuudxAk,8
136
+ sunholo-0.77.2.dist-info/RECORD,,