sunholo 0.58.0__py3-none-any.whl → 0.58.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.
@@ -27,7 +27,7 @@ from langchain.retrievers import ContextualCompressionRetriever
27
27
 
28
28
 
29
29
  def load_memories(vector_name):
30
- memories = load_config_key("memory", vector_name, filename="config/llm_config.yaml")
30
+ memories = load_config_key("memory", vector_name, type="vacConfig")
31
31
  log.info(f"Found memory settings for {vector_name}: {memories}")
32
32
  if len(memories) == 0:
33
33
  log.info(f"No memory settings found for {vector_name}")
@@ -49,7 +49,8 @@ def pick_retriever(vector_name, embeddings=None):
49
49
  if embeddings is None:
50
50
  embeddings = get_embeddings(vector_name)
51
51
  vectorstore = pick_vectorstore(vectorstore, vector_name=vector_name, embeddings=embeddings)
52
- vs_retriever = vectorstore.as_retriever(search_kwargs=dict(k=3))
52
+ k_override = value.get('k', 3)
53
+ vs_retriever = vectorstore.as_retriever(search_kwargs=dict(k=k_override))
53
54
  retriever_list.append(vs_retriever)
54
55
 
55
56
  if value.get('provider') == "GoogleCloudEnterpriseSearchRetriever":
@@ -68,6 +69,10 @@ def pick_retriever(vector_name, embeddings=None):
68
69
  if len(retriever_list) == 0:
69
70
  log.info(f"No retrievers were created for {memories}")
70
71
  return None
72
+
73
+ k_override = load_config_key("memory_k", vector_name, type="vacConfig")
74
+ if not k_override:
75
+ k_override = 3
71
76
 
72
77
  lotr = MergerRetriever(retrievers=retriever_list)
73
78
 
@@ -76,6 +81,6 @@ def pick_retriever(vector_name, embeddings=None):
76
81
  pipeline = DocumentCompressorPipeline(transformers=[filter])
77
82
  retriever = ContextualCompressionRetriever(
78
83
  base_compressor=pipeline, base_retriever=lotr,
79
- k=3)
84
+ k=k_override)
80
85
 
81
86
  return retriever
@@ -115,6 +115,15 @@ def embed_pubsub_chunk(data: dict):
115
115
  embed_llm = value.get('llm')
116
116
  if embed_llm:
117
117
  embeddings = pick_embedding(embed_llm)
118
+ # check if read only
119
+ read_only = value.get('readonly')
120
+ if read_only:
121
+ continue
122
+ # read from a different vector_name
123
+ vector_name_other = value.get('vector_name')
124
+ if vector_name_other:
125
+ log.warning(f"Using different vector_name for vectorstore: {vector_name_other} overriding {vector_name}")
126
+ vector_name = vector_name_other
118
127
  vectorstore_obj = pick_vectorstore(vectorstore, vector_name=vector_name, embeddings=embeddings)
119
128
  vs_retriever = vectorstore_obj.as_retriever(search_kwargs=dict(k=3))
120
129
  vectorstore_list.append(vs_retriever)
@@ -1,9 +1,11 @@
1
1
  import os
2
2
  from urllib.parse import quote
3
3
  from datetime import datetime, timedelta
4
+
5
+ import google.auth # needs to be in minimal to check gcp
6
+
4
7
  try:
5
- from google.cloud import storage
6
- import google.auth
8
+ from google.cloud import storage
7
9
  from google.auth.transport import requests
8
10
  from google.auth.exceptions import RefreshError
9
11
  except ImportError:
@@ -159,12 +159,8 @@ def do_llamaindex(message_data, metadata, vector_name):
159
159
  # description=description,
160
160
  #)
161
161
 
162
-
163
- def llamaindex_chunker_check(message_data, metadata, vector_name):
164
- # llamaindex handles its own chunking/embedding
162
+ def check_llamaindex_in_memory(vector_name):
165
163
  memories = load_config_key("memory", vector_name=vector_name, type="vacConfig")
166
- total_memories = len(memories)
167
- llama = None
168
164
  for memory in memories: # Iterate over the list
169
165
  for key, value in memory.items(): # Now iterate over the dictionary
170
166
  log.info(f"Found memory {key}")
@@ -172,10 +168,19 @@ def llamaindex_chunker_check(message_data, metadata, vector_name):
172
168
  if vectorstore:
173
169
  log.info(f"Found vectorstore {vectorstore}")
174
170
  if vectorstore == "llamaindex":
