sunholo 0.78.3__tar.gz → 0.78.5__tar.gz

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.
Files changed (148) hide show
  1. {sunholo-0.78.3 → sunholo-0.78.5}/PKG-INFO +2 -2
  2. {sunholo-0.78.3 → sunholo-0.78.5}/setup.py +1 -1
  3. {sunholo-0.78.3 → sunholo-0.78.5}/sunholo/components/llm.py +46 -16
  4. {sunholo-0.78.3 → sunholo-0.78.5}/sunholo/components/retriever.py +8 -2
  5. {sunholo-0.78.3 → sunholo-0.78.5}/sunholo/embedder/embed_chunk.py +8 -4
  6. {sunholo-0.78.3 → sunholo-0.78.5}/sunholo/gcs/add_file.py +1 -1
  7. {sunholo-0.78.3 → sunholo-0.78.5}/sunholo.egg-info/PKG-INFO +2 -2
  8. {sunholo-0.78.3 → sunholo-0.78.5}/LICENSE.txt +0 -0
  9. {sunholo-0.78.3 → sunholo-0.78.5}/MANIFEST.in +0 -0
  10. {sunholo-0.78.3 → sunholo-0.78.5}/README.md +0 -0
  11. {sunholo-0.78.3 → sunholo-0.78.5}/setup.cfg +0 -0
  12. {sunholo-0.78.3 → sunholo-0.78.5}/sunholo/__init__.py +0 -0
  13. {sunholo-0.78.3 → sunholo-0.78.5}/sunholo/agents/__init__.py +0 -0
  14. {sunholo-0.78.3 → sunholo-0.78.5}/sunholo/agents/chat_history.py +0 -0
  15. {sunholo-0.78.3 → sunholo-0.78.5}/sunholo/agents/dispatch_to_qa.py +0 -0
  16. {sunholo-0.78.3 → sunholo-0.78.5}/sunholo/agents/fastapi/__init__.py +0 -0
  17. {sunholo-0.78.3 → sunholo-0.78.5}/sunholo/agents/fastapi/base.py +0 -0
  18. {sunholo-0.78.3 → sunholo-0.78.5}/sunholo/agents/fastapi/qna_routes.py +0 -0
  19. {sunholo-0.78.3 → sunholo-0.78.5}/sunholo/agents/flask/__init__.py +0 -0
  20. {sunholo-0.78.3 → sunholo-0.78.5}/sunholo/agents/flask/base.py +0 -0
  21. {sunholo-0.78.3 → sunholo-0.78.5}/sunholo/agents/flask/qna_routes.py +0 -0
  22. {sunholo-0.78.3 → sunholo-0.78.5}/sunholo/agents/flask/vac_routes.py +0 -0
  23. {sunholo-0.78.3 → sunholo-0.78.5}/sunholo/agents/langserve.py +0 -0
  24. {sunholo-0.78.3 → sunholo-0.78.5}/sunholo/agents/pubsub.py +0 -0
  25. {sunholo-0.78.3 → sunholo-0.78.5}/sunholo/agents/route.py +0 -0
  26. {sunholo-0.78.3 → sunholo-0.78.5}/sunholo/agents/special_commands.py +0 -0
  27. {sunholo-0.78.3 → sunholo-0.78.5}/sunholo/agents/swagger.py +0 -0
  28. {sunholo-0.78.3 → sunholo-0.78.5}/sunholo/archive/__init__.py +0 -0
  29. {sunholo-0.78.3 → sunholo-0.78.5}/sunholo/archive/archive.py +0 -0
  30. {sunholo-0.78.3 → sunholo-0.78.5}/sunholo/auth/__init__.py +0 -0
  31. {sunholo-0.78.3 → sunholo-0.78.5}/sunholo/auth/gcloud.py +0 -0
  32. {sunholo-0.78.3 → sunholo-0.78.5}/sunholo/auth/refresh.py +0 -0
  33. {sunholo-0.78.3 → sunholo-0.78.5}/sunholo/auth/run.py +0 -0
  34. {sunholo-0.78.3 → sunholo-0.78.5}/sunholo/azure/__init__.py +0 -0
  35. {sunholo-0.78.3 → sunholo-0.78.5}/sunholo/azure/auth.py +0 -0
  36. {sunholo-0.78.3 → sunholo-0.78.5}/sunholo/azure/blobs.py +0 -0
  37. {sunholo-0.78.3 → sunholo-0.78.5}/sunholo/azure/event_grid.py +0 -0
  38. {sunholo-0.78.3 → sunholo-0.78.5}/sunholo/bots/__init__.py +0 -0
  39. {sunholo-0.78.3 → sunholo-0.78.5}/sunholo/bots/discord.py +0 -0
  40. {sunholo-0.78.3 → sunholo-0.78.5}/sunholo/bots/github_webhook.py +0 -0
  41. {sunholo-0.78.3 → sunholo-0.78.5}/sunholo/bots/webapp.py +0 -0
  42. {sunholo-0.78.3 → sunholo-0.78.5}/sunholo/chunker/__init__.py +0 -0
  43. {sunholo-0.78.3 → sunholo-0.78.5}/sunholo/chunker/azure.py +0 -0
  44. {sunholo-0.78.3 → sunholo-0.78.5}/sunholo/chunker/doc_handling.py +0 -0
  45. {sunholo-0.78.3 → sunholo-0.78.5}/sunholo/chunker/encode_metadata.py +0 -0
  46. {sunholo-0.78.3 → sunholo-0.78.5}/sunholo/chunker/images.py +0 -0
  47. {sunholo-0.78.3 → sunholo-0.78.5}/sunholo/chunker/loaders.py +0 -0
  48. {sunholo-0.78.3 → sunholo-0.78.5}/sunholo/chunker/message_data.py +0 -0
  49. {sunholo-0.78.3 → sunholo-0.78.5}/sunholo/chunker/pdfs.py +0 -0
  50. {sunholo-0.78.3 → sunholo-0.78.5}/sunholo/chunker/process_chunker_data.py +0 -0
  51. {sunholo-0.78.3 → sunholo-0.78.5}/sunholo/chunker/publish.py +0 -0
  52. {sunholo-0.78.3 → sunholo-0.78.5}/sunholo/chunker/pubsub.py +0 -0
  53. {sunholo-0.78.3 → sunholo-0.78.5}/sunholo/chunker/splitter.py +0 -0
  54. {sunholo-0.78.3 → sunholo-0.78.5}/sunholo/cli/__init__.py +0 -0
  55. {sunholo-0.78.3 → sunholo-0.78.5}/sunholo/cli/chat_vac.py +0 -0
  56. {sunholo-0.78.3 → sunholo-0.78.5}/sunholo/cli/cli.py +0 -0
  57. {sunholo-0.78.3 → sunholo-0.78.5}/sunholo/cli/cli_init.py +0 -0
  58. {sunholo-0.78.3 → sunholo-0.78.5}/sunholo/cli/configs.py +0 -0
  59. {sunholo-0.78.3 → sunholo-0.78.5}/sunholo/cli/deploy.py +0 -0
  60. {sunholo-0.78.3 → sunholo-0.78.5}/sunholo/cli/embedder.py +0 -0
  61. {sunholo-0.78.3 → sunholo-0.78.5}/sunholo/cli/merge_texts.py +0 -0
  62. {sunholo-0.78.3 → sunholo-0.78.5}/sunholo/cli/run_proxy.py +0 -0
  63. {sunholo-0.78.3 → sunholo-0.78.5}/sunholo/cli/sun_rich.py +0 -0
  64. {sunholo-0.78.3 → sunholo-0.78.5}/sunholo/cli/swagger.py +0 -0
  65. {sunholo-0.78.3 → sunholo-0.78.5}/sunholo/cli/vertex.py +0 -0
  66. {sunholo-0.78.3 → sunholo-0.78.5}/sunholo/components/__init__.py +0 -0
  67. {sunholo-0.78.3 → sunholo-0.78.5}/sunholo/components/vectorstore.py +0 -0
  68. {sunholo-0.78.3 → sunholo-0.78.5}/sunholo/database/__init__.py +0 -0
  69. {sunholo-0.78.3 → sunholo-0.78.5}/sunholo/database/alloydb.py +0 -0
  70. {sunholo-0.78.3 → sunholo-0.78.5}/sunholo/database/alloydb_client.py +0 -0
  71. {sunholo-0.78.3 → sunholo-0.78.5}/sunholo/database/database.py +0 -0
  72. {sunholo-0.78.3 → sunholo-0.78.5}/sunholo/database/lancedb.py +0 -0
  73. {sunholo-0.78.3 → sunholo-0.78.5}/sunholo/database/sql/sb/create_function.sql +0 -0
  74. {sunholo-0.78.3 → sunholo-0.78.5}/sunholo/database/sql/sb/create_function_time.sql +0 -0
  75. {sunholo-0.78.3 → sunholo-0.78.5}/sunholo/database/sql/sb/create_table.sql +0 -0
  76. {sunholo-0.78.3 → sunholo-0.78.5}/sunholo/database/sql/sb/delete_source_row.sql +0 -0
  77. {sunholo-0.78.3 → sunholo-0.78.5}/sunholo/database/sql/sb/return_sources.sql +0 -0
  78. {sunholo-0.78.3 → sunholo-0.78.5}/sunholo/database/sql/sb/setup.sql +0 -0
  79. {sunholo-0.78.3 → sunholo-0.78.5}/sunholo/database/static_dbs.py +0 -0
  80. {sunholo-0.78.3 → sunholo-0.78.5}/sunholo/database/uuid.py +0 -0
  81. {sunholo-0.78.3 → sunholo-0.78.5}/sunholo/discovery_engine/__init__.py +0 -0
  82. {sunholo-0.78.3 → sunholo-0.78.5}/sunholo/discovery_engine/chunker_handler.py +0 -0
  83. {sunholo-0.78.3 → sunholo-0.78.5}/sunholo/discovery_engine/create_new.py +0 -0
  84. {sunholo-0.78.3 → sunholo-0.78.5}/sunholo/discovery_engine/discovery_engine_client.py +0 -0
  85. {sunholo-0.78.3 → sunholo-0.78.5}/sunholo/embedder/__init__.py +0 -0
  86. {sunholo-0.78.3 → sunholo-0.78.5}/sunholo/gcs/__init__.py +0 -0
  87. {sunholo-0.78.3 → sunholo-0.78.5}/sunholo/gcs/download_folder.py +0 -0
  88. {sunholo-0.78.3 → sunholo-0.78.5}/sunholo/gcs/download_url.py +0 -0
  89. {sunholo-0.78.3 → sunholo-0.78.5}/sunholo/gcs/metadata.py +0 -0
  90. {sunholo-0.78.3 → sunholo-0.78.5}/sunholo/invoke/__init__.py +0 -0
  91. {sunholo-0.78.3 → sunholo-0.78.5}/sunholo/invoke/direct_vac_func.py +0 -0
  92. {sunholo-0.78.3 → sunholo-0.78.5}/sunholo/invoke/invoke_vac_utils.py +0 -0
  93. {sunholo-0.78.3 → sunholo-0.78.5}/sunholo/langfuse/__init__.py +0 -0
  94. {sunholo-0.78.3 → sunholo-0.78.5}/sunholo/langfuse/callback.py +0 -0
  95. {sunholo-0.78.3 → sunholo-0.78.5}/sunholo/langfuse/prompts.py +0 -0
  96. {sunholo-0.78.3 → sunholo-0.78.5}/sunholo/llamaindex/__init__.py +0 -0
  97. {sunholo-0.78.3 → sunholo-0.78.5}/sunholo/llamaindex/generate.py +0 -0
  98. {sunholo-0.78.3 → sunholo-0.78.5}/sunholo/llamaindex/get_files.py +0 -0
  99. {sunholo-0.78.3 → sunholo-0.78.5}/sunholo/llamaindex/import_files.py +0 -0
  100. {sunholo-0.78.3 → sunholo-0.78.5}/sunholo/logging.py +0 -0
  101. {sunholo-0.78.3 → sunholo-0.78.5}/sunholo/lookup/__init__.py +0 -0
  102. {sunholo-0.78.3 → sunholo-0.78.5}/sunholo/lookup/model_lookup.yaml +0 -0
  103. {sunholo-0.78.3 → sunholo-0.78.5}/sunholo/patches/__init__.py +0 -0
  104. {sunholo-0.78.3 → sunholo-0.78.5}/sunholo/patches/langchain/__init__.py +0 -0
  105. {sunholo-0.78.3 → sunholo-0.78.5}/sunholo/patches/langchain/lancedb.py +0 -0
  106. {sunholo-0.78.3 → sunholo-0.78.5}/sunholo/patches/langchain/vertexai.py +0 -0
  107. {sunholo-0.78.3 → sunholo-0.78.5}/sunholo/pubsub/__init__.py +0 -0
  108. {sunholo-0.78.3 → sunholo-0.78.5}/sunholo/pubsub/process_pubsub.py +0 -0
  109. {sunholo-0.78.3 → sunholo-0.78.5}/sunholo/pubsub/pubsub_manager.py +0 -0
  110. {sunholo-0.78.3 → sunholo-0.78.5}/sunholo/qna/__init__.py +0 -0
  111. {sunholo-0.78.3 → sunholo-0.78.5}/sunholo/qna/parsers.py +0 -0
  112. {sunholo-0.78.3 → sunholo-0.78.5}/sunholo/qna/retry.py +0 -0
  113. {sunholo-0.78.3 → sunholo-0.78.5}/sunholo/streaming/__init__.py +0 -0
  114. {sunholo-0.78.3 → sunholo-0.78.5}/sunholo/streaming/content_buffer.py +0 -0
  115. {sunholo-0.78.3 → sunholo-0.78.5}/sunholo/streaming/langserve.py +0 -0
  116. {sunholo-0.78.3 → sunholo-0.78.5}/sunholo/streaming/stream_lookup.py +0 -0
  117. {sunholo-0.78.3 → sunholo-0.78.5}/sunholo/streaming/streaming.py +0 -0
  118. {sunholo-0.78.3 → sunholo-0.78.5}/sunholo/summarise/__init__.py +0 -0
  119. {sunholo-0.78.3 → sunholo-0.78.5}/sunholo/summarise/summarise.py +0 -0
  120. {sunholo-0.78.3 → sunholo-0.78.5}/sunholo/tools/__init__.py +0 -0
  121. {sunholo-0.78.3 → sunholo-0.78.5}/sunholo/tools/web_browser.py +0 -0
  122. {sunholo-0.78.3 → sunholo-0.78.5}/sunholo/utils/__init__.py +0 -0
  123. {sunholo-0.78.3 → sunholo-0.78.5}/sunholo/utils/api_key.py +0 -0
  124. {sunholo-0.78.3 → sunholo-0.78.5}/sunholo/utils/big_context.py +0 -0
  125. {sunholo-0.78.3 → sunholo-0.78.5}/sunholo/utils/config.py +0 -0
  126. {sunholo-0.78.3 → sunholo-0.78.5}/sunholo/utils/config_class.py +0 -0
  127. {sunholo-0.78.3 → sunholo-0.78.5}/sunholo/utils/config_schema.py +0 -0
  128. {sunholo-0.78.3 → sunholo-0.78.5}/sunholo/utils/gcp.py +0 -0
  129. {sunholo-0.78.3 → sunholo-0.78.5}/sunholo/utils/gcp_project.py +0 -0
  130. {sunholo-0.78.3 → sunholo-0.78.5}/sunholo/utils/parsers.py +0 -0
  131. {sunholo-0.78.3 → sunholo-0.78.5}/sunholo/utils/timedelta.py +0 -0
  132. {sunholo-0.78.3 → sunholo-0.78.5}/sunholo/utils/user_ids.py +0 -0
  133. {sunholo-0.78.3 → sunholo-0.78.5}/sunholo/utils/version.py +0 -0
  134. {sunholo-0.78.3 → sunholo-0.78.5}/sunholo/vertex/__init__.py +0 -0
  135. {sunholo-0.78.3 → sunholo-0.78.5}/sunholo/vertex/extensions_call.py +0 -0
  136. {sunholo-0.78.3 → sunholo-0.78.5}/sunholo/vertex/extensions_class.py +0 -0
  137. {sunholo-0.78.3 → sunholo-0.78.5}/sunholo/vertex/genai_functions.py +0 -0
  138. {sunholo-0.78.3 → sunholo-0.78.5}/sunholo/vertex/init.py +0 -0
  139. {sunholo-0.78.3 → sunholo-0.78.5}/sunholo/vertex/memory_tools.py +0 -0
  140. {sunholo-0.78.3 → sunholo-0.78.5}/sunholo/vertex/safety.py +0 -0
  141. {sunholo-0.78.3 → sunholo-0.78.5}/sunholo/vertex/type_dict_to_json.py +0 -0
  142. {sunholo-0.78.3 → sunholo-0.78.5}/sunholo.egg-info/SOURCES.txt +0 -0
  143. {sunholo-0.78.3 → sunholo-0.78.5}/sunholo.egg-info/dependency_links.txt +0 -0
  144. {sunholo-0.78.3 → sunholo-0.78.5}/sunholo.egg-info/entry_points.txt +0 -0
  145. {sunholo-0.78.3 → sunholo-0.78.5}/sunholo.egg-info/requires.txt +0 -0
  146. {sunholo-0.78.3 → sunholo-0.78.5}/sunholo.egg-info/top_level.txt +0 -0
  147. {sunholo-0.78.3 → sunholo-0.78.5}/tests/test_chat_history.py +0 -0
  148. {sunholo-0.78.3 → sunholo-0.78.5}/tests/test_config.py +0 -0
