sunholo 0.92.6__py3-none-any.whl → 0.93.0__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
@@ -87,18 +87,25 @@ def llm_str_to_llm(llm_str, model=None, vector_name=None, config=None):
87
87
  elif llm_str == 'genai':
88
88
  from langchain_google_genai import ChatGoogleGenerativeAI
89
89
  if model is None:
90
- model = "gemini-pro"
90
+ model = "gemini-1.5-pro"
91
91
  log.info(f"No 'model' value in config file - selecting default {model}")
92
92
 
93
93
  return ChatGoogleGenerativeAI(model=model)
94
94
 
95
95
  elif llm_str == 'vertex':
96
96
  # Setup for Vertex LLM
97
- from langchain_google_vertexai import VertexAI
97
+
98
98
  if model is None:
99
- model = 'text-unicorn'
99
+ model = 'gemini-1.5-pro'
100
100
  log.info(f"No 'model' value in config file - selecting default {model}")
101
+ if model.startswith('claude'):
102
+ from langchain_google_vertexai.model_garden import ChatAnthropicVertex
103
+ gcp_config = config.vacConfig("gcp_config")
104
+ return ChatAnthropicVertex(model_name=model,
105
+ project=gcp_config.get('project_id'),
106
+ location=gcp_config.get('location'))
101
107
 
108
+ from langchain_google_vertexai import VertexAI
102
109
  return VertexAI(model_name = model, temperature=0, max_output_tokens=1024)
103
110
 
104
111
  elif llm_str == 'model_garden':
@@ -116,13 +123,16 @@ def llm_str_to_llm(llm_str, model=None, vector_name=None, config=None):
116
123
  if model is None:
117
124
  model = 'claude-3-5-sonnet-20240620'
118
125
  log.info(f"No 'model' value in config file - selecting default {model}")
126
+
119
127
  return ChatAnthropic(model_name = model, temperature=0)
128
+
120
129
  elif llm_str == 'anthropic-vertex':
121
130
  from langchain_google_vertexai.model_garden import ChatAnthropicVertex
122
131
  if model is None:
123
132
  model = "claude-3-5-sonnet@20240620"
124
133
  log.info(f"No 'model' value in config file - selecting default {model}")
125
134
  gcp_config = config.vacConfig("gcp_config")
135
+
126
136
  return ChatAnthropicVertex(model_name=model,
127
137
  project=gcp_config.get('project_id'),
128
138
  location=gcp_config.get('location'))
@@ -171,7 +181,13 @@ def get_llm_chat(vector_name:str=None, model=None, config:ConfigManager=None):
171
181
  if model is None:
172
182
  model = 'gemini-1.0-pro'
173
183
  log.info(f"No 'model' value in config file - selecting default {model}")
174
-
184
+ if model.startswith('claude'):
185
+ from langchain_google_vertexai.model_garden import ChatAnthropicVertex
186
+ gcp_config = config.vacConfig("gcp_config")
187
+ return ChatAnthropicVertex(model_name=model,
188
+ project=gcp_config.get('project_id'),
189
+ location=gcp_config.get('location'))
190
+
175
191
  return ChatVertexAI(model_name = model, temperature=0, max_output_tokens=1024)
176
192
 
177
193
  elif llm_str == 'gemini':
@@ -189,6 +205,7 @@ def get_llm_chat(vector_name:str=None, model=None, config:ConfigManager=None):
189
205
  log.info(f"No 'model' value in config file - selecting default {model}")
190
206
 
191
207
  return ChatAnthropic(model_name = model, temperature=0)
208
+
192
209
  elif llm_str == 'azure':
193
210
  from langchain_openai import AzureChatOpenAI
194
211
  azure_config = config.vacConfig("azure")
@@ -197,6 +197,7 @@ class AlloyDBClient:
197
197
  return await self.vectorstore.asimilarity_search(query, filter=source_filter_cmd, k=k)
198
198
 
