sunholo 0.120.4__tar.gz → 0.120.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 (186) hide show
  1. {sunholo-0.120.4/src/sunholo.egg-info → sunholo-0.120.5}/PKG-INFO +1 -1
  2. {sunholo-0.120.4 → sunholo-0.120.5}/pyproject.toml +1 -1
  3. {sunholo-0.120.4 → sunholo-0.120.5}/src/sunholo/auth/refresh.py +1 -3
  4. {sunholo-0.120.4 → sunholo-0.120.5}/src/sunholo/genai/file_handling.py +36 -6
  5. {sunholo-0.120.4 → sunholo-0.120.5}/src/sunholo/streaming/streaming.py +21 -6
  6. {sunholo-0.120.4 → sunholo-0.120.5/src/sunholo.egg-info}/PKG-INFO +1 -1
  7. {sunholo-0.120.4 → sunholo-0.120.5}/LICENSE.txt +0 -0
  8. {sunholo-0.120.4 → sunholo-0.120.5}/MANIFEST.in +0 -0
  9. {sunholo-0.120.4 → sunholo-0.120.5}/README.md +0 -0
  10. {sunholo-0.120.4 → sunholo-0.120.5}/setup.cfg +0 -0
  11. {sunholo-0.120.4 → sunholo-0.120.5}/src/sunholo/__init__.py +0 -0
  12. {sunholo-0.120.4 → sunholo-0.120.5}/src/sunholo/agents/__init__.py +0 -0
  13. {sunholo-0.120.4 → sunholo-0.120.5}/src/sunholo/agents/chat_history.py +0 -0
  14. {sunholo-0.120.4 → sunholo-0.120.5}/src/sunholo/agents/dispatch_to_qa.py +0 -0
  15. {sunholo-0.120.4 → sunholo-0.120.5}/src/sunholo/agents/fastapi/__init__.py +0 -0
  16. {sunholo-0.120.4 → sunholo-0.120.5}/src/sunholo/agents/fastapi/base.py +0 -0
  17. {sunholo-0.120.4 → sunholo-0.120.5}/src/sunholo/agents/fastapi/qna_routes.py +0 -0
  18. {sunholo-0.120.4 → sunholo-0.120.5}/src/sunholo/agents/flask/__init__.py +0 -0
  19. {sunholo-0.120.4 → sunholo-0.120.5}/src/sunholo/agents/flask/base.py +0 -0
  20. {sunholo-0.120.4 → sunholo-0.120.5}/src/sunholo/agents/flask/qna_routes.py +0 -0
  21. {sunholo-0.120.4 → sunholo-0.120.5}/src/sunholo/agents/flask/vac_routes.py +0 -0
  22. {sunholo-0.120.4 → sunholo-0.120.5}/src/sunholo/agents/langserve.py +0 -0
  23. {sunholo-0.120.4 → sunholo-0.120.5}/src/sunholo/agents/pubsub.py +0 -0
  24. {sunholo-0.120.4 → sunholo-0.120.5}/src/sunholo/agents/route.py +0 -0
  25. {sunholo-0.120.4 → sunholo-0.120.5}/src/sunholo/agents/special_commands.py +0 -0
  26. {sunholo-0.120.4 → sunholo-0.120.5}/src/sunholo/agents/swagger.py +0 -0
  27. {sunholo-0.120.4 → sunholo-0.120.5}/src/sunholo/archive/__init__.py +0 -0
  28. {sunholo-0.120.4 → sunholo-0.120.5}/src/sunholo/archive/archive.py +0 -0
  29. {sunholo-0.120.4 → sunholo-0.120.5}/src/sunholo/auth/__init__.py +0 -0
  30. {sunholo-0.120.4 → sunholo-0.120.5}/src/sunholo/auth/gcloud.py +0 -0
  31. {sunholo-0.120.4 → sunholo-0.120.5}/src/sunholo/auth/run.py +0 -0
  32. {sunholo-0.120.4 → sunholo-0.120.5}/src/sunholo/azure/__init__.py +0 -0
  33. {sunholo-0.120.4 → sunholo-0.120.5}/src/sunholo/azure/auth.py +0 -0
  34. {sunholo-0.120.4 → sunholo-0.120.5}/src/sunholo/azure/blobs.py +0 -0
  35. {sunholo-0.120.4 → sunholo-0.120.5}/src/sunholo/azure/event_grid.py +0 -0
  36. {sunholo-0.120.4 → sunholo-0.120.5}/src/sunholo/bots/__init__.py +0 -0
  37. {sunholo-0.120.4 → sunholo-0.120.5}/src/sunholo/bots/discord.py +0 -0
  38. {sunholo-0.120.4 → sunholo-0.120.5}/src/sunholo/bots/github_webhook.py +0 -0
  39. {sunholo-0.120.4 → sunholo-0.120.5}/src/sunholo/bots/webapp.py +0 -0
  40. {sunholo-0.120.4 → sunholo-0.120.5}/src/sunholo/chunker/__init__.py +0 -0
  41. {sunholo-0.120.4 → sunholo-0.120.5}/src/sunholo/chunker/azure.py +0 -0
  42. {sunholo-0.120.4 → sunholo-0.120.5}/src/sunholo/chunker/doc_handling.py +0 -0
  43. {sunholo-0.120.4 → sunholo-0.120.5}/src/sunholo/chunker/encode_metadata.py +0 -0
  44. {sunholo-0.120.4 → sunholo-0.120.5}/src/sunholo/chunker/images.py +0 -0
  45. {sunholo-0.120.4 → sunholo-0.120.5}/src/sunholo/chunker/loaders.py +0 -0
  46. {sunholo-0.120.4 → sunholo-0.120.5}/src/sunholo/chunker/message_data.py +0 -0
  47. {sunholo-0.120.4 → sunholo-0.120.5}/src/sunholo/chunker/pdfs.py +0 -0
  48. {sunholo-0.120.4 → sunholo-0.120.5}/src/sunholo/chunker/process_chunker_data.py +0 -0
  49. {sunholo-0.120.4 → sunholo-0.120.5}/src/sunholo/chunker/publish.py +0 -0
  50. {sunholo-0.120.4 → sunholo-0.120.5}/src/sunholo/chunker/pubsub.py +0 -0
  51. {sunholo-0.120.4 → sunholo-0.120.5}/src/sunholo/chunker/splitter.py +0 -0
  52. {sunholo-0.120.4 → sunholo-0.120.5}/src/sunholo/cli/__init__.py +0 -0
  53. {sunholo-0.120.4 → sunholo-0.120.5}/src/sunholo/cli/chat_vac.py +0 -0
  54. {sunholo-0.120.4 → sunholo-0.120.5}/src/sunholo/cli/cli.py +0 -0
  55. {sunholo-0.120.4 → sunholo-0.120.5}/src/sunholo/cli/cli_init.py +0 -0
  56. {sunholo-0.120.4 → sunholo-0.120.5}/src/sunholo/cli/configs.py +0 -0
  57. {sunholo-0.120.4 → sunholo-0.120.5}/src/sunholo/cli/deploy.py +0 -0
  58. {sunholo-0.120.4 → sunholo-0.120.5}/src/sunholo/cli/embedder.py +0 -0
  59. {sunholo-0.120.4 → sunholo-0.120.5}/src/sunholo/cli/merge_texts.py +0 -0
  60. {sunholo-0.120.4 → sunholo-0.120.5}/src/sunholo/cli/run_proxy.py +0 -0
  61. {sunholo-0.120.4 → sunholo-0.120.5}/src/sunholo/cli/sun_rich.py +0 -0
  62. {sunholo-0.120.4 → sunholo-0.120.5}/src/sunholo/cli/swagger.py +0 -0
  63. {sunholo-0.120.4 → sunholo-0.120.5}/src/sunholo/cli/vertex.py +0 -0
  64. {sunholo-0.120.4 → sunholo-0.120.5}/src/sunholo/components/__init__.py +0 -0
  65. {sunholo-0.120.4 → sunholo-0.120.5}/src/sunholo/components/llm.py +0 -0
  66. {sunholo-0.120.4 → sunholo-0.120.5}/src/sunholo/components/retriever.py +0 -0
  67. {sunholo-0.120.4 → sunholo-0.120.5}/src/sunholo/components/vectorstore.py +0 -0
  68. {sunholo-0.120.4 → sunholo-0.120.5}/src/sunholo/custom_logging.py +0 -0
  69. {sunholo-0.120.4 → sunholo-0.120.5}/src/sunholo/database/__init__.py +0 -0
  70. {sunholo-0.120.4 → sunholo-0.120.5}/src/sunholo/database/alloydb.py +0 -0
  71. {sunholo-0.120.4 → sunholo-0.120.5}/src/sunholo/database/alloydb_client.py +0 -0
  72. {sunholo-0.120.4 → sunholo-0.120.5}/src/sunholo/database/database.py +0 -0
  73. {sunholo-0.120.4 → sunholo-0.120.5}/src/sunholo/database/lancedb.py +0 -0
  74. {sunholo-0.120.4 → sunholo-0.120.5}/src/sunholo/database/sql/sb/create_function.sql +0 -0
  75. {sunholo-0.120.4 → sunholo-0.120.5}/src/sunholo/database/sql/sb/create_function_time.sql +0 -0
  76. {sunholo-0.120.4 → sunholo-0.120.5}/src/sunholo/database/sql/sb/create_table.sql +0 -0
  77. {sunholo-0.120.4 → sunholo-0.120.5}/src/sunholo/database/sql/sb/delete_source_row.sql +0 -0
  78. {sunholo-0.120.4 → sunholo-0.120.5}/src/sunholo/database/sql/sb/return_sources.sql +0 -0
  79. {sunholo-0.120.4 → sunholo-0.120.5}/src/sunholo/database/sql/sb/setup.sql +0 -0
  80. {sunholo-0.120.4 → sunholo-0.120.5}/src/sunholo/database/static_dbs.py +0 -0
  81. {sunholo-0.120.4 → sunholo-0.120.5}/src/sunholo/database/uuid.py +0 -0
  82. {sunholo-0.120.4 → sunholo-0.120.5}/src/sunholo/discovery_engine/__init__.py +0 -0
  83. {sunholo-0.120.4 → sunholo-0.120.5}/src/sunholo/discovery_engine/chunker_handler.py +0 -0
  84. {sunholo-0.120.4 → sunholo-0.120.5}/src/sunholo/discovery_engine/cli.py +0 -0
  85. {sunholo-0.120.4 → sunholo-0.120.5}/src/sunholo/discovery_engine/create_new.py +0 -0
  86. {sunholo-0.120.4 → sunholo-0.120.5}/src/sunholo/discovery_engine/discovery_engine_client.py +0 -0
  87. {sunholo-0.120.4 → sunholo-0.120.5}/src/sunholo/discovery_engine/get_ai_search_chunks.py +0 -0
  88. {sunholo-0.120.4 → sunholo-0.120.5}/src/sunholo/embedder/__init__.py +0 -0
  89. {sunholo-0.120.4 → sunholo-0.120.5}/src/sunholo/embedder/embed_chunk.py +0 -0
  90. {sunholo-0.120.4 → sunholo-0.120.5}/src/sunholo/embedder/embed_metadata.py +0 -0
  91. {sunholo-0.120.4 → sunholo-0.120.5}/src/sunholo/excel/__init__.py +0 -0
  92. {sunholo-0.120.4 → sunholo-0.120.5}/src/sunholo/excel/plugin.py +0 -0
  93. {sunholo-0.120.4 → sunholo-0.120.5}/src/sunholo/gcs/__init__.py +0 -0
  94. {sunholo-0.120.4 → sunholo-0.120.5}/src/sunholo/gcs/add_file.py +0 -0
  95. {sunholo-0.120.4 → sunholo-0.120.5}/src/sunholo/gcs/download_folder.py +0 -0
  96. {sunholo-0.120.4 → sunholo-0.120.5}/src/sunholo/gcs/download_url.py +0 -0
  97. {sunholo-0.120.4 → sunholo-0.120.5}/src/sunholo/gcs/extract_and_sign.py +0 -0
  98. {sunholo-0.120.4 → sunholo-0.120.5}/src/sunholo/gcs/metadata.py +0 -0
  99. {sunholo-0.120.4 → sunholo-0.120.5}/src/sunholo/genai/__init__.py +0 -0
  100. {sunholo-0.120.4 → sunholo-0.120.5}/src/sunholo/genai/genaiv2.py +0 -0
  101. {sunholo-0.120.4 → sunholo-0.120.5}/src/sunholo/genai/images.py +0 -0
  102. {sunholo-0.120.4 → sunholo-0.120.5}/src/sunholo/genai/init.py +0 -0
  103. {sunholo-0.120.4 → sunholo-0.120.5}/src/sunholo/genai/process_funcs_cls.py +0 -0
  104. {sunholo-0.120.4 → sunholo-0.120.5}/src/sunholo/genai/safety.py +0 -0
  105. {sunholo-0.120.4 → sunholo-0.120.5}/src/sunholo/invoke/__init__.py +0 -0
  106. {sunholo-0.120.4 → sunholo-0.120.5}/src/sunholo/invoke/async_class.py +0 -0
  107. {sunholo-0.120.4 → sunholo-0.120.5}/src/sunholo/invoke/direct_vac_func.py +0 -0
  108. {sunholo-0.120.4 → sunholo-0.120.5}/src/sunholo/invoke/invoke_vac_utils.py +0 -0
  109. {sunholo-0.120.4 → sunholo-0.120.5}/src/sunholo/langchain_types.py +0 -0
  110. {sunholo-0.120.4 → sunholo-0.120.5}/src/sunholo/langfuse/__init__.py +0 -0
  111. {sunholo-0.120.4 → sunholo-0.120.5}/src/sunholo/langfuse/callback.py +0 -0
  112. {sunholo-0.120.4 → sunholo-0.120.5}/src/sunholo/langfuse/evals.py +0 -0
  113. {sunholo-0.120.4 → sunholo-0.120.5}/src/sunholo/langfuse/prompts.py +0 -0
  114. {sunholo-0.120.4 → sunholo-0.120.5}/src/sunholo/llamaindex/__init__.py +0 -0
  115. {sunholo-0.120.4 → sunholo-0.120.5}/src/sunholo/llamaindex/get_files.py +0 -0
  116. {sunholo-0.120.4 → sunholo-0.120.5}/src/sunholo/llamaindex/import_files.py +0 -0
  117. {sunholo-0.120.4 → sunholo-0.120.5}/src/sunholo/llamaindex/llamaindex_class.py +0 -0
  118. {sunholo-0.120.4 → sunholo-0.120.5}/src/sunholo/llamaindex/user_history.py +0 -0
  119. {sunholo-0.120.4 → sunholo-0.120.5}/src/sunholo/lookup/__init__.py +0 -0
  120. {sunholo-0.120.4 → sunholo-0.120.5}/src/sunholo/lookup/model_lookup.yaml +0 -0
  121. {sunholo-0.120.4 → sunholo-0.120.5}/src/sunholo/mcp/__init__.py +0 -0
  122. {sunholo-0.120.4 → sunholo-0.120.5}/src/sunholo/mcp/cli.py +0 -0
  123. {sunholo-0.120.4 → sunholo-0.120.5}/src/sunholo/pubsub/__init__.py +0 -0
  124. {sunholo-0.120.4 → sunholo-0.120.5}/src/sunholo/pubsub/process_pubsub.py +0 -0
  125. {sunholo-0.120.4 → sunholo-0.120.5}/src/sunholo/pubsub/pubsub_manager.py +0 -0
  126. {sunholo-0.120.4 → sunholo-0.120.5}/src/sunholo/qna/__init__.py +0 -0
  127. {sunholo-0.120.4 → sunholo-0.120.5}/src/sunholo/qna/parsers.py +0 -0
  128. {sunholo-0.120.4 → sunholo-0.120.5}/src/sunholo/qna/retry.py +0 -0
  129. {sunholo-0.120.4 → sunholo-0.120.5}/src/sunholo/senses/__init__.py +0 -0
  130. {sunholo-0.120.4 → sunholo-0.120.5}/src/sunholo/senses/stream_voice.py +0 -0
  131. {sunholo-0.120.4 → sunholo-0.120.5}/src/sunholo/streaming/__init__.py +0 -0
  132. {sunholo-0.120.4 → sunholo-0.120.5}/src/sunholo/streaming/content_buffer.py +0 -0
  133. {sunholo-0.120.4 → sunholo-0.120.5}/src/sunholo/streaming/langserve.py +0 -0
  134. {sunholo-0.120.4 → sunholo-0.120.5}/src/sunholo/streaming/stream_lookup.py +0 -0
  135. {sunholo-0.120.4 → sunholo-0.120.5}/src/sunholo/summarise/__init__.py +0 -0
  136. {sunholo-0.120.4 → sunholo-0.120.5}/src/sunholo/summarise/summarise.py +0 -0
  137. {sunholo-0.120.4 → sunholo-0.120.5}/src/sunholo/templates/agent/__init__.py +0 -0
  138. {sunholo-0.120.4 → sunholo-0.120.5}/src/sunholo/templates/agent/agent_service.py +0 -0
  139. {sunholo-0.120.4 → sunholo-0.120.5}/src/sunholo/templates/agent/app.py +0 -0
  140. {sunholo-0.120.4 → sunholo-0.120.5}/src/sunholo/templates/agent/my_log.py +0 -0
  141. {sunholo-0.120.4 → sunholo-0.120.5}/src/sunholo/templates/agent/tools/__init__.py +0 -0
  142. {sunholo-0.120.4 → sunholo-0.120.5}/src/sunholo/templates/agent/tools/your_agent.py +0 -0
  143. {sunholo-0.120.4 → sunholo-0.120.5}/src/sunholo/templates/agent/vac_service.py +0 -0
  144. {sunholo-0.120.4 → sunholo-0.120.5}/src/sunholo/templates/project/__init__.py +0 -0
  145. {sunholo-0.120.4 → sunholo-0.120.5}/src/sunholo/templates/project/app.py +0 -0
  146. {sunholo-0.120.4 → sunholo-0.120.5}/src/sunholo/templates/project/my_log.py +0 -0
  147. {sunholo-0.120.4 → sunholo-0.120.5}/src/sunholo/templates/project/vac_service.py +0 -0
  148. {sunholo-0.120.4 → sunholo-0.120.5}/src/sunholo/templates/system_services/__init__.py +0 -0
  149. {sunholo-0.120.4 → sunholo-0.120.5}/src/sunholo/templates/system_services/app.py +0 -0
  150. {sunholo-0.120.4 → sunholo-0.120.5}/src/sunholo/templates/system_services/my_log.py +0 -0
  151. {sunholo-0.120.4 → sunholo-0.120.5}/src/sunholo/terraform/__init__.py +0 -0
  152. {sunholo-0.120.4 → sunholo-0.120.5}/src/sunholo/terraform/tfvars_editor.py +0 -0
  153. {sunholo-0.120.4 → sunholo-0.120.5}/src/sunholo/tools/__init__.py +0 -0
  154. {sunholo-0.120.4 → sunholo-0.120.5}/src/sunholo/tools/web_browser.py +0 -0
  155. {sunholo-0.120.4 → sunholo-0.120.5}/src/sunholo/utils/__init__.py +0 -0
  156. {sunholo-0.120.4 → sunholo-0.120.5}/src/sunholo/utils/api_key.py +0 -0
  157. {sunholo-0.120.4 → sunholo-0.120.5}/src/sunholo/utils/big_context.py +0 -0
  158. {sunholo-0.120.4 → sunholo-0.120.5}/src/sunholo/utils/config.py +0 -0
  159. {sunholo-0.120.4 → sunholo-0.120.5}/src/sunholo/utils/config_class.py +0 -0
  160. {sunholo-0.120.4 → sunholo-0.120.5}/src/sunholo/utils/config_schema.py +0 -0
  161. {sunholo-0.120.4 → sunholo-0.120.5}/src/sunholo/utils/gcp.py +0 -0
  162. {sunholo-0.120.4 → sunholo-0.120.5}/src/sunholo/utils/gcp_project.py +0 -0
  163. {sunholo-0.120.4 → sunholo-0.120.5}/src/sunholo/utils/mime.py +0 -0
  164. {sunholo-0.120.4 → sunholo-0.120.5}/src/sunholo/utils/parsers.py +0 -0
  165. {sunholo-0.120.4 → sunholo-0.120.5}/src/sunholo/utils/timedelta.py +0 -0
  166. {sunholo-0.120.4 → sunholo-0.120.5}/src/sunholo/utils/user_ids.py +0 -0
  167. {sunholo-0.120.4 → sunholo-0.120.5}/src/sunholo/utils/version.py +0 -0
  168. {sunholo-0.120.4 → sunholo-0.120.5}/src/sunholo/vertex/__init__.py +0 -0
  169. {sunholo-0.120.4 → sunholo-0.120.5}/src/sunholo/vertex/extensions_call.py +0 -0
  170. {sunholo-0.120.4 → sunholo-0.120.5}/src/sunholo/vertex/extensions_class.py +0 -0
  171. {sunholo-0.120.4 → sunholo-0.120.5}/src/sunholo/vertex/genai_functions.py +0 -0
  172. {sunholo-0.120.4 → sunholo-0.120.5}/src/sunholo/vertex/init.py +0 -0
  173. {sunholo-0.120.4 → sunholo-0.120.5}/src/sunholo/vertex/memory_tools.py +0 -0
  174. {sunholo-0.120.4 → sunholo-0.120.5}/src/sunholo/vertex/safety.py +0 -0
  175. {sunholo-0.120.4 → sunholo-0.120.5}/src/sunholo/vertex/type_dict_to_json.py +0 -0
  176. {sunholo-0.120.4 → sunholo-0.120.5}/src/sunholo.egg-info/SOURCES.txt +0 -0
  177. {sunholo-0.120.4 → sunholo-0.120.5}/src/sunholo.egg-info/dependency_links.txt +0 -0
  178. {sunholo-0.120.4 → sunholo-0.120.5}/src/sunholo.egg-info/entry_points.txt +0 -0
  179. {sunholo-0.120.4 → sunholo-0.120.5}/src/sunholo.egg-info/requires.txt +0 -0
  180. {sunholo-0.120.4 → sunholo-0.120.5}/src/sunholo.egg-info/top_level.txt +0 -0
  181. {sunholo-0.120.4 → sunholo-0.120.5}/tests/test_async.py +0 -0
  182. {sunholo-0.120.4 → sunholo-0.120.5}/tests/test_async_genai2.py +0 -0
  183. {sunholo-0.120.4 → sunholo-0.120.5}/tests/test_chat_history.py +0 -0
  184. {sunholo-0.120.4 → sunholo-0.120.5}/tests/test_config.py +0 -0
  185. {sunholo-0.120.4 → sunholo-0.120.5}/tests/test_genai2.py +0 -0
  186. {sunholo-0.120.4 → sunholo-0.120.5}/tests/test_unstructured.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: sunholo
