sunholo 0.92.2__tar.gz → 0.92.3__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 (160) hide show
  1. {sunholo-0.92.2 → sunholo-0.92.3}/PKG-INFO +2 -2
  2. {sunholo-0.92.2 → sunholo-0.92.3}/setup.py +1 -1
  3. {sunholo-0.92.2 → sunholo-0.92.3}/sunholo/agents/flask/vac_routes.py +12 -11
  4. {sunholo-0.92.2 → sunholo-0.92.3}/sunholo/genai/process_funcs_cls.py +56 -24
  5. {sunholo-0.92.2 → sunholo-0.92.3}/sunholo/utils/config_class.py +1 -0
  6. {sunholo-0.92.2 → sunholo-0.92.3}/sunholo.egg-info/PKG-INFO +2 -2
  7. {sunholo-0.92.2 → sunholo-0.92.3}/LICENSE.txt +0 -0
  8. {sunholo-0.92.2 → sunholo-0.92.3}/MANIFEST.in +0 -0
  9. {sunholo-0.92.2 → sunholo-0.92.3}/README.md +0 -0
  10. {sunholo-0.92.2 → sunholo-0.92.3}/setup.cfg +0 -0
  11. {sunholo-0.92.2 → sunholo-0.92.3}/sunholo/__init__.py +0 -0
  12. {sunholo-0.92.2 → sunholo-0.92.3}/sunholo/agents/__init__.py +0 -0
  13. {sunholo-0.92.2 → sunholo-0.92.3}/sunholo/agents/chat_history.py +0 -0
  14. {sunholo-0.92.2 → sunholo-0.92.3}/sunholo/agents/dispatch_to_qa.py +0 -0
  15. {sunholo-0.92.2 → sunholo-0.92.3}/sunholo/agents/fastapi/__init__.py +0 -0
  16. {sunholo-0.92.2 → sunholo-0.92.3}/sunholo/agents/fastapi/base.py +0 -0
  17. {sunholo-0.92.2 → sunholo-0.92.3}/sunholo/agents/fastapi/qna_routes.py +0 -0
  18. {sunholo-0.92.2 → sunholo-0.92.3}/sunholo/agents/flask/__init__.py +0 -0
  19. {sunholo-0.92.2 → sunholo-0.92.3}/sunholo/agents/flask/base.py +0 -0
  20. {sunholo-0.92.2 → sunholo-0.92.3}/sunholo/agents/flask/qna_routes.py +0 -0
  21. {sunholo-0.92.2 → sunholo-0.92.3}/sunholo/agents/langserve.py +0 -0
  22. {sunholo-0.92.2 → sunholo-0.92.3}/sunholo/agents/pubsub.py +0 -0
  23. {sunholo-0.92.2 → sunholo-0.92.3}/sunholo/agents/route.py +0 -0
  24. {sunholo-0.92.2 → sunholo-0.92.3}/sunholo/agents/special_commands.py +0 -0
  25. {sunholo-0.92.2 → sunholo-0.92.3}/sunholo/agents/swagger.py +0 -0
  26. {sunholo-0.92.2 → sunholo-0.92.3}/sunholo/archive/__init__.py +0 -0
  27. {sunholo-0.92.2 → sunholo-0.92.3}/sunholo/archive/archive.py +0 -0
  28. {sunholo-0.92.2 → sunholo-0.92.3}/sunholo/auth/__init__.py +0 -0
  29. {sunholo-0.92.2 → sunholo-0.92.3}/sunholo/auth/gcloud.py +0 -0
  30. {sunholo-0.92.2 → sunholo-0.92.3}/sunholo/auth/refresh.py +0 -0
  31. {sunholo-0.92.2 → sunholo-0.92.3}/sunholo/auth/run.py +0 -0
  32. {sunholo-0.92.2 → sunholo-0.92.3}/sunholo/azure/__init__.py +0 -0
  33. {sunholo-0.92.2 → sunholo-0.92.3}/sunholo/azure/auth.py +0 -0
  34. {sunholo-0.92.2 → sunholo-0.92.3}/sunholo/azure/blobs.py +0 -0
  35. {sunholo-0.92.2 → sunholo-0.92.3}/sunholo/azure/event_grid.py +0 -0
  36. {sunholo-0.92.2 → sunholo-0.92.3}/sunholo/bots/__init__.py +0 -0
  37. {sunholo-0.92.2 → sunholo-0.92.3}/sunholo/bots/discord.py +0 -0
  38. {sunholo-0.92.2 → sunholo-0.92.3}/sunholo/bots/github_webhook.py +0 -0
  39. {sunholo-0.92.2 → sunholo-0.92.3}/sunholo/bots/webapp.py +0 -0
  40. {sunholo-0.92.2 → sunholo-0.92.3}/sunholo/chunker/__init__.py +0 -0
  41. {sunholo-0.92.2 → sunholo-0.92.3}/sunholo/chunker/azure.py +0 -0
  42. {sunholo-0.92.2 → sunholo-0.92.3}/sunholo/chunker/doc_handling.py +0 -0
  43. {sunholo-0.92.2 → sunholo-0.92.3}/sunholo/chunker/encode_metadata.py +0 -0
  44. {sunholo-0.92.2 → sunholo-0.92.3}/sunholo/chunker/images.py +0 -0
  45. {sunholo-0.92.2 → sunholo-0.92.3}/sunholo/chunker/loaders.py +0 -0
  46. {sunholo-0.92.2 → sunholo-0.92.3}/sunholo/chunker/message_data.py +0 -0
  47. {sunholo-0.92.2 → sunholo-0.92.3}/sunholo/chunker/pdfs.py +0 -0
  48. {sunholo-0.92.2 → sunholo-0.92.3}/sunholo/chunker/process_chunker_data.py +0 -0
  49. {sunholo-0.92.2 → sunholo-0.92.3}/sunholo/chunker/publish.py +0 -0
  50. {sunholo-0.92.2 → sunholo-0.92.3}/sunholo/chunker/pubsub.py +0 -0
  51. {sunholo-0.92.2 → sunholo-0.92.3}/sunholo/chunker/splitter.py +0 -0
  52. {sunholo-0.92.2 → sunholo-0.92.3}/sunholo/cli/__init__.py +0 -0
  53. {sunholo-0.92.2 → sunholo-0.92.3}/sunholo/cli/chat_vac.py +0 -0
  54. {sunholo-0.92.2 → sunholo-0.92.3}/sunholo/cli/cli.py +0 -0
  55. {sunholo-0.92.2 → sunholo-0.92.3}/sunholo/cli/cli_init.py +0 -0
  56. {sunholo-0.92.2 → sunholo-0.92.3}/sunholo/cli/configs.py +0 -0
  57. {sunholo-0.92.2 → sunholo-0.92.3}/sunholo/cli/deploy.py +0 -0
  58. {sunholo-0.92.2 → sunholo-0.92.3}/sunholo/cli/embedder.py +0 -0
  59. {sunholo-0.92.2 → sunholo-0.92.3}/sunholo/cli/merge_texts.py +0 -0
  60. {sunholo-0.92.2 → sunholo-0.92.3}/sunholo/cli/run_proxy.py +0 -0
  61. {sunholo-0.92.2 → sunholo-0.92.3}/sunholo/cli/sun_rich.py +0 -0
  62. {sunholo-0.92.2 → sunholo-0.92.3}/sunholo/cli/swagger.py +0 -0
  63. {sunholo-0.92.2 → sunholo-0.92.3}/sunholo/cli/vertex.py +0 -0
  64. {sunholo-0.92.2 → sunholo-0.92.3}/sunholo/components/__init__.py +0 -0
  65. {sunholo-0.92.2 → sunholo-0.92.3}/sunholo/components/llm.py +0 -0
  66. {sunholo-0.92.2 → sunholo-0.92.3}/sunholo/components/retriever.py +0 -0
  67. {sunholo-0.92.2 → sunholo-0.92.3}/sunholo/components/vectorstore.py +0 -0
  68. {sunholo-0.92.2 → sunholo-0.92.3}/sunholo/custom_logging.py +0 -0
  69. {sunholo-0.92.2 → sunholo-0.92.3}/sunholo/database/__init__.py +0 -0
  70. {sunholo-0.92.2 → sunholo-0.92.3}/sunholo/database/alloydb.py +0 -0
  71. {sunholo-0.92.2 → sunholo-0.92.3}/sunholo/database/alloydb_client.py +0 -0
  72. {sunholo-0.92.2 → sunholo-0.92.3}/sunholo/database/database.py +0 -0
  73. {sunholo-0.92.2 → sunholo-0.92.3}/sunholo/database/lancedb.py +0 -0
  74. {sunholo-0.92.2 → sunholo-0.92.3}/sunholo/database/sql/sb/create_function.sql +0 -0
  75. {sunholo-0.92.2 → sunholo-0.92.3}/sunholo/database/sql/sb/create_function_time.sql +0 -0
  76. {sunholo-0.92.2 → sunholo-0.92.3}/sunholo/database/sql/sb/create_table.sql +0 -0
  77. {sunholo-0.92.2 → sunholo-0.92.3}/sunholo/database/sql/sb/delete_source_row.sql +0 -0
  78. {sunholo-0.92.2 → sunholo-0.92.3}/sunholo/database/sql/sb/return_sources.sql +0 -0
  79. {sunholo-0.92.2 → sunholo-0.92.3}/sunholo/database/sql/sb/setup.sql +0 -0
  80. {sunholo-0.92.2 → sunholo-0.92.3}/sunholo/database/static_dbs.py +0 -0
  81. {sunholo-0.92.2 → sunholo-0.92.3}/sunholo/database/uuid.py +0 -0
  82. {sunholo-0.92.2 → sunholo-0.92.3}/sunholo/discovery_engine/__init__.py +0 -0
  83. {sunholo-0.92.2 → sunholo-0.92.3}/sunholo/discovery_engine/chunker_handler.py +0 -0
  84. {sunholo-0.92.2 → sunholo-0.92.3}/sunholo/discovery_engine/create_new.py +0 -0
  85. {sunholo-0.92.2 → sunholo-0.92.3}/sunholo/discovery_engine/discovery_engine_client.py +0 -0
  86. {sunholo-0.92.2 → sunholo-0.92.3}/sunholo/discovery_engine/get_ai_search_chunks.py +0 -0
  87. {sunholo-0.92.2 → sunholo-0.92.3}/sunholo/embedder/__init__.py +0 -0
  88. {sunholo-0.92.2 → sunholo-0.92.3}/sunholo/embedder/embed_chunk.py +0 -0
  89. {sunholo-0.92.2 → sunholo-0.92.3}/sunholo/excel/__init__.py +0 -0
  90. {sunholo-0.92.2 → sunholo-0.92.3}/sunholo/excel/plugin.py +0 -0
  91. {sunholo-0.92.2 → sunholo-0.92.3}/sunholo/gcs/__init__.py +0 -0
  92. {sunholo-0.92.2 → sunholo-0.92.3}/sunholo/gcs/add_file.py +0 -0
  93. {sunholo-0.92.2 → sunholo-0.92.3}/sunholo/gcs/download_folder.py +0 -0
  94. {sunholo-0.92.2 → sunholo-0.92.3}/sunholo/gcs/download_url.py +0 -0
  95. {sunholo-0.92.2 → sunholo-0.92.3}/sunholo/gcs/metadata.py +0 -0
  96. {sunholo-0.92.2 → sunholo-0.92.3}/sunholo/genai/__init__.py +0 -0
  97. {sunholo-0.92.2 → sunholo-0.92.3}/sunholo/genai/init.py +0 -0
  98. {sunholo-0.92.2 → sunholo-0.92.3}/sunholo/genai/safety.py +0 -0
  99. {sunholo-0.92.2 → sunholo-0.92.3}/sunholo/invoke/__init__.py +0 -0
  100. {sunholo-0.92.2 → sunholo-0.92.3}/sunholo/invoke/async_class.py +0 -0
  101. {sunholo-0.92.2 → sunholo-0.92.3}/sunholo/invoke/direct_vac_func.py +0 -0
  102. {sunholo-0.92.2 → sunholo-0.92.3}/sunholo/invoke/invoke_vac_utils.py +0 -0
  103. {sunholo-0.92.2 → sunholo-0.92.3}/sunholo/langfuse/__init__.py +0 -0
  104. {sunholo-0.92.2 → sunholo-0.92.3}/sunholo/langfuse/callback.py +0 -0
  105. {sunholo-0.92.2 → sunholo-0.92.3}/sunholo/langfuse/evals.py +0 -0
  106. {sunholo-0.92.2 → sunholo-0.92.3}/sunholo/langfuse/prompts.py +0 -0
  107. {sunholo-0.92.2 → sunholo-0.92.3}/sunholo/llamaindex/__init__.py +0 -0
  108. {sunholo-0.92.2 → sunholo-0.92.3}/sunholo/llamaindex/get_files.py +0 -0
  109. {sunholo-0.92.2 → sunholo-0.92.3}/sunholo/llamaindex/import_files.py +0 -0
  110. {sunholo-0.92.2 → sunholo-0.92.3}/sunholo/llamaindex/llamaindex_class.py +0 -0
  111. {sunholo-0.92.2 → sunholo-0.92.3}/sunholo/llamaindex/user_history.py +0 -0
  112. {sunholo-0.92.2 → sunholo-0.92.3}/sunholo/lookup/__init__.py +0 -0
  113. {sunholo-0.92.2 → sunholo-0.92.3}/sunholo/lookup/model_lookup.yaml +0 -0
  114. {sunholo-0.92.2 → sunholo-0.92.3}/sunholo/patches/__init__.py +0 -0
  115. {sunholo-0.92.2 → sunholo-0.92.3}/sunholo/patches/langchain/__init__.py +0 -0
  116. {sunholo-0.92.2 → sunholo-0.92.3}/sunholo/patches/langchain/lancedb.py +0 -0
  117. {sunholo-0.92.2 → sunholo-0.92.3}/sunholo/patches/langchain/vertexai.py +0 -0
  118. {sunholo-0.92.2 → sunholo-0.92.3}/sunholo/pubsub/__init__.py +0 -0
  119. {sunholo-0.92.2 → sunholo-0.92.3}/sunholo/pubsub/process_pubsub.py +0 -0
  120. {sunholo-0.92.2 → sunholo-0.92.3}/sunholo/pubsub/pubsub_manager.py +0 -0
  121. {sunholo-0.92.2 → sunholo-0.92.3}/sunholo/qna/__init__.py +0 -0
  122. {sunholo-0.92.2 → sunholo-0.92.3}/sunholo/qna/parsers.py +0 -0
  123. {sunholo-0.92.2 → sunholo-0.92.3}/sunholo/qna/retry.py +0 -0
  124. {sunholo-0.92.2 → sunholo-0.92.3}/sunholo/streaming/__init__.py +0 -0
  125. {sunholo-0.92.2 → sunholo-0.92.3}/sunholo/streaming/content_buffer.py +0 -0
  126. {sunholo-0.92.2 → sunholo-0.92.3}/sunholo/streaming/langserve.py +0 -0
  127. {sunholo-0.92.2 → sunholo-0.92.3}/sunholo/streaming/stream_lookup.py +0 -0
  128. {sunholo-0.92.2 → sunholo-0.92.3}/sunholo/streaming/streaming.py +0 -0
  129. {sunholo-0.92.2 → sunholo-0.92.3}/sunholo/summarise/__init__.py +0 -0
  130. {sunholo-0.92.2 → sunholo-0.92.3}/sunholo/summarise/summarise.py +0 -0
  131. {sunholo-0.92.2 → sunholo-0.92.3}/sunholo/terraform/__init__.py +0 -0
  132. {sunholo-0.92.2 → sunholo-0.92.3}/sunholo/terraform/tfvars_editor.py +0 -0
  133. {sunholo-0.92.2 → sunholo-0.92.3}/sunholo/tools/__init__.py +0 -0
  134. {sunholo-0.92.2 → sunholo-0.92.3}/sunholo/tools/web_browser.py +0 -0
  135. {sunholo-0.92.2 → sunholo-0.92.3}/sunholo/utils/__init__.py +0 -0
  136. {sunholo-0.92.2 → sunholo-0.92.3}/sunholo/utils/api_key.py +0 -0
  137. {sunholo-0.92.2 → sunholo-0.92.3}/sunholo/utils/big_context.py +0 -0
  138. {sunholo-0.92.2 → sunholo-0.92.3}/sunholo/utils/config.py +0 -0
  139. {sunholo-0.92.2 → sunholo-0.92.3}/sunholo/utils/config_schema.py +0 -0
  140. {sunholo-0.92.2 → sunholo-0.92.3}/sunholo/utils/gcp.py +0 -0
  141. {sunholo-0.92.2 → sunholo-0.92.3}/sunholo/utils/gcp_project.py +0 -0
  142. {sunholo-0.92.2 → sunholo-0.92.3}/sunholo/utils/parsers.py +0 -0
  143. {sunholo-0.92.2 → sunholo-0.92.3}/sunholo/utils/timedelta.py +0 -0
  144. {sunholo-0.92.2 → sunholo-0.92.3}/sunholo/utils/user_ids.py +0 -0
  145. {sunholo-0.92.2 → sunholo-0.92.3}/sunholo/utils/version.py +0 -0
  146. {sunholo-0.92.2 → sunholo-0.92.3}/sunholo/vertex/__init__.py +0 -0
  147. {sunholo-0.92.2 → sunholo-0.92.3}/sunholo/vertex/extensions_call.py +0 -0
  148. {sunholo-0.92.2 → sunholo-0.92.3}/sunholo/vertex/extensions_class.py +0 -0
  149. {sunholo-0.92.2 → sunholo-0.92.3}/sunholo/vertex/genai_functions.py +0 -0
  150. {sunholo-0.92.2 → sunholo-0.92.3}/sunholo/vertex/init.py +0 -0
  151. {sunholo-0.92.2 → sunholo-0.92.3}/sunholo/vertex/memory_tools.py +0 -0
  152. {sunholo-0.92.2 → sunholo-0.92.3}/sunholo/vertex/safety.py +0 -0
  153. {sunholo-0.92.2 → sunholo-0.92.3}/sunholo/vertex/type_dict_to_json.py +0 -0
  154. {sunholo-0.92.2 → sunholo-0.92.3}/sunholo.egg-info/SOURCES.txt +0 -0
  155. {sunholo-0.92.2 → sunholo-0.92.3}/sunholo.egg-info/dependency_links.txt +0 -0
  156. {sunholo-0.92.2 → sunholo-0.92.3}/sunholo.egg-info/entry_points.txt +0 -0
  157. {sunholo-0.92.2 → sunholo-0.92.3}/sunholo.egg-info/requires.txt +0 -0
  158. {sunholo-0.92.2 → sunholo-0.92.3}/sunholo.egg-info/top_level.txt +0 -0
  159. {sunholo-0.92.2 → sunholo-0.92.3}/tests/test_chat_history.py +0 -0
  160. {sunholo-0.92.2 → sunholo-0.92.3}/tests/test_config.py +0 -0