@@ -1,9 +1,9 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: sunholo
3
- Version: 0.78.3
3
+ Version: 0.78.5
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.78.3.tar.gz
6
+ Download-URL: https://github.com/sunholo-data/sunholo-py/archive/refs/tags/v0.78.5.tar.gz
7
7
  Author: Holosun ApS
8
8
  Author-email: multivac@sunholo.com
9
9
  License: Apache License, Version 2.0
@@ -1,7 +1,7 @@
1
1
  from setuptools import setup, find_packages
2
2
 
3
3
  # Define your base version
4
- version = '0.78.3'
4
+ version = '0.78.5'
5
5
 
6
6
  setup(
7
7
  name='sunholo',
@@ -16,15 +16,22 @@ from ..utils import load_config_key, ConfigManager
16
16
 
17
17
  import os
18
18
 
19
- def pick_llm(vector_name):
19
+ def pick_llm(vector_name:str=None, config:ConfigManager=None):
20
+
21
+ if config is None:
22
+ if vector_name is None:
23
+ raise ValueError("config and vector_name was None")
24
+ config = ConfigManager(vector_name)
25
+
20
26
  log.debug('Picking llm')
21
27
 
22
- llm_str = load_config_key("llm", vector_name, kind="vacConfig")
28
+ llm_str = config.vacConfig("llm")
23
29
 
24
30
  if llm_str == 'openai':
25
- llm_chat = get_llm_chat(vector_name)
26
- llm = get_llm_chat(vector_name, model="gpt-3.5-turbo-16k") # TODO: fix it needs llm_chat and not llm
27
- embeddings = get_embeddings(vector_name)
31
+ llm_chat = get_llm_chat(config=config)
32
+ llm = get_llm_chat(model="gpt-3.5-turbo-16k", config=config) # TODO: fix it needs llm_chat and not llm
33
+ embeddings = get_embeddings(config=config)
34
+
28
35
  log.debug("Chose OpenAI")
29
36
  elif llm_str == 'vertex':
30
37
  llm = get_llm_chat(vector_name) # TODO: fix it needs llm_chat and not llm
@@ -62,7 +69,9 @@ def llm_str_to_llm(llm_str, model=None, vector_name=None, config=None):
62
69
  if llm_str is None:
63
70
  raise NotImplementedError("llm_str was None")
64
71
 
65
- if vector_name:
72
+ if config is None:
73
+ if vector_name is None:
74
+ raise ValueError("vector_name and config was None")
66
75
  config = ConfigManager(vector_name)
67
76
 
68
77
  if llm_str == 'openai':
@@ -125,10 +134,16 @@ def get_llm(vector_name=None, model=None, config=None):
125
134
  log.debug(f"Chose LLM: {llm_str}")
126
135
  return llm_str_to_llm(llm_str, model=model, config=config)
127
136
 
128
- def get_llm_chat(vector_name, model=None):
129
- llm_str = load_config_key("llm", vector_name, kind="vacConfig")
137
+ def get_llm_chat(vector_name:str=None, model=None, config:ConfigManager=None):
138
+
139
+ if config is None:
140
+ if vector_name is None:
141
+ raise ValueError("config and vector_name was None")
142
+ config = ConfigManager(vector_name)
143
+
144
+ llm_str = config.vacConfig("llm")
130
145
  if not model:
131
- model = load_config_key("model", vector_name, kind="vacConfig")
146
+ model = config.vacConfig("model")
132
147
 
133
148
  log.debug(f"Chose LLM: {llm_str}")
134
149
  # Configure LLMs based on llm_str
@@ -167,7 +182,7 @@ def get_llm_chat(vector_name, model=None):
167
182
  return ChatAnthropic(model_name = model, temperature=0)
168
183
  elif llm_str == 'azure':
169
184
  from langchain_openai import AzureChatOpenAI
170
- azure_config = load_config_key("azure", vector_name, kind="vacConfig")
185
+ azure_config = config.vacConfig("azure")
171
186
  if not azure_config:
172
187
  raise ValueError("Need to configure azure.config if llm='azure'")
173
188
 
@@ -209,22 +224,37 @@ def get_llm_chat(vector_name, model=None):
209
224
  if llm_str is None:
210
225
  raise NotImplementedError(f'No llm implemented for {llm_str}')
211
226
 
212
- def get_embeddings(vector_name):
227
+ def get_embeddings(vector_name=None, config:ConfigManager=None):
228
+
229
+ if not config:
230
+ if not vector_name:
231
+ raise ValueError(f"config and vector_name was None: {vector_name}")
232
+ config = ConfigManager(vector_name)
233
+
213
234
 
214
235
  llm_str = None
215
- embed_dict = load_config_key("embedder", vector_name, kind="vacConfig")
236
+ embed_dict = config.vacConfig("embedder")
216
237
 
217
238
  if embed_dict:
218
239
  llm_str = embed_dict.get('llm')
219
240
 
220
241
  if llm_str is None:
221
- llm_str = load_config_key("llm", vector_name, kind="vacConfig")
242
+ llm_str = config.vacConfig("llm")
243
+
244
+ if llm_str is None:
245
+ raise ValueError(f"llm_str was None: {llm_str}")
222
246
 
223
- return pick_embedding(llm_str, vector_name=vector_name)
247
+ return pick_embedding(llm_str, config=config)
224
248
 
225
249
 
226
250
  #TODO: specify model
227
- def pick_embedding(llm_str: str, vector_name: str=None):
251
+ def pick_embedding(llm_str: str, vector_name: str=None, config: ConfigManager=None):
252
+
253
+ if not config:
254
+ if not vector_name:
255
+ raise ValueError(f"config and vector_name was None {vector_name}")
256
+ config = ConfigManager(vector_name)
257
+
228
258
  # get embedding directly from llm_str
229
259
  # Configure embeddings based on llm_str
230
260
  if llm_str == 'openai':
@@ -244,7 +274,7 @@ def pick_embedding(llm_str: str, vector_name: str=None):
244
274
  elif llm_str == 'azure':
245
275
  from langchain_openai import AzureOpenAIEmbeddings
246
276
 
247
- azure_config = load_config_key("azure", vector_name, kind="vacConfig")
277
+ azure_config = config.vacConfig("azure")
248
278
  if not azure_config:
249
279
  raise ValueError("Need to configure azure.config if llm='azure'")
250
280
 
@@ -26,8 +26,14 @@ from langchain.retrievers import ContextualCompressionRetriever
26
26
 
27
27
 
28
28
 
29
- def load_memories(vector_name):
30
- memories = ConfigManager(vector_name).vacConfig("memory")
29
+ def load_memories(vector_name:str=None, config:ConfigManager=None):
30
+ if config is None:
31
+ if vector_name is None:
32
+ raise ValueError("vector_name and config were none")
33
+ config = ConfigManager(vector_name)
34
+
35
+ memories = config.vacConfig("memory")
36
+
31
37
  log.info(f"Found memory settings for {vector_name}: {memories}")
32
38
  if not memories or len(memories) == 0:
33
39
  log.info(f"No memory settings found for {vector_name}")
@@ -22,6 +22,7 @@ from langchain.schema import Document
22
22
  from ..components import get_embeddings, pick_vectorstore, load_memories, pick_embedding
23
23
  from ..logging import log
24
24
  from ..database.uuid import generate_uuid_from_object_id
25
+ from ..utils import ConfigManager
25
26
 
26
27
  def embed_pubsub_chunk(data: dict):
27
28
  """Triggered from a message on a Cloud Pub/Sub topic "embed_chunk" topic
@@ -63,6 +64,9 @@ def embed_pubsub_chunk(data: dict):
63
64
  log.error(msg)
64
65
  return msg
65
66
 
67
+ config = ConfigManager(vector_name)
68
+ log.info(f"{config=}")
69
+
66
70
  log.info(f"Embedding: {vector_name} page_content: {page_content[:30]}...[{len(page_content)}] - {metadata}")
67
71
 
68
72
  if 'eventTime' not in metadata:
@@ -95,16 +99,16 @@ def embed_pubsub_chunk(data: dict):
95
99
  doc_id = generate_uuid_from_object_id(metadata["url"])
96
100
  else:
97
101
  log.warning(f"Could not derive a uuid - creating random uuid for {metadata}")
98
- doc_id = uuid.uuid4()
102
+ doc_id = str(uuid.uuid4())
99
103
  else:
100
104
  doc_id = metadata["doc_id"]
101
105
 
102
106
  doc = Document(page_content=page_content, metadata=metadata)
103
107
 
104
108
  # init embedding and vector store
105
- embeddings = get_embeddings(vector_name)
109
+ embeddings = get_embeddings(config=config)
106
110
 
107
- memories = load_memories(vector_name)
111
+ memories = load_memories(config=config)
108
112
  vectorstore_list = []
109
113
  for memory in memories: # Iterate over the list
110
114
  for key, value in memory.items():
@@ -114,7 +118,7 @@ def embed_pubsub_chunk(data: dict):
114
118
  # check if vectorstore specific embedding is available
115
119
  embed_llm = value.get('llm')
116
120
  if embed_llm:
117
- embeddings = pick_embedding(embed_llm)
121
+ embeddings = pick_embedding(embed_llm, config=config)
118
122
  # check if read only
119
123
  read_only = value.get('read_only')
120
124
  if read_only:
@@ -46,7 +46,7 @@ def handle_base64_image(base64_data: str, vector_name: str, extension: str):
46
46
  header, encoded = base64_data.split(",", 1)
47
47
  data = base64.b64decode(encoded)
48
48
 
49
- filename = f"{uuid.uuid4()}{extension}"
49
+ filename = f"{str(uuid.uuid4())}{extension}"
50
50
  with open(filename, "wb") as f:
51
51
  f.write(data)
52
52
 
@@ -1,9 +1,9 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: sunholo
3
- Version: 0.78.3
3
+ Version: 0.78.5
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.78.3.tar.gz
6
+ Download-URL: https://github.com/sunholo-data/sunholo-py/archive/refs/tags/v0.78.5.tar.gz
7
7
  Author: Holosun ApS
8
8
  Author-email: multivac@sunholo.com
9
9
  License: Apache License, Version 2.0
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes