sunholo 0.140.8__tar.gz → 0.140.10__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 (188) hide show
  1. {sunholo-0.140.8/src/sunholo.egg-info → sunholo-0.140.10}/PKG-INFO +1 -1
  2. {sunholo-0.140.8 → sunholo-0.140.10}/pyproject.toml +1 -1
  3. {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/agents/flask/vac_routes.py +24 -101
  4. {sunholo-0.140.8 → sunholo-0.140.10/src/sunholo.egg-info}/PKG-INFO +1 -1
  5. {sunholo-0.140.8 → sunholo-0.140.10}/LICENSE.txt +0 -0
  6. {sunholo-0.140.8 → sunholo-0.140.10}/MANIFEST.in +0 -0
  7. {sunholo-0.140.8 → sunholo-0.140.10}/README.md +0 -0
  8. {sunholo-0.140.8 → sunholo-0.140.10}/setup.cfg +0 -0
  9. {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/__init__.py +0 -0
  10. {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/agents/__init__.py +0 -0
  11. {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/agents/chat_history.py +0 -0
  12. {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/agents/dispatch_to_qa.py +0 -0
  13. {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/agents/fastapi/__init__.py +0 -0
  14. {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/agents/fastapi/base.py +0 -0
  15. {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/agents/fastapi/qna_routes.py +0 -0
  16. {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/agents/flask/__init__.py +0 -0
  17. {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/agents/flask/base.py +0 -0
  18. {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/agents/langserve.py +0 -0
  19. {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/agents/pubsub.py +0 -0
  20. {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/agents/route.py +0 -0
  21. {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/agents/special_commands.py +0 -0
  22. {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/agents/swagger.py +0 -0
  23. {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/archive/__init__.py +0 -0
  24. {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/archive/archive.py +0 -0
  25. {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/auth/__init__.py +0 -0
  26. {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/auth/gcloud.py +0 -0
  27. {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/auth/refresh.py +0 -0
  28. {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/auth/run.py +0 -0
  29. {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/azure/__init__.py +0 -0
  30. {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/azure/auth.py +0 -0
  31. {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/azure/blobs.py +0 -0
  32. {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/azure/event_grid.py +0 -0
  33. {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/bots/__init__.py +0 -0
  34. {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/bots/discord.py +0 -0
  35. {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/bots/github_webhook.py +0 -0
  36. {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/bots/webapp.py +0 -0
  37. {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/chunker/__init__.py +0 -0
  38. {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/chunker/azure.py +0 -0
  39. {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/chunker/doc_handling.py +0 -0
  40. {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/chunker/encode_metadata.py +0 -0
  41. {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/chunker/images.py +0 -0
  42. {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/chunker/loaders.py +0 -0
  43. {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/chunker/message_data.py +0 -0
  44. {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/chunker/pdfs.py +0 -0
  45. {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/chunker/process_chunker_data.py +0 -0
  46. {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/chunker/publish.py +0 -0
  47. {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/chunker/pubsub.py +0 -0
  48. {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/chunker/splitter.py +0 -0
  49. {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/cli/__init__.py +0 -0
  50. {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/cli/chat_vac.py +0 -0
  51. {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/cli/cli.py +0 -0
  52. {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/cli/cli_init.py +0 -0
  53. {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/cli/configs.py +0 -0
  54. {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/cli/deploy.py +0 -0
  55. {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/cli/embedder.py +0 -0
  56. {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/cli/merge_texts.py +0 -0
  57. {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/cli/run_proxy.py +0 -0
  58. {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/cli/sun_rich.py +0 -0
  59. {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/cli/swagger.py +0 -0
  60. {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/cli/vertex.py +0 -0
  61. {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/components/__init__.py +0 -0
  62. {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/components/llm.py +0 -0
  63. {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/components/retriever.py +0 -0
  64. {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/components/vectorstore.py +0 -0
  65. {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/custom_logging.py +0 -0
  66. {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/database/__init__.py +0 -0
  67. {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/database/alloydb.py +0 -0
  68. {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/database/alloydb_client.py +0 -0
  69. {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/database/database.py +0 -0
  70. {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/database/lancedb.py +0 -0
  71. {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/database/sql/sb/create_function.sql +0 -0
  72. {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/database/sql/sb/create_function_time.sql +0 -0
  73. {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/database/sql/sb/create_table.sql +0 -0
  74. {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/database/sql/sb/delete_source_row.sql +0 -0
  75. {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/database/sql/sb/return_sources.sql +0 -0
  76. {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/database/sql/sb/setup.sql +0 -0
  77. {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/database/static_dbs.py +0 -0
  78. {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/database/uuid.py +0 -0
  79. {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/discovery_engine/__init__.py +0 -0
  80. {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/discovery_engine/chunker_handler.py +0 -0
  81. {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/discovery_engine/cli.py +0 -0
  82. {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/discovery_engine/create_new.py +0 -0
  83. {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/discovery_engine/discovery_engine_client.py +0 -0
  84. {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/discovery_engine/get_ai_search_chunks.py +0 -0
  85. {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/embedder/__init__.py +0 -0
  86. {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/embedder/embed_chunk.py +0 -0
  87. {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/embedder/embed_metadata.py +0 -0
  88. {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/excel/__init__.py +0 -0
  89. {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/excel/plugin.py +0 -0
  90. {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/gcs/__init__.py +0 -0
  91. {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/gcs/add_file.py +0 -0
  92. {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/gcs/download_folder.py +0 -0
  93. {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/gcs/download_gcs_text.py +0 -0
  94. {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/gcs/download_url.py +0 -0
  95. {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/gcs/extract_and_sign.py +0 -0
  96. {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/gcs/metadata.py +0 -0
  97. {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/genai/__init__.py +0 -0
  98. {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/genai/file_handling.py +0 -0
  99. {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/genai/genaiv2.py +0 -0
  100. {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/genai/images.py +0 -0
  101. {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/genai/init.py +0 -0
  102. {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/genai/process_funcs_cls.py +0 -0
  103. {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/genai/safety.py +0 -0
  104. {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/invoke/__init__.py +0 -0
  105. {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/invoke/async_class.py +0 -0
  106. {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/invoke/direct_vac_func.py +0 -0
  107. {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/invoke/invoke_vac_utils.py +0 -0
  108. {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/langchain_types.py +0 -0
  109. {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/langfuse/__init__.py +0 -0
  110. {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/langfuse/callback.py +0 -0
  111. {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/langfuse/evals.py +0 -0
  112. {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/langfuse/prompts.py +0 -0
  113. {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/llamaindex/__init__.py +0 -0
  114. {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/llamaindex/get_files.py +0 -0
  115. {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/llamaindex/import_files.py +0 -0
  116. {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/llamaindex/llamaindex_class.py +0 -0
  117. {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/llamaindex/user_history.py +0 -0
  118. {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/lookup/__init__.py +0 -0
  119. {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/lookup/model_lookup.yaml +0 -0
  120. {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/mcp/__init__.py +0 -0
  121. {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/mcp/cli.py +0 -0
  122. {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/ollama/__init__.py +0 -0
  123. {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/ollama/ollama_images.py +0 -0
  124. {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/pubsub/__init__.py +0 -0
  125. {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/pubsub/process_pubsub.py +0 -0
  126. {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/pubsub/pubsub_manager.py +0 -0
  127. {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/qna/__init__.py +0 -0
  128. {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/qna/parsers.py +0 -0
  129. {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/qna/retry.py +0 -0
  130. {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/senses/__init__.py +0 -0
  131. {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/senses/stream_voice.py +0 -0
  132. {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/streaming/__init__.py +0 -0
  133. {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/streaming/content_buffer.py +0 -0
  134. {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/streaming/langserve.py +0 -0
  135. {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/streaming/stream_lookup.py +0 -0
  136. {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/streaming/streaming.py +0 -0
  137. {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/summarise/__init__.py +0 -0
  138. {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/summarise/summarise.py +0 -0
  139. {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/templates/agent/__init__.py +0 -0
  140. {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/templates/agent/agent_service.py +0 -0
  141. {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/templates/agent/app.py +0 -0
  142. {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/templates/agent/my_log.py +0 -0
  143. {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/templates/agent/tools/__init__.py +0 -0
  144. {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/templates/agent/tools/your_agent.py +0 -0
  145. {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/templates/agent/vac_service.py +0 -0
  146. {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/templates/project/__init__.py +0 -0
  147. {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/templates/project/app.py +0 -0
  148. {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/templates/project/my_log.py +0 -0
  149. {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/templates/project/vac_service.py +0 -0
  150. {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/templates/system_services/__init__.py +0 -0
  151. {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/templates/system_services/app.py +0 -0
  152. {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/templates/system_services/my_log.py +0 -0
  153. {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/terraform/__init__.py +0 -0
  154. {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/terraform/tfvars_editor.py +0 -0
  155. {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/tools/__init__.py +0 -0
  156. {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/tools/web_browser.py +0 -0
  157. {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/utils/__init__.py +0 -0
  158. {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/utils/api_key.py +0 -0
  159. {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/utils/big_context.py +0 -0
  160. {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/utils/config.py +0 -0
  161. {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/utils/config_class.py +0 -0
  162. {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/utils/config_schema.py +0 -0
  163. {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/utils/gcp.py +0 -0
  164. {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/utils/gcp_project.py +0 -0
  165. {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/utils/mime.py +0 -0
  166. {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/utils/parsers.py +0 -0
  167. {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/utils/timedelta.py +0 -0
  168. {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/utils/user_ids.py +0 -0
  169. {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/utils/version.py +0 -0
  170. {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/vertex/__init__.py +0 -0
  171. {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/vertex/extensions_call.py +0 -0
  172. {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/vertex/extensions_class.py +0 -0
  173. {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/vertex/genai_functions.py +0 -0
  174. {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/vertex/init.py +0 -0
  175. {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/vertex/memory_tools.py +0 -0
  176. {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/vertex/safety.py +0 -0
  177. {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/vertex/type_dict_to_json.py +0 -0
  178. {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo.egg-info/SOURCES.txt +0 -0
  179. {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo.egg-info/dependency_links.txt +0 -0
  180. {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo.egg-info/entry_points.txt +0 -0
  181. {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo.egg-info/requires.txt +0 -0
  182. {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo.egg-info/top_level.txt +0 -0
  183. {sunholo-0.140.8 → sunholo-0.140.10}/tests/test_async.py +0 -0
  184. {sunholo-0.140.8 → sunholo-0.140.10}/tests/test_async_genai2.py +0 -0
  185. {sunholo-0.140.8 → sunholo-0.140.10}/tests/test_chat_history.py +0 -0
  186. {sunholo-0.140.8 → sunholo-0.140.10}/tests/test_config.py +0 -0
  187. {sunholo-0.140.8 → sunholo-0.140.10}/tests/test_genai2.py +0 -0
  188. {sunholo-0.140.8 → sunholo-0.140.10}/tests/test_unstructured.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: sunholo
3
- Version: 0.140.8
3
+ Version: 0.140.10
4
4
  Summary: AI DevOps - a package to help deploy GenAI to the Cloud.
5
5
  Author-email: Holosun ApS <multivac@sunholo.com>
6
6
  License: Apache License, Version 2.0
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "sunholo"
7
- version = "0.140.8"
7
+ version = "0.140.10"
8
8
  description = "AI DevOps - a package to help deploy GenAI to the Cloud."
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.10"
@@ -286,30 +286,20 @@ if __name__ == "__main__":
286
286
  log.warning(f"Background trace finalization failed: {e}")
287
287
 
288
288
  def handle_stream_vac(self, vector_name):
289
- request_start = time.time()
290
289
  observed_stream_interpreter = self.stream_interpreter
291
290
  is_async = inspect.iscoroutinefunction(self.stream_interpreter)
292
291
 
293
292
  if is_async:
294
293
  log.info(f"Stream interpreter is async: {observed_stream_interpreter}")
295
294
 
296
- # Call prep_vac and handle errors properly
297
- try:
298
- prep = self.prep_vac(request, vector_name)
299
- except Exception as e:
300
- log.error(f"prep_vac failed: {e}")
301
- error_response = {'error': f'Prep error: {str(e)}'}
302
- return jsonify(error_response), 500
303
-
304
- log.info(f"Processing prep completed in {time.time() - request_start:.3f}s")
305
-
306
- trace = prep.get("trace")
307
- span = prep.get("span")
295
+ prep = self.prep_vac(request, vector_name)
296
+ log.info(f"Processing prep: {prep}")
297
+ trace = prep["trace"]
298
+ span = prep["span"]
308
299
  vac_config = prep["vac_config"]
309
300
  all_input = prep["all_input"]
310
301
 
311
- log.info(f'Starting stream with: {all_input["user_input"][:100]}...')
312
-
302
+ log.info(f'Streaming data with: {all_input}')
313
303
  if span:
314
304
  span.update(
315
305
  name="start_streaming_chat",
@@ -320,7 +310,7 @@ if __name__ == "__main__":
320
310
  def generate_response_content():
321
311
  try:
322
312
  if is_async:
323
- from queue import Queue
313
+ from queue import Queue, Empty
324
314
  result_queue = Queue()
325
315
  import threading
326
316
 
@@ -337,7 +327,7 @@ if __name__ == "__main__":
337
327
  trace_id=trace.id if trace else None,
338
328
  **all_input["kwargs"]
339
329
  )
340
-
330
+ log.info(f"{async_gen=}")
341
331
  async for chunk in async_gen:
342
332
  if isinstance(chunk, dict) and 'answer' in chunk:
343
333
  if trace:
@@ -350,12 +340,9 @@ if __name__ == "__main__":
350
340
  else:
351
341
  result_queue.put(chunk)
352
342
  except Exception as e:
353
- error_msg = f"Streaming Error: {str(e)} {traceback.format_exc()}"
354
- log.error(error_msg)
355
- result_queue.put(error_msg)
343
+ result_queue.put(f"Streaming Error: {str(e)} {traceback.format_exc()}")
356
344
  finally:
357
345
  result_queue.put(None) # Sentinel
358
-
359
346
  asyncio.run(process_async())
360
347
 
361
348
  thread = threading.Thread(target=run_async)
@@ -370,7 +357,7 @@ if __name__ == "__main__":
370
357
 
371
358
  thread.join()
372
359
  else:
373
- log.info("Starting sync streaming response")
360
+ log.info("sync streaming response")
374
361
  for chunk in start_streaming_chat(
375
362
  question=all_input["user_input"],
376
363
  vector_name=vector_name,
@@ -394,19 +381,17 @@ if __name__ == "__main__":
394
381
  yield chunk
395
382
 
396
383
  except Exception as e:
397
- error_msg = f"Streaming Error: {str(e)} {traceback.format_exc()}"
398
- log.error(error_msg)
399
- yield error_msg
384
+ yield f"Streaming Error: {str(e)} {traceback.format_exc()}"
400
385
 
401
- # Create streaming response
386
+ # Here, the generator function will handle streaming the content to the client.
402
387
  response = Response(generate_response_content(), content_type='text/plain; charset=utf-8')
403
388
  response.headers['Transfer-Encoding'] = 'chunked'
404
389
 
405
- log.info(f"Streaming response created in {time.time() - request_start:.3f}s")
406
-
407
- # Do final trace operations in background (don't block the response)
390
+ log.debug(f"streaming response: {response}")
408
391
  if trace:
409
- _thread_pool.submit(self._finalize_trace_background, trace, span, response, all_input)
392
+ span.end(output=response)
393
+ trace.update(output=response)
394
+ self.langfuse_eval_response(trace_id=trace.id, eval_percent=all_input.get('eval_percent'))
410
395
 
411
396
  return response
412
397
 
@@ -780,14 +765,6 @@ if __name__ == "__main__":
780
765
  except Exception as e:
781
766
  raise ValueError(f"Unable to find vac_config for {vector_name} - {str(e)}")
782
767
 
783
- # Initialize trace variables
784
- trace = None
785
- span = None
786
- if self.add_langfuse_eval:
787
- trace_id = data.get('trace_id')
788
- # Create trace in background - don't block
789
- trace_future = _thread_pool.submit(self._create_langfuse_trace_background, request, vector_name, trace_id)
790
-
791
768
  # Extract data (keep original logic)
792
769
  user_input = data.pop('user_input').strip()
793
770
  stream_wait_time = data.pop('stream_wait_time', 7)
@@ -811,7 +788,7 @@ if __name__ == "__main__":
811
788
  finally:
812
789
  data.pop("_upload_future", None)
813
790
 
814
- # Build final input
791
+ # BUILD all_input BEFORE trace creation (this was moved inside try/catch by mistake)
815
792
  all_input = {
816
793
  'user_input': user_input,
817
794
  'vector_name': vector_name_param,
@@ -822,8 +799,15 @@ if __name__ == "__main__":
822
799
  'kwargs': data
823
800
  }
824
801
 
825
- # Try to get trace result if available (don't block long)
802
+ # Initialize trace variables
803
+ trace = None
804
+ span = None
826
805
  if self.add_langfuse_eval:
806
+ trace_id = data.get('trace_id')
807
+ # Create trace in background - don't block
808
+ trace_future = _thread_pool.submit(self._create_langfuse_trace_background, request, vector_name, trace_id)
809
+
810
+ # Try to get trace result if available (don't block long)
827
811
  try:
828
812
  trace = trace_future.result(timeout=0.1) # Very short timeout
829
813
  if trace:
@@ -853,67 +837,6 @@ if __name__ == "__main__":
853
837
  "vac_config": vac_config
854
838
  }
855
839
 
856
- async def prep_vac_async(self, request, vector_name):
857
- """Async version of prep_vac."""
858
- # Parse request data
859
- if request.content_type.startswith('application/json'):
860
- data = request.get_json()
861
- elif request.content_type.startswith('multipart/form-data'):
862
- data = request.form.to_dict()
863
- if 'file' in request.files:
864
- file = request.files['file']
865
- if file.filename != '':
866
- log.info(f"Found file: {file.filename} to upload to GCS")
867
- try:
868
- # Make file upload async if possible
869
- image_uri, mime_type = await self.handle_file_upload_async(file, vector_name)
870
- data["image_uri"] = image_uri
871
- data["mime"] = mime_type
872
- except Exception as e:
873
- log.error(traceback.format_exc())
874
- return jsonify({'error': str(e), 'traceback': traceback.format_exc()}), 500
875
- else:
876
- log.error("No file selected")
877
- return jsonify({"error": "No file selected"}), 400
878
- else:
879
- return jsonify({"error": "Unsupported content type"}), 400
880
-
881
- log.info(f"vac/{vector_name} got data: {data}")
882
-
883
- # Run these operations concurrently
884
- tasks = []
885
-
886
- # Extract other data while configs load
887
- user_input = data.pop('user_input').strip()
888
- stream_wait_time = data.pop('stream_wait_time', 7)
889
- stream_timeout = data.pop('stream_timeout', 120)
890
- chat_history = data.pop('chat_history', None)
891
- vector_name_param = data.pop('vector_name', vector_name)
892
- data.pop('trace_id', None) # to ensure not in kwargs
893
-
894
- # Task 3: Process chat history
895
- chat_history_task = asyncio.create_task(extract_chat_history_async_cached(chat_history))
896
- tasks.append(chat_history_task)
897
-
898
- # Await all tasks concurrently
899
- results = await asyncio.gather(*tasks, return_exceptions=True)
900
-
901
- paired_messages = results[0] if not isinstance(results[0], Exception) else []
902
-
903
- # Only create span after we have trace
904
- all_input = {
905
- 'user_input': user_input,
906
- 'vector_name': vector_name_param,
907
- 'chat_history': paired_messages,
908
- 'stream_wait_time': stream_wait_time,
909
- 'stream_timeout': stream_timeout,
910
- 'kwargs': data
911
- }
912
-
913
- return {
914
- "all_input": all_input
915
- }
916
-
917
840
  def handle_file_upload(self, file, vector_name):
918
841
  try:
919
842
  file.save(file.filename)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: sunholo
3
- Version: 0.140.8
3
+ Version: 0.140.10
4
4
  Summary: AI DevOps - a package to help deploy GenAI to the Cloud.
5
5
  Author-email: Holosun ApS <multivac@sunholo.com>
6
6
  License: Apache License, Version 2.0
File without changes
File without changes
File without changes
File without changes