175
- # https://cloud.google.com/vertex-ai/generative-ai/docs/llamaindex-on-vertexai
176
- log.info(f"llamaindex on vertex indexing for {vector_name}")
177
- llama = do_llamaindex(message_data, metadata, vector_name)
178
- log.info(f"Processed llamaindex: {llama}")
171
+
172
+ return True
173
+
174
+ return False
175
+
176
+ def llamaindex_chunker_check(message_data, metadata, vector_name):
177
+ # llamaindex handles its own chunking/embedding
178
+ memories = load_config_key("memory", vector_name=vector_name, type="vacConfig")
179
+ total_memories = len(memories)
180
+ llama = None
181
+ if check_llamaindex_in_memory(vector_name):
182
+ llama = do_llamaindex(message_data, metadata, vector_name)
183
+ log.info(f"Processed llamaindex: {llama}")
179
184
 
180
185
  # If llamaindex is the only entry, return
181
186
  if llama and total_memories == 1:
@@ -1,9 +1,9 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: sunholo
3
- Version: 0.58.0
3
+ Version: 0.58.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.58.0.tar.gz
6
+ Download-URL: https://github.com/sunholo-data/sunholo-py/archive/refs/tags/v0.58.3.tar.gz
7
7
  Author: Holosun ApS
8
8
  Author-email: multivac@sunholo.com
9
9
  License: Apache License, Version 2.0
@@ -21,6 +21,7 @@ License-File: LICENSE.txt
21
21
  Requires-Dist: langchain
22
22
  Requires-Dist: langchain-experimental
23
23
  Requires-Dist: langchain-community
24
+ Requires-Dist: google-auth
24
25
  Provides-Extra: all
25
26
  Requires-Dist: asyncpg ; extra == 'all'
26
27
  Requires-Dist: flask ; extra == 'all'
@@ -68,7 +69,6 @@ Requires-Dist: pgvector ; extra == 'database'
68
69
  Requires-Dist: psycopg2-binary ; extra == 'database'
69
70
  Requires-Dist: lancedb ; extra == 'database'
70
71
  Provides-Extra: gcp
71
- Requires-Dist: google-auth ; extra == 'gcp'
72
72
  Requires-Dist: google-auth-httplib2 ; extra == 'gcp'
73
73
  Requires-Dist: google-auth-oauthlib ; extra == 'gcp'
74
74
  Requires-Dist: google-cloud-aiplatform ; extra == 'gcp'
@@ -38,7 +38,7 @@ sunholo/cli/deploy.py,sha256=zxdwUsRTRMC8U5vyRv0JiKBLFn84Ug_Tc88-_h9hJSs,1609
38
38
  sunholo/components/__init__.py,sha256=RJGNEihwvRIiDScKis04RHJv4yZGI1UpXlOmuCptNZI,208
39
39
  sunholo/components/llm.py,sha256=T4we3tGmqUj4tPwxQr9M6AXv_BALqZV_dRSvINan-oU,10374
40
40
  sunholo/components/prompt.py,sha256=eZSghXkIlRzXiSrzgkG7e5ytUYq6R6LV-qjHU8jStig,6353
41
- sunholo/components/retriever.py,sha256=TiM-axCeaZ6CZ8rGKGx-io16JKDe8z0pnMccBi1yqHw,3509
41
+ sunholo/components/retriever.py,sha256=QA_l7HXwd4g6IFuT2A5mICzUcV80K0YvDbCtRxefq8o,3684
42
42
  sunholo/components/vectorstore.py,sha256=RB_Dgc9234G_TE3w3abCfBw1pqm2br2RrLP0UqshkvA,5172
43
43
  sunholo/database/__init__.py,sha256=Zz0Shcq-CtStf9rJGIYB_Ybzb8rY_Q9mfSj-nviM490,241
44
44
  sunholo/database/alloydb.py,sha256=18Q4AG_W-Sz8udIj3gWMkGrMWmiEelqgOwJ7VKHElV0,14877
@@ -53,17 +53,17 @@ sunholo/database/sql/sb/delete_source_row.sql,sha256=r6fEuUKdbiLHCDGKSbKINDCpJjs
53
53
  sunholo/database/sql/sb/return_sources.sql,sha256=89KAnxfK8n_qGK9jy1OQT8f9n4uYUtYL5cCxbC2mj_c,255
54
54
  sunholo/database/sql/sb/setup.sql,sha256=CvoFvZQev2uWjmFa3aj3m3iuPFzAAJZ0S7Qi3L3-zZI,89
55
55
  sunholo/embedder/__init__.py,sha256=sI4N_CqgEVcrMDxXgxKp1FsfsB4FpjoXgPGkl4N_u4I,44
56
- sunholo/embedder/embed_chunk.py,sha256=8kZI2XB1uB6joCqzVFjelqV3cXuqc6iog_SuFKR99x8,5376
56
+ sunholo/embedder/embed_chunk.py,sha256=XV1kdDUWw2QO-am5_Yl7GrYP9V_4i1XRNNFPhqUSnZQ,5851
57
57
  sunholo/gcs/__init__.py,sha256=DtVw_AZwQn-IguR5BJuIi2XJeF_FQXizhJikzRNrXiE,50
58
58
  sunholo/gcs/add_file.py,sha256=JmJIuz5Z1h7-eJ6s2eE3wc8Y4IAv3Jridq1xfQbD9_E,4711
59
- sunholo/gcs/download_url.py,sha256=PAwYShV-sRd9sNvuJrEOvfF1V34ovVP0omWbuwDkRrA,4751
59
+ sunholo/gcs/download_url.py,sha256=WnRF5H0IX9tyiuD4b_UfV2InsR8kDTi1VYfXpx5_Vc0,4791
60
60
  sunholo/gcs/metadata.py,sha256=C9sMPsHsq1ETetdQCqB3EBs3Kws8b8QHS9L7ei_v5aw,891
61
61
  sunholo/langfuse/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
62
62
  sunholo/langfuse/callback.py,sha256=G9xcZHpLvyzolU57ycItLaooMCtRuM37QJSWjiwQEd0,1776
63
63
  sunholo/langfuse/prompts.py,sha256=HO4Zy9usn5tKooBPCKksuw4Lff3c03Ny5wqn4ce_xZM,1217
64
64
  sunholo/llamaindex/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
65
65
  sunholo/llamaindex/generate.py,sha256=l1Picr-hVwkmAUD7XmTCa63qY9ERliFHQXwyX3BqB2Q,686
66
- sunholo/llamaindex/import_files.py,sha256=6VE4TvZP3oLaskzD9VSswFtIKJJbnhWXKkAvss191Rk,7758
66
+ sunholo/llamaindex/import_files.py,sha256=j71_rGIpZg1Zbsy-PnNIUgpNJznnsDiYxR6sulBlQ_8,7786
67
67
  sunholo/lookup/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
68
68
  sunholo/lookup/model_lookup.yaml,sha256=O7o-jP53MLA06C8pI-ILwERShO-xf6z_258wtpZBv6A,739
69
69
  sunholo/patches/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -89,9 +89,9 @@ sunholo/utils/gcp.py,sha256=B2G1YKjeD7X9dqO86Jrp2vPuFwZ223Xl5Tg09Ndw-oc,5760
89
89
  sunholo/utils/parsers.py,sha256=OrHmASqIbI45atVOhiGodgLvnfrzkvVzyHnSvAXD89I,3841
90
90
  sunholo/vertex/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
91
91
  sunholo/vertex/init_vertex.py,sha256=JDMUaBRdednzbKF-5p33qqLit2LMsvgvWW-NRz0AqO0,1801
92
- sunholo-0.58.0.dist-info/LICENSE.txt,sha256=SdE3QjnD3GEmqqg9EX3TM9f7WmtOzqS1KJve8rhbYmU,11345
93
- sunholo-0.58.0.dist-info/METADATA,sha256=SjGmg3X9BCN6olNH4NWI4uBnPexRuCNw5tMztrLCmhc,7894
94
- sunholo-0.58.0.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
95
- sunholo-0.58.0.dist-info/entry_points.txt,sha256=bZuN5AIHingMPt4Ro1b_T-FnQvZ3teBes-3OyO0asl4,49
96
- sunholo-0.58.0.dist-info/top_level.txt,sha256=wt5tadn5--5JrZsjJz2LceoUvcrIvxjHJe-RxuudxAk,8
97
- sunholo-0.58.0.dist-info/RECORD,,
92
+ sunholo-0.58.3.dist-info/LICENSE.txt,sha256=SdE3QjnD3GEmqqg9EX3TM9f7WmtOzqS1KJve8rhbYmU,11345
93
+ sunholo-0.58.3.dist-info/METADATA,sha256=b6EyBKaGDUvY355FAT2ZbVZgnnrFxiowbkhiAcQHe3Q,7877
94
+ sunholo-0.58.3.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
95
+ sunholo-0.58.3.dist-info/entry_points.txt,sha256=bZuN5AIHingMPt4Ro1b_T-FnQvZ3teBes-3OyO0asl4,49
96
+ sunholo-0.58.3.dist-info/top_level.txt,sha256=wt5tadn5--5JrZsjJz2LceoUvcrIvxjHJe-RxuudxAk,8
97
+ sunholo-0.58.3.dist-info/RECORD,,