sunholo 0.83.4__tar.gz → 0.84.0__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 (152) hide show
  1. {sunholo-0.83.4 → sunholo-0.84.0}/PKG-INFO +3 -3
  2. {sunholo-0.83.4 → sunholo-0.84.0}/setup.py +2 -2
  3. sunholo-0.84.0/sunholo/agents/flask/__init__.py +3 -0
  4. {sunholo-0.83.4 → sunholo-0.84.0}/sunholo/database/alloydb_client.py +31 -2
  5. sunholo-0.84.0/sunholo/invoke/async_class.py +89 -0
  6. {sunholo-0.83.4 → sunholo-0.84.0}/sunholo/llamaindex/llamaindex_class.py +9 -1
  7. {sunholo-0.83.4 → sunholo-0.84.0}/sunholo/llamaindex/user_history.py +16 -8
  8. {sunholo-0.83.4 → sunholo-0.84.0}/sunholo/utils/config_class.py +1 -1
  9. {sunholo-0.83.4 → sunholo-0.84.0}/sunholo.egg-info/PKG-INFO +3 -3
  10. {sunholo-0.83.4 → sunholo-0.84.0}/sunholo.egg-info/SOURCES.txt +1 -0
  11. {sunholo-0.83.4 → sunholo-0.84.0}/sunholo.egg-info/requires.txt +1 -1
  12. sunholo-0.83.4/sunholo/agents/flask/__init__.py +0 -2
  13. {sunholo-0.83.4 → sunholo-0.84.0}/LICENSE.txt +0 -0
  14. {sunholo-0.83.4 → sunholo-0.84.0}/MANIFEST.in +0 -0
  15. {sunholo-0.83.4 → sunholo-0.84.0}/README.md +0 -0
  16. {sunholo-0.83.4 → sunholo-0.84.0}/setup.cfg +0 -0
  17. {sunholo-0.83.4 → sunholo-0.84.0}/sunholo/__init__.py +0 -0
  18. {sunholo-0.83.4 → sunholo-0.84.0}/sunholo/agents/__init__.py +0 -0
  19. {sunholo-0.83.4 → sunholo-0.84.0}/sunholo/agents/chat_history.py +0 -0
  20. {sunholo-0.83.4 → sunholo-0.84.0}/sunholo/agents/dispatch_to_qa.py +0 -0
  21. {sunholo-0.83.4 → sunholo-0.84.0}/sunholo/agents/fastapi/__init__.py +0 -0
  22. {sunholo-0.83.4 → sunholo-0.84.0}/sunholo/agents/fastapi/base.py +0 -0
  23. {sunholo-0.83.4 → sunholo-0.84.0}/sunholo/agents/fastapi/qna_routes.py +0 -0
  24. {sunholo-0.83.4 → sunholo-0.84.0}/sunholo/agents/flask/base.py +0 -0
  25. {sunholo-0.83.4 → sunholo-0.84.0}/sunholo/agents/flask/qna_routes.py +0 -0
  26. {sunholo-0.83.4 → sunholo-0.84.0}/sunholo/agents/flask/vac_routes.py +0 -0
  27. {sunholo-0.83.4 → sunholo-0.84.0}/sunholo/agents/langserve.py +0 -0
  28. {sunholo-0.83.4 → sunholo-0.84.0}/sunholo/agents/pubsub.py +0 -0
  29. {sunholo-0.83.4 → sunholo-0.84.0}/sunholo/agents/route.py +0 -0
  30. {sunholo-0.83.4 → sunholo-0.84.0}/sunholo/agents/special_commands.py +0 -0
  31. {sunholo-0.83.4 → sunholo-0.84.0}/sunholo/agents/swagger.py +0 -0
  32. {sunholo-0.83.4 → sunholo-0.84.0}/sunholo/archive/__init__.py +0 -0
  33. {sunholo-0.83.4 → sunholo-0.84.0}/sunholo/archive/archive.py +0 -0
  34. {sunholo-0.83.4 → sunholo-0.84.0}/sunholo/auth/__init__.py +0 -0
  35. {sunholo-0.83.4 → sunholo-0.84.0}/sunholo/auth/gcloud.py +0 -0
  36. {sunholo-0.83.4 → sunholo-0.84.0}/sunholo/auth/refresh.py +0 -0
  37. {sunholo-0.83.4 → sunholo-0.84.0}/sunholo/auth/run.py +0 -0
  38. {sunholo-0.83.4 → sunholo-0.84.0}/sunholo/azure/__init__.py +0 -0
  39. {sunholo-0.83.4 → sunholo-0.84.0}/sunholo/azure/auth.py +0 -0
  40. {sunholo-0.83.4 → sunholo-0.84.0}/sunholo/azure/blobs.py +0 -0
  41. {sunholo-0.83.4 → sunholo-0.84.0}/sunholo/azure/event_grid.py +0 -0
  42. {sunholo-0.83.4 → sunholo-0.84.0}/sunholo/bots/__init__.py +0 -0
  43. {sunholo-0.83.4 → sunholo-0.84.0}/sunholo/bots/discord.py +0 -0
  44. {sunholo-0.83.4 → sunholo-0.84.0}/sunholo/bots/github_webhook.py +0 -0
  45. {sunholo-0.83.4 → sunholo-0.84.0}/sunholo/bots/webapp.py +0 -0
  46. {sunholo-0.83.4 → sunholo-0.84.0}/sunholo/chunker/__init__.py +0 -0
  47. {sunholo-0.83.4 → sunholo-0.84.0}/sunholo/chunker/azure.py +0 -0
  48. {sunholo-0.83.4 → sunholo-0.84.0}/sunholo/chunker/doc_handling.py +0 -0
  49. {sunholo-0.83.4 → sunholo-0.84.0}/sunholo/chunker/encode_metadata.py +0 -0
  50. {sunholo-0.83.4 → sunholo-0.84.0}/sunholo/chunker/images.py +0 -0
  51. {sunholo-0.83.4 → sunholo-0.84.0}/sunholo/chunker/loaders.py +0 -0
  52. {sunholo-0.83.4 → sunholo-0.84.0}/sunholo/chunker/message_data.py +0 -0
  53. {sunholo-0.83.4 → sunholo-0.84.0}/sunholo/chunker/pdfs.py +0 -0
  54. {sunholo-0.83.4 → sunholo-0.84.0}/sunholo/chunker/process_chunker_data.py +0 -0
  55. {sunholo-0.83.4 → sunholo-0.84.0}/sunholo/chunker/publish.py +0 -0
  56. {sunholo-0.83.4 → sunholo-0.84.0}/sunholo/chunker/pubsub.py +0 -0
  57. {sunholo-0.83.4 → sunholo-0.84.0}/sunholo/chunker/splitter.py +0 -0
  58. {sunholo-0.83.4 → sunholo-0.84.0}/sunholo/cli/__init__.py +0 -0
  59. {sunholo-0.83.4 → sunholo-0.84.0}/sunholo/cli/chat_vac.py +0 -0
  60. {sunholo-0.83.4 → sunholo-0.84.0}/sunholo/cli/cli.py +0 -0
  61. {sunholo-0.83.4 → sunholo-0.84.0}/sunholo/cli/cli_init.py +0 -0
  62. {sunholo-0.83.4 → sunholo-0.84.0}/sunholo/cli/configs.py +0 -0
  63. {sunholo-0.83.4 → sunholo-0.84.0}/sunholo/cli/deploy.py +0 -0
  64. {sunholo-0.83.4 → sunholo-0.84.0}/sunholo/cli/embedder.py +0 -0
  65. {sunholo-0.83.4 → sunholo-0.84.0}/sunholo/cli/merge_texts.py +0 -0
  66. {sunholo-0.83.4 → sunholo-0.84.0}/sunholo/cli/run_proxy.py +0 -0
  67. {sunholo-0.83.4 → sunholo-0.84.0}/sunholo/cli/sun_rich.py +0 -0
  68. {sunholo-0.83.4 → sunholo-0.84.0}/sunholo/cli/swagger.py +0 -0
  69. {sunholo-0.83.4 → sunholo-0.84.0}/sunholo/cli/vertex.py +0 -0
  70. {sunholo-0.83.4 → sunholo-0.84.0}/sunholo/components/__init__.py +0 -0
  71. {sunholo-0.83.4 → sunholo-0.84.0}/sunholo/components/llm.py +0 -0
  72. {sunholo-0.83.4 → sunholo-0.84.0}/sunholo/components/retriever.py +0 -0
  73. {sunholo-0.83.4 → sunholo-0.84.0}/sunholo/components/vectorstore.py +0 -0
  74. {sunholo-0.83.4 → sunholo-0.84.0}/sunholo/custom_logging.py +0 -0
  75. {sunholo-0.83.4 → sunholo-0.84.0}/sunholo/database/__init__.py +0 -0
  76. {sunholo-0.83.4 → sunholo-0.84.0}/sunholo/database/alloydb.py +0 -0
  77. {sunholo-0.83.4 → sunholo-0.84.0}/sunholo/database/database.py +0 -0
  78. {sunholo-0.83.4 → sunholo-0.84.0}/sunholo/database/lancedb.py +0 -0
  79. {sunholo-0.83.4 → sunholo-0.84.0}/sunholo/database/sql/sb/create_function.sql +0 -0
  80. {sunholo-0.83.4 → sunholo-0.84.0}/sunholo/database/sql/sb/create_function_time.sql +0 -0
  81. {sunholo-0.83.4 → sunholo-0.84.0}/sunholo/database/sql/sb/create_table.sql +0 -0
  82. {sunholo-0.83.4 → sunholo-0.84.0}/sunholo/database/sql/sb/delete_source_row.sql +0 -0
  83. {sunholo-0.83.4 → sunholo-0.84.0}/sunholo/database/sql/sb/return_sources.sql +0 -0
  84. {sunholo-0.83.4 → sunholo-0.84.0}/sunholo/database/sql/sb/setup.sql +0 -0
  85. {sunholo-0.83.4 → sunholo-0.84.0}/sunholo/database/static_dbs.py +0 -0
  86. {sunholo-0.83.4 → sunholo-0.84.0}/sunholo/database/uuid.py +0 -0
  87. {sunholo-0.83.4 → sunholo-0.84.0}/sunholo/discovery_engine/__init__.py +0 -0
  88. {sunholo-0.83.4 → sunholo-0.84.0}/sunholo/discovery_engine/chunker_handler.py +0 -0
  89. {sunholo-0.83.4 → sunholo-0.84.0}/sunholo/discovery_engine/create_new.py +0 -0
  90. {sunholo-0.83.4 → sunholo-0.84.0}/sunholo/discovery_engine/discovery_engine_client.py +0 -0
  91. {sunholo-0.83.4 → sunholo-0.84.0}/sunholo/discovery_engine/get_ai_search_chunks.py +0 -0
  92. {sunholo-0.83.4 → sunholo-0.84.0}/sunholo/embedder/__init__.py +0 -0
  93. {sunholo-0.83.4 → sunholo-0.84.0}/sunholo/embedder/embed_chunk.py +0 -0
  94. {sunholo-0.83.4 → sunholo-0.84.0}/sunholo/gcs/__init__.py +0 -0
  95. {sunholo-0.83.4 → sunholo-0.84.0}/sunholo/gcs/add_file.py +0 -0
  96. {sunholo-0.83.4 → sunholo-0.84.0}/sunholo/gcs/download_folder.py +0 -0
  97. {sunholo-0.83.4 → sunholo-0.84.0}/sunholo/gcs/download_url.py +0 -0
  98. {sunholo-0.83.4 → sunholo-0.84.0}/sunholo/gcs/metadata.py +0 -0
  99. {sunholo-0.83.4 → sunholo-0.84.0}/sunholo/invoke/__init__.py +0 -0
  100. {sunholo-0.83.4 → sunholo-0.84.0}/sunholo/invoke/direct_vac_func.py +0 -0
  101. {sunholo-0.83.4 → sunholo-0.84.0}/sunholo/invoke/invoke_vac_utils.py +0 -0
  102. {sunholo-0.83.4 → sunholo-0.84.0}/sunholo/langfuse/__init__.py +0 -0
  103. {sunholo-0.83.4 → sunholo-0.84.0}/sunholo/langfuse/callback.py +0 -0
  104. {sunholo-0.83.4 → sunholo-0.84.0}/sunholo/langfuse/prompts.py +0 -0
  105. {sunholo-0.83.4 → sunholo-0.84.0}/sunholo/llamaindex/__init__.py +0 -0
  106. {sunholo-0.83.4 → sunholo-0.84.0}/sunholo/llamaindex/get_files.py +0 -0
  107. {sunholo-0.83.4 → sunholo-0.84.0}/sunholo/llamaindex/import_files.py +0 -0
  108. {sunholo-0.83.4 → sunholo-0.84.0}/sunholo/lookup/__init__.py +0 -0
  109. {sunholo-0.83.4 → sunholo-0.84.0}/sunholo/lookup/model_lookup.yaml +0 -0
  110. {sunholo-0.83.4 → sunholo-0.84.0}/sunholo/patches/__init__.py +0 -0
  111. {sunholo-0.83.4 → sunholo-0.84.0}/sunholo/patches/langchain/__init__.py +0 -0
  112. {sunholo-0.83.4 → sunholo-0.84.0}/sunholo/patches/langchain/lancedb.py +0 -0
  113. {sunholo-0.83.4 → sunholo-0.84.0}/sunholo/patches/langchain/vertexai.py +0 -0
  114. {sunholo-0.83.4 → sunholo-0.84.0}/sunholo/pubsub/__init__.py +0 -0
  115. {sunholo-0.83.4 → sunholo-0.84.0}/sunholo/pubsub/process_pubsub.py +0 -0
  116. {sunholo-0.83.4 → sunholo-0.84.0}/sunholo/pubsub/pubsub_manager.py +0 -0
  117. {sunholo-0.83.4 → sunholo-0.84.0}/sunholo/qna/__init__.py +0 -0
  118. {sunholo-0.83.4 → sunholo-0.84.0}/sunholo/qna/parsers.py +0 -0
  119. {sunholo-0.83.4 → sunholo-0.84.0}/sunholo/qna/retry.py +0 -0
  120. {sunholo-0.83.4 → sunholo-0.84.0}/sunholo/streaming/__init__.py +0 -0
  121. {sunholo-0.83.4 → sunholo-0.84.0}/sunholo/streaming/content_buffer.py +0 -0
  122. {sunholo-0.83.4 → sunholo-0.84.0}/sunholo/streaming/langserve.py +0 -0
  123. {sunholo-0.83.4 → sunholo-0.84.0}/sunholo/streaming/stream_lookup.py +0 -0
  124. {sunholo-0.83.4 → sunholo-0.84.0}/sunholo/streaming/streaming.py +0 -0
  125. {sunholo-0.83.4 → sunholo-0.84.0}/sunholo/summarise/__init__.py +0 -0
  126. {sunholo-0.83.4 → sunholo-0.84.0}/sunholo/summarise/summarise.py +0 -0
  127. {sunholo-0.83.4 → sunholo-0.84.0}/sunholo/tools/__init__.py +0 -0
  128. {sunholo-0.83.4 → sunholo-0.84.0}/sunholo/tools/web_browser.py +0 -0
  129. {sunholo-0.83.4 → sunholo-0.84.0}/sunholo/utils/__init__.py +0 -0
  130. {sunholo-0.83.4 → sunholo-0.84.0}/sunholo/utils/api_key.py +0 -0
  131. {sunholo-0.83.4 → sunholo-0.84.0}/sunholo/utils/big_context.py +0 -0
  132. {sunholo-0.83.4 → sunholo-0.84.0}/sunholo/utils/config.py +0 -0
  133. {sunholo-0.83.4 → sunholo-0.84.0}/sunholo/utils/config_schema.py +0 -0
  134. {sunholo-0.83.4 → sunholo-0.84.0}/sunholo/utils/gcp.py +0 -0
  135. {sunholo-0.83.4 → sunholo-0.84.0}/sunholo/utils/gcp_project.py +0 -0
  136. {sunholo-0.83.4 → sunholo-0.84.0}/sunholo/utils/parsers.py +0 -0
  137. {sunholo-0.83.4 → sunholo-0.84.0}/sunholo/utils/timedelta.py +0 -0
  138. {sunholo-0.83.4 → sunholo-0.84.0}/sunholo/utils/user_ids.py +0 -0
  139. {sunholo-0.83.4 → sunholo-0.84.0}/sunholo/utils/version.py +0 -0
  140. {sunholo-0.83.4 → sunholo-0.84.0}/sunholo/vertex/__init__.py +0 -0
  141. {sunholo-0.83.4 → sunholo-0.84.0}/sunholo/vertex/extensions_call.py +0 -0
  142. {sunholo-0.83.4 → sunholo-0.84.0}/sunholo/vertex/extensions_class.py +0 -0
  143. {sunholo-0.83.4 → sunholo-0.84.0}/sunholo/vertex/genai_functions.py +0 -0
  144. {sunholo-0.83.4 → sunholo-0.84.0}/sunholo/vertex/init.py +0 -0
  145. {sunholo-0.83.4 → sunholo-0.84.0}/sunholo/vertex/memory_tools.py +0 -0
  146. {sunholo-0.83.4 → sunholo-0.84.0}/sunholo/vertex/safety.py +0 -0
  147. {sunholo-0.83.4 → sunholo-0.84.0}/sunholo/vertex/type_dict_to_json.py +0 -0
  148. {sunholo-0.83.4 → sunholo-0.84.0}/sunholo.egg-info/dependency_links.txt +0 -0
  149. {sunholo-0.83.4 → sunholo-0.84.0}/sunholo.egg-info/entry_points.txt +0 -0
  150. {sunholo-0.83.4 → sunholo-0.84.0}/sunholo.egg-info/top_level.txt +0 -0
  151. {sunholo-0.83.4 → sunholo-0.84.0}/tests/test_chat_history.py +0 -0
  152. {sunholo-0.83.4 → sunholo-0.84.0}/tests/test_config.py +0 -0