@@ -1,9 +1,9 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: sunholo
3
- Version: 0.92.2
3
+ Version: 0.92.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.92.2.tar.gz
6
+ Download-URL: https://github.com/sunholo-data/sunholo-py/archive/refs/tags/v0.92.3.tar.gz
7
7
  Author: Holosun ApS
8
8
  Author-email: multivac@sunholo.com
9
9
  License: Apache License, Version 2.0
@@ -1,6 +1,6 @@
1
1
  from setuptools import setup, find_packages
2
2
 
3
- version = '0.92.2'
3
+ version = '0.92.3'
4
4
 
5
5
  setup(
6
6
  name='sunholo',
@@ -9,7 +9,7 @@ from ...qna.parsers import parse_output
9
9
  from ...streaming import start_streaming_chat
10
10
  from ...archive import archive_qa
11
11
  from ...custom_logging import log
12
- from ...utils.config import load_config
12
+ from ...utils import ConfigManager
13
13
  from ...utils.version import sunholo_version
14
14
  import os
15
15
  from ...gcs.add_file import add_file_to_gcs, handle_base64_image
@@ -178,7 +178,7 @@ if __name__ == "__main__":
178
178
  if span:
179
179
  generation = span.generation(
180
180
  name="start_streaming_chat",
181
- metadata=vac_config,
181
+ metadata=vac_config.configs_by_kind,
182
182
  input = all_input,
183
183
  completion_start_time=str(int(datetime.datetime.now().timestamp())),
184
184
  model=vac_config.get("model") or vac_config.get("llm")
@@ -264,7 +264,7 @@ if __name__ == "__main__":
264
264
  trace = prep["trace"]
265
265
  span = prep["span"]
266
266
  command_response = prep["command_response"]
267
- vac_config = prep["vac_config"]
267
+ vac_config: ConfigManager = prep["vac_config"]
268
268
  all_input = prep["all_input"]
269
269
 
270
270
  if command_response:
@@ -274,9 +274,9 @@ if __name__ == "__main__":
274
274
  if span:
275
275
  generation = span.generation(
276
276
  name="vac_interpreter",
277
- metadata=vac_config,
277
+ metadata=vac_config.configs_by_kind,
278
278
  input = all_input,
279
- model=vac_config.get("model") or vac_config.get("llm")
279
+ model=vac_config.vacConfig("model") or vac_config.vacConfig("llm")
280
280
  )
281
281
  bot_output = observed_vac_interpreter(
282
282
  question=all_input["user_input"],
@@ -534,13 +534,14 @@ if __name__ == "__main__":
534
534
  trace = self.create_langfuse_trace(request, vector_name, trace_id)
535
535
  log.info(f"Using existing langfuse trace: {trace_id}")
536
536
 
537
- config, _ = load_config("config/llm_config.yaml")
538
- vac_configs = config.get("vac")
539
- if vac_configs:
540
- vac_config = vac_configs[vector_name]
537
+ #config, _ = load_config("config/llm_config.yaml")
538
+ try:
539
+ vac_config = ConfigManager(vector_name)
540
+ except Exception as e:
541
+ raise ValueError(f"Unable to find vac_config for {vector_name} - {str(e)}")
541
542
 
542
543
  if trace:
543
- trace.update(input=data, metadata=vac_config)
544
+ trace.update(input=data, metadata=vac_config.configs_by_kind)
544
545
 
545
546
  user_input = data.pop('user_input').strip()
546
547
  stream_wait_time = data.pop('stream_wait_time', 7)
@@ -563,7 +564,7 @@ if __name__ == "__main__":
563
564
  if trace:
564
565
  span = trace.span(
565
566
  name="VAC",
566
- metadata=vac_config,
567
+ metadata=vac_config.configs_by_kind,
567
568
  input = all_input
568
569
  )
569
570
  command_response = handle_special_commands(user_input, vector_name, paired_messages)
@@ -10,6 +10,7 @@ import json
10
10
 
11
11
  try:
12
12
  import google.generativeai as genai
13
+ import proto
13
14
  except ImportError:
14
15
  genai = None
15
16
 
@@ -75,6 +76,8 @@ class GenAIFunctionProcessor:
75
76
 
76
77
  This method should be overridden in subclasses to provide the specific
77
78
  function implementations required for the application.
79
+
80
+ Note: All functions need arguments to avoid errors.
78
81
 
79
82
  Returns:
80
83
  dict: A dictionary where keys are function names and values are function objects
@@ -160,17 +163,24 @@ class GenAIFunctionProcessor:
160
163
  result = part[2]
161
164
 
162
165
  if func_name == function_name:
163
- if isinstance(result, list) and target_value in result:
164
- log.info(f"Target value '{target_value}' found in the result of function '{function_name}'.")
165
- return True
166
- elif isinstance(result, dict) and isinstance(target_value, dict):
167
- for key, expected_value in target_value.items():
168
- if key in result:
169
- if result[key] == expected_value:
170
- log.info(f"The key '{key}' has the same value in both dictionaries.")
171
- return True
166
+ # Try to decode the result if it's a string
167
+ if isinstance(result, str):
168
+ try:
169
+ result = json.loads(result)
170
+ except json.JSONDecodeError:
171
+ log.warning(f"Failed to decode JSON result for function {function_name}: {result}")
172
+ continue # Skip this result if decoding fails
173
+
174
+ normalized_target_value = {k: v for k, v in target_value.items()} if isinstance(target_value, dict) else target_value
175
+ log.info(f"{normalized_target_value=} {result=}")
176
+
177
+ if isinstance(result, dict) and isinstance(normalized_target_value, dict):
178
+ for key, expected_value in normalized_target_value.items():
179
+ if key in result and result[key] == expected_value:
180
+ log.info(f"The key '{key}' has the expected value in both dictionaries.")
181
+ return True
172
182
  return False
173
- elif result == target_value:
183
+ elif result == normalized_target_value:
174
184
  log.info(f"Target value '{target_value}' found in the result of function '{function_name}'.")
175
185
  return True
176
186
 
@@ -227,16 +237,30 @@ class GenAIFunctionProcessor:
227
237
  if fn := part.function_call:
228
238
  # Extract parameters for the function call
229
239
  function_name = fn.name
230
- params_obj = {key: val for key, val in fn.args.items()}
240
+
241
+ # Handle empty parameters
242
+ if fn.args is None or not fn.args:
243
+ params_obj = {}
244
+ else:
245
+ params_obj = {key: val for key, val in fn.args.items()}
246
+
231
247
  params = ', '.join(f'{key}={val}' for key, val in params_obj.items())
232
248
  log.info(f"Executing {function_name} with params {params}")
233
249
 
234
250
  # Check if the function is in our dictionary of available functions
235
251
  if function_name in self.funcs:
252
+ fn_exec = self.funcs[function_name]
236
253
  try:
237
- # Execute the function with the provided parameters
238
- result = self.funcs[function_name](**params_obj)
239
- log.info(f"Got result from {function_name}: {result}")
254
+ if not isinstance(fn_exec, genai.protos.FunctionDeclaration):
255
+ # Execute the function with the provided parameters
256
+ result = fn_exec(**params_obj)
257
+ log.info(f"Got result from {function_name}: {result}")
258
+ else:
259
+ fn_result = type(fn).to_dict(fn)
260
+ result = fn_result.get("result")
261
+ if not result:
262
+ log.warning("No result found for {function_name}")
263
+ log.info(f"No execution of {function_name} as a FunctionDeclatation object, just returning args {result}")
240
264
  except Exception as err:
241
265
  error_message = f"Error in {function_name}: {str(err)}"
242
266
  traceback_details = traceback.format_exc()
@@ -350,13 +374,13 @@ class GenAIFunctionProcessor:
350
374
  while guardrail < guardrail_max:
351
375
 
352
376
  callback.on_llm_new_token(
353
- token=f"\n----Loop [{guardrail}] Start------\nFunctions:\n{self.funcs.keys()}\n"
377
+ token=f"\n----Loop [{guardrail}] Start------\nFunctions: {list(self.funcs.keys())}\n"
354
378
  )
355
379
 
356
380
  content_parse = ""
357
381
  for i, chunk in enumerate(content):
358
382
  content_parse += f"\n - {i}) {chunk}"
359
- content_parse += f"\n== End input content for loop [{guardrail}] =="
383
+ content_parse += f"\n== End input content for loop [{guardrail}] =="
360
384
 
361
385
  log.info(f"== Start input content for loop [{guardrail}]\n ## Content: {content_parse}")
362
386
  this_text = "" # reset for this loop
@@ -367,7 +391,7 @@ class GenAIFunctionProcessor:
367
391
  response = chat.send_message(content, stream=True)
368
392
 
369
393
  except Exception as e:
370
- msg = f"Error sending {content} to model: {str(e)}"
394
+ msg = f"Error sending {content} to model: {str(e)} - {traceback.format_exc()}"
371
395
  log.info(msg)
372
396
  callback.on_llm_new_token(token=msg)
373
397
  break
@@ -421,6 +445,9 @@ class GenAIFunctionProcessor:
421
445
  callback.on_llm_new_token(token=f"\n--- function calling: {fn_log} ...\n")
422
446
 
423
447
  try:
448
+ # Convert MapComposite to a standard Python dictionary
449
+ if isinstance(fn_result, proto.marshal.collections.maps.MapComposite):
450
+ fn_result = dict(fn_result)
424
451
  fn_result_json = json.loads(fn_result)
425
452
  if not isinstance(fn_result_json, dict):
426
453
  log.warning(f"{fn_result} was loaded but is not a dictionary")
@@ -433,9 +460,15 @@ class GenAIFunctionProcessor:
433
460
  fn_result_json = None
434
461
 
435
462
  if fn == "decide_to_go_on":
436
- token = f"\n\n{'STOPPING' if not fn_result.get('go_on') else 'CONTINUE'}: {fn_result.get('chat_summary')}"
463
+ log.info(f"{fn_result_json} {fn_result=} {type(fn_result)}")
464
+ go_on_args = fn_result_json
465
+ if go_on_args:
466
+ token = f"\n\n{'STOPPING' if not go_on_args.get('go_on') else 'CONTINUE'}: {go_on_args.get('chat_summary')}"
467
+ else:
468
+ log.warning(f"{fn_result_json} did not work for decide_to_go_on")
469
+ token = f"Error calling decide_to_go_on with {fn_result_json}\n"
437
470
  else:
438
- token = f"--- function call result: {fn_log} ---"
471
+ token = f"--- {fn} call result: \n"
439
472
  if fn_result_json:
440
473
  if fn_result_json.get('stdout'):
441
474
  text = fn_result_json.get('stdout').encode('utf-8').decode('unicode_escape')
@@ -444,9 +477,9 @@ class GenAIFunctionProcessor:
444
477
  text = fn_result_json.get('stdout').encode('utf-8').decode('unicode_escape')
445
478
  token += text
446
479
  if not fn_result_json.get('stdout') and fn_result_json.get('stderr'):
447
- token += f" - result:\n{fn_result}\n"
480
+ token += f"{fn_result}\n"
448
481
  else:
449
- token += f" - result:\n{fn_result}\n"
482
+ token += f"{fn_result}\n--- {fn} result end ---\n"
450
483
 
451
484
  big_text += token
452
485
  this_text += token
@@ -479,11 +512,10 @@ class GenAIFunctionProcessor:
479
512
  break
480
513
 
481
514
  usage_metadata["functions_called"] = functions_called
482
- usage_metadata["function_results"] = function_results
515
+ #usage_metadata["function_results"] = function_results
483
516
 
484
517
  return big_text, usage_metadata
485
518
 
486
- # needs to be static to avoid bound methods in function call
487
519
  @staticmethod
488
520
  def decide_to_go_on(go_on: bool, chat_summary: str) -> dict:
489
521
  """
@@ -503,4 +535,4 @@ class GenAIFunctionProcessor:
503
535
  Returns:
504
536
  boolean: True to carry on, False to continue
505
537
  """
506
- return {"go_on": go_on, "chat_summary": chat_summary}
538
+ return json.dumps({"go_on": go_on, "chat_summary": chat_summary})
@@ -26,6 +26,7 @@ class ConfigManager:
26
26
  agent = config.vacConfig("agent")
27
27
  ```
28
28
  """
29
+ print(f"Current working directory: {os.getcwd()}")
29
30
  if os.getenv("VAC_CONFIG_FOLDER") is None:
30
31
  print("WARNING: No VAC_CONFIG_FOLDER environment variable was specified")
31
32
  local_config_folder = os.path.join(os.getcwd(), "config")
@@ -1,9 +1,9 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: sunholo
3
- Version: 0.92.2
3
+ Version: 0.92.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.92.2.tar.gz
6
+ Download-URL: https://github.com/sunholo-data/sunholo-py/archive/refs/tags/v0.92.3.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