3
- Version: 0.120.4
3
+ Version: 0.120.5
4
4
  Summary: Large Language Model DevOps - a package to help deploy LLMs 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.120.4"
7
+ version = "0.120.5"
8
8
  description = "Large Language Model DevOps - a package to help deploy LLMs to the Cloud."
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.10"
@@ -9,9 +9,7 @@ from ..custom_logging import log
9
9
  def get_default_email():
10
10
 
11
11
  # https://stackoverflow.com/questions/64234214/how-to-generate-a-blob-signed-url-in-google-cloud-run
12
- gcs_credentials, project_id = get_default_creds()
13
- if gcs_credentials is None:
14
- gcs_credentials, project_id = refresh_credentials()
12
+ gcs_credentials, project_id = refresh_credentials()
15
13
 
16
14
  if gcs_credentials is None:
17
15
  log.error("Could not refresh the credentials properly.")
@@ -12,6 +12,7 @@ import traceback
12
12
  try:
13
13
  import google.generativeai as genai
14
14
  from google import genai as genaiv2
15
+ from google.genai import types
15
16
 
16
17
  except ImportError:
17
18
  genai = None
@@ -106,13 +107,18 @@ def sanitize_file(filename):
106
107
  # Limit the length
107
108
  return sanitized_name[:40]