199
199
  def execute_sql(self, sql_statement):
200
+ log.info(f"Executing sync SQL statement: {sql_statement}")
200
201
  if self.engine_type == "pg8000":
201
202
  return self._execute_sql_pg8000(sql_statement)
202
203
  elif self.engine_type == "langchain":
@@ -228,6 +229,7 @@ class AlloyDBClient:
228
229
  return result
229
230
 
230
231
  async def execute_sql_async(self, sql_statement):
232
+ log.info(f"Executing async SQL statement: {sql_statement}")
231
233
  if self.engine_type == "pg8000":
232
234
  result = await self._execute_sql_async_pg8000(sql_statement)
233
235
  elif self.engine_type == "langchain":
@@ -273,13 +275,30 @@ class AlloyDBClient:
273
275
  raise ValueError("The 'source' parameter must be a single string, not a list of strings or other iterable.")
274
276
 
275
277
  table_name = f"{vector_name}_docstore"
276
- doc_id = generate_uuid_from_object_id(source)
278
+ #doc_id = generate_uuid_from_object_id(source)
279
+
280
+ query = f"""
281
+ SELECT page_content, source, langchain_metadata, images_gsurls, doc_id::text as doc_id
282
+ FROM "{table_name}"
283
+ WHERE source = '{source}'
284
+ LIMIT 500;
285
+ """
286
+
287
+ return query
288
+
289
+ def _get_document_via_docid(self, source:str, vector_name:str, doc_id: str):
290
+ if not isinstance(source, str):
291
+ raise ValueError("The 'source' parameter must be a single string, not a list of strings or other iterable.")
292
+
293
+ table_name = f"{vector_name}_docstore"
294
+ if not doc_id:
295
+ doc_id = generate_uuid_from_object_id(source)
277
296
 
278
297
  query = f"""
279
298
  SELECT page_content, source, langchain_metadata, images_gsurls, doc_id::text as doc_id
280
299
  FROM "{table_name}"
281
300
  WHERE doc_id = '{doc_id}'
282
- LIMIT 1;
301
+ LIMIT 50;
283
302
  """
284
303
 
285
304
  return query
@@ -1,9 +1,9 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: sunholo
3
- Version: 0.92.6
3
+ Version: 0.93.0
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.92.6.tar.gz
6
+ Download-URL: https://github.com/sunholo-data/sunholo-py/archive/refs/tags/v0.93.0.tar.gz
7
7
  Author: Holosun ApS
8
8
  Author-email: multivac@sunholo.com
9
9
  License: Apache License, Version 2.0
@@ -54,12 +54,12 @@ sunholo/cli/sun_rich.py,sha256=UpMqeJ0C8i0pkue1AHnnyyX0bFJ9zZeJ7HBR6yhuA8A,54
54
54
  sunholo/cli/swagger.py,sha256=absYKAU-7Yd2eiVNUY-g_WLl2zJfeRUNdWQ0oH8M_HM,1564
55
55
  sunholo/cli/vertex.py,sha256=8130YCarxHL1UC3aqblNmUwGZTXbkdL4Y_FOnZJsWiI,2056
56
56
  sunholo/components/__init__.py,sha256=IDoylb74zFKo6NIS3RQqUl0PDFBGVxM1dfUmO7OJ44U,176
57
- sunholo/components/llm.py,sha256=5QkYgMoqFeFVl71w0zrLN-aKMieSlMiL2gM4aB-6uk8,12023
57
+ sunholo/components/llm.py,sha256=Y6fx8CzlF-BpPN1kQFllbX7u0wx6zhQVPIjrNLFhE7E,12814
58
58
  sunholo/components/retriever.py,sha256=bKIVT7_18Ut3OJd0E0jyiISPnD9qkHWVjcQPT4i1_G8,7720
59
59
  sunholo/components/vectorstore.py,sha256=xKk7micTRwZckaI7U6PxvFz_ZSjCH48xPTDYiDcv2tc,5913