@@ -1,9 +1,9 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: sunholo
3
- Version: 0.83.4
3
+ Version: 0.84.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.83.4.tar.gz
6
+ Download-URL: https://github.com/sunholo-data/sunholo-py/archive/refs/tags/v0.84.0.tar.gz
7
7
  Author: Holosun ApS
8
8
  Author-email: multivac@sunholo.com
9
9
  License: Apache License, Version 2.0
@@ -49,7 +49,7 @@ Requires-Dist: httpx; extra == "all"
49
49
  Requires-Dist: jsonschema; extra == "all"
50
50
  Requires-Dist: lancedb; extra == "all"
51
51
  Requires-Dist: langchain>=0.2.12; extra == "all"
52
- Requires-Dist: llangchain-experimental>=0.0.61; extra == "all"
52
+ Requires-Dist: langchain-experimental>=0.0.61; extra == "all"
53
53
  Requires-Dist: langchain-community>=0.2.11; extra == "all"
54
54
  Requires-Dist: langchain-openai>=0.1.20; extra == "all"
55
55
  Requires-Dist: langchain-google-genai>=1.0.5; extra == "all"
@@ -1,7 +1,7 @@
1
1
  from setuptools import setup, find_packages
2
2
 
3
3
  # Define your base version
4
- version = '0.83.4'
4
+ version = '0.84.0'
5
5
 
6
6
  setup(
7
7
  name='sunholo',
@@ -63,7 +63,7 @@ setup(
63
63
  "jsonschema",
64
64
  "lancedb",
65
65
  "langchain>=0.2.12",
66
- "llangchain-experimental>=0.0.61",
66
+ "langchain-experimental>=0.0.61",
67
67
  "langchain-community>=0.2.11",
68
68
  "langchain-openai>=0.1.20",
69
69
  "langchain-google-genai>=1.0.5",
@@ -0,0 +1,3 @@
1
+ from .qna_routes import register_qna_routes
2
+ from .base import create_app
3
+ from .vac_routes import VACRoutes
@@ -9,6 +9,7 @@ except ImportError:
9
9
  pass
10
10
 
11
11
  from .database import get_vector_size
12
+ from .uuid import generate_uuid_from_object_id
12
13
  from ..custom_logging import log
13
14
  from ..utils import ConfigManager
14
15
 
@@ -122,10 +123,10 @@ class AlloyDBClient:
122
123
  region=self.config["region"],
123
124
  cluster=self.config["cluster"],
124
125
  instance=self.config["instance"],
125
- password=self.password,
126
126
  database=self.database,
127
127
  ip_type=self.config.get("ip_type") or IPTypes.PRIVATE
128
128
  )
129
+ self._loop = engine._loop
129
130
 
130
131
  log.info(f"Created AlloyDB engine for {engine}")
131
132
 
@@ -190,6 +191,34 @@ class AlloyDBClient:
190
191
  await conn.close()
191
192
 
192
193
  return result
194
+
195
+ def get_document_from_docstore(self, source:str, vector_name):
196
+ query = self._get_document_from_docstore(source, vector_name)
197
+
198
+ return self.execute_sql(query)
199
+
200
+ async def get_document_from_docstore_async(self, source:str, vector_name:str):
201
+ query = self._get_document_from_docstore(source, vector_name)
202
+
203
+ document = await self.execute_sql_async(query)
204
+
205
+ return document
206
+
207
+ def _get_document_from_docstore(self, source:str, vector_name:str):
208
+ if not isinstance(source, str):
209
+ raise ValueError("The 'source' parameter must be a single string, not a list of strings or other iterable.")
210
+
211
+ table_name = f"{vector_name}_docstore"
212
+ doc_id = generate_uuid_from_object_id(source)
213
+
214
+ query = f"""
215
+ SELECT *
216
+ FROM {table_name}
217
+ WHERE doc_id = {doc_id}
218
+ LIMIT 1;
219
+ """
220
+
221
+ return query
193
222
 
194
223
  async def get_sources_from_docstore_async(self, sources, vector_name, search_type="OR", just_source_name=False):
195
224
  """Fetches sources from the docstore asynchronously."""
@@ -233,7 +262,7 @@ class AlloyDBClient:
233
262
  FROM {table_name}
234
263
  WHERE {conditions}
235
264
  ORDER BY langchain_metadata->>'objectId' ASC
236
- LIMIT 500;
265
+ LIMIT 50;
237
266
  """
238
267
 
239
268
  return query
@@ -0,0 +1,89 @@
1
+ import asyncio
2
+ import logging
3
+ from typing import Callable, List, Any, Coroutine, Tuple
4
+
5
+ # Setup basic logging configuration
6
+ logging.basicConfig(level=logging.INFO)
7
+ logger = logging.getLogger(__name__)
8
+
9
+ class AsyncTaskRunner:
10
+ """
11
+ # Example async functions for testing
12
+ async def api_call_1(url, params):
13
+ await asyncio.sleep(1)
14
+ if "fail" in params:
15
+ raise ValueError(f"Error in api_call_1 with params: {params}")
16
+ return f"api_call_1 response from {url} with params {params}"
17
+
18
+ async def api_call_2(url, params):
19
+ await asyncio.sleep(2)
20
+ if "fail" in params:
21
+ raise ValueError(f"Error in api_call_2 with params: {params}")
22
+ return f"api_call_2 response from {url} with params {params}"
23
+
24
+ # Example usage in an existing async function
25
+ async def example_usage():
26
+ runner = AsyncTaskRunner()
27
+
28
+ runner.add_task(api_call_1, "http://example.com", {"key": "value"})
29
+ runner.add_task(api_call_2, "http://example.org", {"key": "fail"})
30
+
31
+ # Run all tasks within the existing event loop
32
+ results = await runner.run_async()
33
+ for result in results:
34
+ print(result)
35
+
36
+ # Example of calling run_sync() in a synchronous context
37
+ if __name__ == "__main__":
38
+ runner = AsyncTaskRunner()
39
+
40
+ runner.add_task(api_call_1, "http://example.com", {"key": "value"})
41
+ runner.add_task(api_call_2, "http://example.org", {"key": "fail"})
42
+
43
+ # Running in a synchronous context
44
+ results = runner.run_sync()
45
+ for result in results:
46
+ print(result)
47
+ """
48
+ def __init__(self):
49
+ self.tasks = []
50
+
51
+ def add_task(self, func: Callable[..., Coroutine], *args: Any):
52
+ """Adds a task (function and its arguments) to the list of tasks to be executed."""
53
+ logger.info(f"Adding task: {func.__name__} with args: {args}")
54
+ self.tasks.append(func(*args))
55
+
56
+ def add_group(self, functions: List[Callable[..., Coroutine]], *args: Any):
57
+ """Adds a group of functions that should run in parallel with the same arguments."""
58
+ group_tasks = [func(*args) for func in functions]
59
+ logger.info(f"Adding group of tasks with args: {args}")
60
+ self.tasks.append(asyncio.gather(*group_tasks, return_exceptions=True))
61
+
62
+ async def run_async(self) -> List[Any]:
63
+ """Runs all tasks using the current event loop and returns the results."""
64
+ logger.info("Running tasks asynchronously")
65
+ results = await asyncio.gather(*self.tasks, return_exceptions=True)
66
+ self._log_results(results)
67
+ return results
68
+
69
+ def run_sync(self) -> List[Any]:
70
+ """Runs all tasks synchronously (blocking) using a new event loop and returns the results."""
71
+ try:
72
+ logger.info("Running tasks synchronously")
73
+ loop = asyncio.get_running_loop()
74
+ return loop.run_until_complete(self.run_async())
75
+ except RuntimeError:
76
+ loop = asyncio.new_event_loop()
77
+ asyncio.set_event_loop(loop)
78
+ results = loop.run_until_complete(self.run_async())
79
+ loop.close()
80
+ return results
81
+
82
+ def _log_results(self, results: List[Any]):
83
+ """Logs the results of the task executions."""
84
+ for result in results:
85
+ if isinstance(result, Exception):
86
+ logger.error(f"Task resulted in an error: {result}")
87
+ else:
88
+ logger.info(f"Task completed successfully: {result}")
89
+
@@ -198,7 +198,12 @@ class LlamaIndexVertexCorpusManager:
198
198
  """
199
199
  List all VertexAI Corpus for the project/location
200
200
  """
201
- return rag.list_corpora()
201
+ try:
202
+ return rag.list_corpora()
203
+ except Exception as err:
204
+ log.error(f"Could not list corpora: {str(err)}")
205
+ return []
206
+
202
207
 
203
208
  def find_corpus_from_list(self, display_name: str):
204
209
  """
@@ -410,3 +415,6 @@ def setup_llamaindex_subparser(subparsers):
410
415
  query_parser.add_argument('vac', nargs='?', default="global", help='The VAC config to set it up for')
411
416
 
412
417
  llamaindex_parser.set_defaults(func=llamaindex_command)
418
+
419
+ # If no subcommand is provided, print the help message
420
+ llamaindex_parser.set_defaults(func=lambda args: llamaindex_parser.print_help() if args.action is None else llamaindex_command)
@@ -49,13 +49,21 @@ def add_user_history_rag(
49
49
 
50
50
  def get_user_history_chunks(user_id:str, config:ConfigManager, query):
51
51
 
52
- manager = LlamaIndexVertexCorpusManager(config)
52
+ try:
53
+ manager = LlamaIndexVertexCorpusManager(config)
53
54
 
54
- manager.create_corpus(user_id)
55
+ manager.create_corpus(user_id)
55
56
 
56
- response = manager.query_corpus(query, user_id)
57
- user_history_memory = []
58
- for chunk in response.contexts.contexts:
59
- user_history_memory.append(chunk.text)
60
-
61
- return "\n".join(user_history_memory)
57
+ response = manager.query_corpus(query, user_id)
58
+ log.info(f"User history got: {response=}")
59
+ user_history_memory = []
60
+ for chunk in response.contexts.contexts:
61
+ user_history_memory.append(chunk.text)
62
+
63
+ log.info(f"User history chunks: {user_history_memory}")
64
+
65
+ return "\n".join(user_history_memory)
66
+ except Exception as err:
67
+ log.error(f"Could not find user history due to error: {str(err)}")
68
+
69
+ return f"No user history available due to error: {str(err)}"
@@ -89,7 +89,7 @@ class ConfigManager:
89
89
  continue
90
90
  if filename.endswith(('.yaml', '.yml', '.json')):
91
91
  config_file = os.path.join(folder, filename)
92
- log.debug(f"Checking config file: {config_file}")
92
+
93
93
  if filename in self.config_cache:
94
94
  cached_config, cache_time = self.config_cache[filename]
95
95
  time_to_recache = (current_time - cache_time)
@@ -1,9 +1,9 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: sunholo
3
- Version: 0.83.4
3
+ Version: 0.84.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.83.4.tar.gz
6
+ Download-URL: https://github.com/sunholo-data/sunholo-py/archive/refs/tags/v0.84.0.tar.gz
7
7
  Author: Holosun ApS
8
8
  Author-email: multivac@sunholo.com
9
9
  License: Apache License, Version 2.0
@@ -49,7 +49,7 @@ Requires-Dist: httpx; extra == "all"
49
49
  Requires-Dist: jsonschema; extra == "all"
50
50
  Requires-Dist: lancedb; extra == "all"
51
51
  Requires-Dist: langchain>=0.2.12; extra == "all"
52
- Requires-Dist: llangchain-experimental>=0.0.61; extra == "all"
52
+ Requires-Dist: langchain-experimental>=0.0.61; extra == "all"
53
53
  Requires-Dist: langchain-community>=0.2.11; extra == "all"
54
54
  Requires-Dist: langchain-openai>=0.1.20; extra == "all"
55
55
  Requires-Dist: langchain-google-genai>=1.0.5; extra == "all"
@@ -94,6 +94,7 @@ sunholo/gcs/download_folder.py
94
94
  sunholo/gcs/download_url.py
95
95
  sunholo/gcs/metadata.py
96
96
  sunholo/invoke/__init__.py
97
+ sunholo/invoke/async_class.py
97
98
  sunholo/invoke/direct_vac_func.py
98
99
  sunholo/invoke/invoke_vac_utils.py
99
100
  sunholo/langfuse/__init__.py
@@ -30,7 +30,7 @@ httpx
30
30
  jsonschema
31
31
  lancedb
32
32
  langchain>=0.2.12
33
- llangchain-experimental>=0.0.61
33
+ langchain-experimental>=0.0.61
34
34
  langchain-community>=0.2.11
35
35
  langchain-openai>=0.1.20
36
36
  langchain-google-genai>=1.0.5
@@ -1,2 +0,0 @@
1
- from .qna_routes import register_qna_routes
2
- from .base import create_app
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