108
109
 
109
- async def construct_file_content(gs_list, bucket:str, genai_lib=False, timeout=60):
110
+ async def construct_file_content(gs_list,
111
+ bucket:str,
112
+ genai_lib=False,
113
+ timeout=60,
114
+ genai_lib_vertex=False):
110
115
  """
111
116
  Args:
112
117
  - gs_list: a list of dicts representing files in a bucket
113
118
  - bucket: The bucket the files are in
114
119
  - genai_lib: whether its using the genai SDK
115
120
  - timeout: timeout in seconds for the gather operation
121
+ - genai_lib_vertex: bool whether to use the vertex version of the genai library, using default credentials
116
122
  """
117
123
 
118
124
  file_list = []
@@ -130,7 +136,28 @@ async def construct_file_content(gs_list, bucket:str, genai_lib=False, timeout=6
130
136
  if not file_list:
131
137
  return [{"role": "user", "parts": [{"text": "No eligible contentTypes were found"}]}]
132
138
 
139
+ # export GOOGLE_GENAI_USE_VERTEXAI=true
140
+ # export GOOGLE_CLOUD_PROJECT='your-project-id'
141
+ # export GOOGLE_CLOUD_LOCATION='us-central1'
133
142
  content = []
143
+ if genai_lib_vertex or os.getenv("GOOGLE_GENAI_USE_VERTEXAI"):
144
+ client = genaiv2.Client(vertexai=True)
145
+ # we can just use the gs:// uri directly
146
+ for file_info in file_list:
147
+ img_url = f"gs://{bucket}/{file_info['storagePath']}"
148
+ mime_type = file_info['contentType']
149
+ display_name = file_info['name']
150
+ display_url = img_url
151
+ file_content = types.Part.from_uri(
152
+ file_uri=img_url,
153
+ mime_type=mime_type,
154
+ )
155
+ file_content_list = [file_content,
156
+ f"You have been given the ability to read and work with filename '{display_name}' with {mime_type=} {display_url=}"]
157
+ content.extend(file_content_list)
158
+
159
+ return content
160
+
134
161
 
135
162
  # Loop through the valid files and process them
136
163
  tasks = []
@@ -139,8 +166,7 @@ async def construct_file_content(gs_list, bucket:str, genai_lib=False, timeout=6
139
166
  display_url = file_info.get('url')
140
167
  mime_type = file_info['contentType']
141
168
  # Generate a unique name for each file
142
- original_name = sanitize_file(file_info['name'])
143
- unique_name = sanitize_file(f"{original_name}")
169
+ unique_name= sanitize_file(file_info['name'])
144
170
 
145
171
  display_name = file_info['name']
146
172
  log.info(f"Processing {unique_name=} {display_name=}")
@@ -205,7 +231,8 @@ async def download_gcs_upload_genai(img_url,
205
231
  name=None,
206
232
  display_url=None,
207
233
  display_name=None,
208
- retries=3, delay=2, genai_lib=False):
234
+ retries=3, delay=2,
235
+ genai_lib=False):
209
236
  """
210
237
  Downloads and uploads a file with retries in case of failure.
211
238
  Thread-safe implementation using unique file paths.
@@ -216,6 +243,8 @@ async def download_gcs_upload_genai(img_url,
216
243
  - name: str Optional name, else a random one will be created
217
244
  - retries: int Number of retry attempts before failing.
218
245
  - delay: int Initial delay between retries, exponentially increasing.
246
+ - genai_lin: bool whether to use newer genai library to upload files
247
+
219
248
 
220
249
  Returns:
221
250
  - downloaded_content: The result of the file upload if successful.
@@ -242,7 +271,6 @@ async def download_gcs_upload_genai(img_url,
242
271
 
243
272
  extension = mimetypes.guess_extension(mime_type)
244
273
 
245
- # Create a unique directory for this upload task
246
274
  # Create a unique directory for this upload task
247
275
  unique_id = str(uuid.uuid4())
248
276
  temp_dir = os.path.join(tempfile.gettempdir(), f"upload_{unique_id}")
@@ -275,14 +303,16 @@ async def download_gcs_upload_genai(img_url,
275
303
  return {"role": "user", "parts": [{"file_data": downloaded_content},
276
304
  {"text": f"You have been given the ability to read and work with filename '{display_name}' with {mime_type=} {display_url=}"}
277
305
  ]}
306
+
278
307
  else:
308
+
279
309
  client = genaiv2.Client()
280
310
 
281
311
  # Use semaphore to limit concurrent uploads
282
312
  async with upload_semaphore:
283
313
  downloaded_content = await asyncio.to_thread(
284
314
  client.files.upload,
285
- file=file_path, # Use the unsanitized path for filesystem access
315
+ path=file_path, # Use the unsanitized path for filesystem access
286
316
  config=dict(mime_type=mime_type, display_name=display_name, name=api_name)
287
317
  )
288
318
 
@@ -209,12 +209,27 @@ async def start_streaming_chat_async(question, vector_name, qna_func_async, chat
209
209
  stop_event.set()
210
210
  await chat_task # Ensure the async task is awaited
211
211
 
212
- # Handle final result
213
- if not result_queue.empty():
214
- final_result = result_queue.get()
215
- parsed_final_result = parse_output(final_result)
216
- if 'answer' in parsed_final_result:
217
- yield json.dumps(parsed_final_result)
212
+ # Handle final flush of any remaining content
213
+ content_to_send = await content_buffer.async_read()
214
+ if content_to_send:
215
+ log.info(f"==Flush Async==\n{content_to_send}")
216
+ yield content_to_send
217
+ await content_buffer.async_clear()
218
+
219
+ # Handle final result to match non-async behavior
220
+ if kwargs.get("stream_only"):
221
+ log.info("stream_only so finishing now")
222
+ final_yield = ""
223
+ else:
224
+ log.info("Sending final full message plus sources...")
225
+ if not result_queue.empty():
226
+ final_result = result_queue.get()
227
+ final_yield = parse_output(final_result)
228
+ else:
229
+ final_yield = ""
230
+
231
+ # Match the non-async behavior - yield the parsed output directly, not as JSON
232
+ yield final_yield
218
233
 
219
234
 
220
235
  def generate_proxy_stream(stream_to_f, user_input, vector_name, chat_history, generate_f_output, **kwargs):
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: sunholo
3
- Version: 0.120.4
3
+ Version: 0.120.5
4
4
  Summary: Large Language Model DevOps - a package to help deploy LLMs 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
File without changes