60
60
  sunholo/database/__init__.py,sha256=bpB5Nk21kwqYj-qdVnvNgXjLsbflnH4g-San7OHMqR4,283
61
61
  sunholo/database/alloydb.py,sha256=YH8wNPS8gN-TDZEXQcVHxwd1NScHRfAxma3gK4R6KCk,11740
62
- sunholo/database/alloydb_client.py,sha256=QYEqMNuqZqDjWsUVk408eC35qmD8Tu87eI6lmYc1YbI,17547
62
+ sunholo/database/alloydb_client.py,sha256=pD3aVT_UWEtcT8Ma1glyj6QEWHRqbNKJNKe3oau_0HA,18304
63
63
  sunholo/database/database.py,sha256=VqhZdkXUNdvWn8sUcUV3YNby1JDVf7IykPVXWBtxo9U,7361
64
64
  sunholo/database/lancedb.py,sha256=DyfZntiFKBlVPaFooNN1Z6Pl-LAs4nxWKKuq8GBqN58,715
65
65
  sunholo/database/static_dbs.py,sha256=8cvcMwUK6c32AS2e_WguKXWMkFf5iN3g9WHzsh0C07Q,442
@@ -144,9 +144,9 @@ sunholo/vertex/init.py,sha256=1OQwcPBKZYBTDPdyU7IM4X4OmiXLdsNV30C-fee2scQ,2875
144
144
  sunholo/vertex/memory_tools.py,sha256=q_phxgGX2TG2j2MXNULF2xGzQnQPENwjPN9nZ_A9Gh0,7526
145
145
  sunholo/vertex/safety.py,sha256=S9PgQT1O_BQAkcqauWncRJaydiP8Q_Jzmu9gxYfy1VA,2482
146
146
  sunholo/vertex/type_dict_to_json.py,sha256=uTzL4o9tJRao4u-gJOFcACgWGkBOtqACmb6ihvCErL8,4694
147
- sunholo-0.92.6.dist-info/LICENSE.txt,sha256=SdE3QjnD3GEmqqg9EX3TM9f7WmtOzqS1KJve8rhbYmU,11345
148
- sunholo-0.92.6.dist-info/METADATA,sha256=qQpD3u4tg37RVQcIZH2Kb0cemizMQQWS-PfHgHE4nYo,7806
149
- sunholo-0.92.6.dist-info/WHEEL,sha256=cVxcB9AmuTcXqmwrtPhNK88dr7IR_b6qagTj0UvIEbY,91
150
- sunholo-0.92.6.dist-info/entry_points.txt,sha256=bZuN5AIHingMPt4Ro1b_T-FnQvZ3teBes-3OyO0asl4,49
151
- sunholo-0.92.6.dist-info/top_level.txt,sha256=wt5tadn5--5JrZsjJz2LceoUvcrIvxjHJe-RxuudxAk,8
152
- sunholo-0.92.6.dist-info/RECORD,,
147
+ sunholo-0.93.0.dist-info/LICENSE.txt,sha256=SdE3QjnD3GEmqqg9EX3TM9f7WmtOzqS1KJve8rhbYmU,11345
148
+ sunholo-0.93.0.dist-info/METADATA,sha256=jAwnrLLbA9YDitxozR7LjwaU9doMLczDU6yl2b81ovs,7806
149
+ sunholo-0.93.0.dist-info/WHEEL,sha256=cVxcB9AmuTcXqmwrtPhNK88dr7IR_b6qagTj0UvIEbY,91
150
+ sunholo-0.93.0.dist-info/entry_points.txt,sha256=bZuN5AIHingMPt4Ro1b_T-FnQvZ3teBes-3OyO0asl4,49
151
+ sunholo-0.93.0.dist-info/top_level.txt,sha256=wt5tadn5--5JrZsjJz2LceoUvcrIvxjHJe-RxuudxAk,8
152
+ sunholo-0.93.0.dist-info/RECORD,,