sunholo 0.136.1__tar.gz → 0.136.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 (188) hide show
  1. {sunholo-0.136.1/src/sunholo.egg-info → sunholo-0.136.3}/PKG-INFO +1 -1
  2. {sunholo-0.136.1 → sunholo-0.136.3}/pyproject.toml +1 -1
  3. {sunholo-0.136.1 → sunholo-0.136.3}/src/sunholo/discovery_engine/discovery_engine_client.py +88 -102
  4. {sunholo-0.136.1 → sunholo-0.136.3/src/sunholo.egg-info}/PKG-INFO +1 -1
  5. {sunholo-0.136.1 → sunholo-0.136.3}/LICENSE.txt +0 -0
  6. {sunholo-0.136.1 → sunholo-0.136.3}/MANIFEST.in +0 -0
  7. {sunholo-0.136.1 → sunholo-0.136.3}/README.md +0 -0
  8. {sunholo-0.136.1 → sunholo-0.136.3}/setup.cfg +0 -0
  9. {sunholo-0.136.1 → sunholo-0.136.3}/src/sunholo/__init__.py +0 -0
  10. {sunholo-0.136.1 → sunholo-0.136.3}/src/sunholo/agents/__init__.py +0 -0
  11. {sunholo-0.136.1 → sunholo-0.136.3}/src/sunholo/agents/chat_history.py +0 -0
  12. {sunholo-0.136.1 → sunholo-0.136.3}/src/sunholo/agents/dispatch_to_qa.py +0 -0
  13. {sunholo-0.136.1 → sunholo-0.136.3}/src/sunholo/agents/fastapi/__init__.py +0 -0
  14. {sunholo-0.136.1 → sunholo-0.136.3}/src/sunholo/agents/fastapi/base.py +0 -0
  15. {sunholo-0.136.1 → sunholo-0.136.3}/src/sunholo/agents/fastapi/qna_routes.py +0 -0
  16. {sunholo-0.136.1 → sunholo-0.136.3}/src/sunholo/agents/flask/__init__.py +0 -0
  17. {sunholo-0.136.1 → sunholo-0.136.3}/src/sunholo/agents/flask/base.py +0 -0
  18. {sunholo-0.136.1 → sunholo-0.136.3}/src/sunholo/agents/flask/qna_routes.py +0 -0
  19. {sunholo-0.136.1 → sunholo-0.136.3}/src/sunholo/agents/flask/vac_routes.py +0 -0
  20. {sunholo-0.136.1 → sunholo-0.136.3}/src/sunholo/agents/langserve.py +0 -0
  21. {sunholo-0.136.1 → sunholo-0.136.3}/src/sunholo/agents/pubsub.py +0 -0
  22. {sunholo-0.136.1 → sunholo-0.136.3}/src/sunholo/agents/route.py +0 -0
  23. {sunholo-0.136.1 → sunholo-0.136.3}/src/sunholo/agents/special_commands.py +0 -0
  24. {sunholo-0.136.1 → sunholo-0.136.3}/src/sunholo/agents/swagger.py +0 -0
  25. {sunholo-0.136.1 → sunholo-0.136.3}/src/sunholo/archive/__init__.py +0 -0
  26. {sunholo-0.136.1 → sunholo-0.136.3}/src/sunholo/archive/archive.py +0 -0
  27. {sunholo-0.136.1 → sunholo-0.136.3}/src/sunholo/auth/__init__.py +0 -0
  28. {sunholo-0.136.1 → sunholo-0.136.3}/src/sunholo/auth/gcloud.py +0 -0
  29. {sunholo-0.136.1 → sunholo-0.136.3}/src/sunholo/auth/refresh.py +0 -0
  30. {sunholo-0.136.1 → sunholo-0.136.3}/src/sunholo/auth/run.py +0 -0
  31. {sunholo-0.136.1 → sunholo-0.136.3}/src/sunholo/azure/__init__.py +0 -0
  32. {sunholo-0.136.1 → sunholo-0.136.3}/src/sunholo/azure/auth.py +0 -0
  33. {sunholo-0.136.1 → sunholo-0.136.3}/src/sunholo/azure/blobs.py +0 -0
  34. {sunholo-0.136.1 → sunholo-0.136.3}/src/sunholo/azure/event_grid.py +0 -0
  35. {sunholo-0.136.1 → sunholo-0.136.3}/src/sunholo/bots/__init__.py +0 -0
  36. {sunholo-0.136.1 → sunholo-0.136.3}/src/sunholo/bots/discord.py +0 -0
  37. {sunholo-0.136.1 → sunholo-0.136.3}/src/sunholo/bots/github_webhook.py +0 -0
  38. {sunholo-0.136.1 → sunholo-0.136.3}/src/sunholo/bots/webapp.py +0 -0
  39. {sunholo-0.136.1 → sunholo-0.136.3}/src/sunholo/chunker/__init__.py +0 -0
  40. {sunholo-0.136.1 → sunholo-0.136.3}/src/sunholo/chunker/azure.py +0 -0
  41. {sunholo-0.136.1 → sunholo-0.136.3}/src/sunholo/chunker/doc_handling.py +0 -0
  42. {sunholo-0.136.1 → sunholo-0.136.3}/src/sunholo/chunker/encode_metadata.py +0 -0
  43. {sunholo-0.136.1 → sunholo-0.136.3}/src/sunholo/chunker/images.py +0 -0
  44. {sunholo-0.136.1 → sunholo-0.136.3}/src/sunholo/chunker/loaders.py +0 -0
  45. {sunholo-0.136.1 → sunholo-0.136.3}/src/sunholo/chunker/message_data.py +0 -0
  46. {sunholo-0.136.1 → sunholo-0.136.3}/src/sunholo/chunker/pdfs.py +0 -0
  47. {sunholo-0.136.1 → sunholo-0.136.3}/src/sunholo/chunker/process_chunker_data.py +0 -0
  48. {sunholo-0.136.1 → sunholo-0.136.3}/src/sunholo/chunker/publish.py +0 -0
  49. {sunholo-0.136.1 → sunholo-0.136.3}/src/sunholo/chunker/pubsub.py +0 -0
  50. {sunholo-0.136.1 → sunholo-0.136.3}/src/sunholo/chunker/splitter.py +0 -0
  51. {sunholo-0.136.1 → sunholo-0.136.3}/src/sunholo/cli/__init__.py +0 -0
  52. {sunholo-0.136.1 → sunholo-0.136.3}/src/sunholo/cli/chat_vac.py +0 -0
  53. {sunholo-0.136.1 → sunholo-0.136.3}/src/sunholo/cli/cli.py +0 -0
  54. {sunholo-0.136.1 → sunholo-0.136.3}/src/sunholo/cli/cli_init.py +0 -0
  55. {sunholo-0.136.1 → sunholo-0.136.3}/src/sunholo/cli/configs.py +0 -0
  56. {sunholo-0.136.1 → sunholo-0.136.3}/src/sunholo/cli/deploy.py +0 -0
  57. {sunholo-0.136.1 → sunholo-0.136.3}/src/sunholo/cli/embedder.py +0 -0
  58. {sunholo-0.136.1 → sunholo-0.136.3}/src/sunholo/cli/merge_texts.py +0 -0
  59. {sunholo-0.136.1 → sunholo-0.136.3}/src/sunholo/cli/run_proxy.py +0 -0
  60. {sunholo-0.136.1 → sunholo-0.136.3}/src/sunholo/cli/sun_rich.py +0 -0
  61. {sunholo-0.136.1 → sunholo-0.136.3}/src/sunholo/cli/swagger.py +0 -0
  62. {sunholo-0.136.1 → sunholo-0.136.3}/src/sunholo/cli/vertex.py +0 -0
  63. {sunholo-0.136.1 → sunholo-0.136.3}/src/sunholo/components/__init__.py +0 -0
  64. {sunholo-0.136.1 → sunholo-0.136.3}/src/sunholo/components/llm.py +0 -0
  65. {sunholo-0.136.1 → sunholo-0.136.3}/src/sunholo/components/retriever.py +0 -0
  66. {sunholo-0.136.1 → sunholo-0.136.3}/src/sunholo/components/vectorstore.py +0 -0
  67. {sunholo-0.136.1 → sunholo-0.136.3}/src/sunholo/custom_logging.py +0 -0
  68. {sunholo-0.136.1 → sunholo-0.136.3}/src/sunholo/database/__init__.py +0 -0
  69. {sunholo-0.136.1 → sunholo-0.136.3}/src/sunholo/database/alloydb.py +0 -0
  70. {sunholo-0.136.1 → sunholo-0.136.3}/src/sunholo/database/alloydb_client.py +0 -0
  71. {sunholo-0.136.1 → sunholo-0.136.3}/src/sunholo/database/database.py +0 -0
  72. {sunholo-0.136.1 → sunholo-0.136.3}/src/sunholo/database/lancedb.py +0 -0
  73. {sunholo-0.136.1 → sunholo-0.136.3}/src/sunholo/database/sql/sb/create_function.sql +0 -0
  74. {sunholo-0.136.1 → sunholo-0.136.3}/src/sunholo/database/sql/sb/create_function_time.sql +0 -0
  75. {sunholo-0.136.1 → sunholo-0.136.3}/src/sunholo/database/sql/sb/create_table.sql +0 -0
  76. {sunholo-0.136.1 → sunholo-0.136.3}/src/sunholo/database/sql/sb/delete_source_row.sql +0 -0
  77. {sunholo-0.136.1 → sunholo-0.136.3}/src/sunholo/database/sql/sb/return_sources.sql +0 -0
  78. {sunholo-0.136.1 → sunholo-0.136.3}/src/sunholo/database/sql/sb/setup.sql +0 -0
  79. {sunholo-0.136.1 → sunholo-0.136.3}/src/sunholo/database/static_dbs.py +0 -0
  80. {sunholo-0.136.1 → sunholo-0.136.3}/src/sunholo/database/uuid.py +0 -0
  81. {sunholo-0.136.1 → sunholo-0.136.3}/src/sunholo/discovery_engine/__init__.py +0 -0
  82. {sunholo-0.136.1 → sunholo-0.136.3}/src/sunholo/discovery_engine/chunker_handler.py +0 -0
  83. {sunholo-0.136.1 → sunholo-0.136.3}/src/sunholo/discovery_engine/cli.py +0 -0
  84. {sunholo-0.136.1 → sunholo-0.136.3}/src/sunholo/discovery_engine/create_new.py +0 -0
  85. {sunholo-0.136.1 → sunholo-0.136.3}/src/sunholo/discovery_engine/get_ai_search_chunks.py +0 -0
  86. {sunholo-0.136.1 → sunholo-0.136.3}/src/sunholo/embedder/__init__.py +0 -0
  87. {sunholo-0.136.1 → sunholo-0.136.3}/src/sunholo/embedder/embed_chunk.py +0 -0
  88. {sunholo-0.136.1 → sunholo-0.136.3}/src/sunholo/embedder/embed_metadata.py +0 -0
  89. {sunholo-0.136.1 → sunholo-0.136.3}/src/sunholo/excel/__init__.py +0 -0
  90. {sunholo-0.136.1 → sunholo-0.136.3}/src/sunholo/excel/plugin.py +0 -0
  91. {sunholo-0.136.1 → sunholo-0.136.3}/src/sunholo/gcs/__init__.py +0 -0
  92. {sunholo-0.136.1 → sunholo-0.136.3}/src/sunholo/gcs/add_file.py +0 -0
  93. {sunholo-0.136.1 → sunholo-0.136.3}/src/sunholo/gcs/download_folder.py +0 -0
  94. {sunholo-0.136.1 → sunholo-0.136.3}/src/sunholo/gcs/download_url.py +0 -0
  95. {sunholo-0.136.1 → sunholo-0.136.3}/src/sunholo/gcs/extract_and_sign.py +0 -0
  96. {sunholo-0.136.1 → sunholo-0.136.3}/src/sunholo/gcs/metadata.py +0 -0
  97. {sunholo-0.136.1 → sunholo-0.136.3}/src/sunholo/genai/__init__.py +0 -0
  98. {sunholo-0.136.1 → sunholo-0.136.3}/src/sunholo/genai/file_handling.py +0 -0
  99. {sunholo-0.136.1 → sunholo-0.136.3}/src/sunholo/genai/genaiv2.py +0 -0
  100. {sunholo-0.136.1 → sunholo-0.136.3}/src/sunholo/genai/images.py +0 -0
  101. {sunholo-0.136.1 → sunholo-0.136.3}/src/sunholo/genai/init.py +0 -0
  102. {sunholo-0.136.1 → sunholo-0.136.3}/src/sunholo/genai/process_funcs_cls.py +0 -0
  103. {sunholo-0.136.1 → sunholo-0.136.3}/src/sunholo/genai/safety.py +0 -0
  104. {sunholo-0.136.1 → sunholo-0.136.3}/src/sunholo/invoke/__init__.py +0 -0
  105. {sunholo-0.136.1 → sunholo-0.136.3}/src/sunholo/invoke/async_class.py +0 -0
  106. {sunholo-0.136.1 → sunholo-0.136.3}/src/sunholo/invoke/direct_vac_func.py +0 -0
  107. {sunholo-0.136.1 → sunholo-0.136.3}/src/sunholo/invoke/invoke_vac_utils.py +0 -0
  108. {sunholo-0.136.1 → sunholo-0.136.3}/src/sunholo/langchain_types.py +0 -0
  109. {sunholo-0.136.1 → sunholo-0.136.3}/src/sunholo/langfuse/__init__.py +0 -0
  110. {sunholo-0.136.1 → sunholo-0.136.3}/src/sunholo/langfuse/callback.py +0 -0
  111. {sunholo-0.136.1 → sunholo-0.136.3}/src/sunholo/langfuse/evals.py +0 -0
  112. {sunholo-0.136.1 → sunholo-0.136.3}/src/sunholo/langfuse/prompts.py +0 -0
  113. {sunholo-0.136.1 → sunholo-0.136.3}/src/sunholo/llamaindex/__init__.py +0 -0
  114. {sunholo-0.136.1 → sunholo-0.136.3}/src/sunholo/llamaindex/get_files.py +0 -0
  115. {sunholo-0.136.1 → sunholo-0.136.3}/src/sunholo/llamaindex/import_files.py +0 -0
  116. {sunholo-0.136.1 → sunholo-0.136.3}/src/sunholo/llamaindex/llamaindex_class.py +0 -0
  117. {sunholo-0.136.1 → sunholo-0.136.3}/src/sunholo/llamaindex/user_history.py +0 -0
  118. {sunholo-0.136.1 → sunholo-0.136.3}/src/sunholo/lookup/__init__.py +0 -0
  119. {sunholo-0.136.1 → sunholo-0.136.3}/src/sunholo/lookup/model_lookup.yaml +0 -0
  120. {sunholo-0.136.1 → sunholo-0.136.3}/src/sunholo/mcp/__init__.py +0 -0
  121. {sunholo-0.136.1 → sunholo-0.136.3}/src/sunholo/mcp/cli.py +0 -0
  122. {sunholo-0.136.1 → sunholo-0.136.3}/src/sunholo/ollama/__init__.py +0 -0
  123. {sunholo-0.136.1 → sunholo-0.136.3}/src/sunholo/ollama/ollama_images.py +0 -0
  124. {sunholo-0.136.1 → sunholo-0.136.3}/src/sunholo/pubsub/__init__.py +0 -0
  125. {sunholo-0.136.1 → sunholo-0.136.3}/src/sunholo/pubsub/process_pubsub.py +0 -0
  126. {sunholo-0.136.1 → sunholo-0.136.3}/src/sunholo/pubsub/pubsub_manager.py +0 -0
  127. {sunholo-0.136.1 → sunholo-0.136.3}/src/sunholo/qna/__init__.py +0 -0
  128. {sunholo-0.136.1 → sunholo-0.136.3}/src/sunholo/qna/parsers.py +0 -0
  129. {sunholo-0.136.1 → sunholo-0.136.3}/src/sunholo/qna/retry.py +0 -0
  130. {sunholo-0.136.1 → sunholo-0.136.3}/src/sunholo/senses/__init__.py +0 -0
  131. {sunholo-0.136.1 → sunholo-0.136.3}/src/sunholo/senses/stream_voice.py +0 -0
  132. {sunholo-0.136.1 → sunholo-0.136.3}/src/sunholo/streaming/__init__.py +0 -0
  133. {sunholo-0.136.1 → sunholo-0.136.3}/src/sunholo/streaming/content_buffer.py +0 -0
  134. {sunholo-0.136.1 → sunholo-0.136.3}/src/sunholo/streaming/langserve.py +0 -0
  135. {sunholo-0.136.1 → sunholo-0.136.3}/src/sunholo/streaming/stream_lookup.py +0 -0
  136. {sunholo-0.136.1 → sunholo-0.136.3}/src/sunholo/streaming/streaming.py +0 -0
  137. {sunholo-0.136.1 → sunholo-0.136.3}/src/sunholo/summarise/__init__.py +0 -0
  138. {sunholo-0.136.1 → sunholo-0.136.3}/src/sunholo/summarise/summarise.py +0 -0
  139. {sunholo-0.136.1 → sunholo-0.136.3}/src/sunholo/templates/agent/__init__.py +0 -0
  140. {sunholo-0.136.1 → sunholo-0.136.3}/src/sunholo/templates/agent/agent_service.py +0 -0
  141. {sunholo-0.136.1 → sunholo-0.136.3}/src/sunholo/templates/agent/app.py +0 -0
  142. {sunholo-0.136.1 → sunholo-0.136.3}/src/sunholo/templates/agent/my_log.py +0 -0
  143. {sunholo-0.136.1 → sunholo-0.136.3}/src/sunholo/templates/agent/tools/__init__.py +0 -0
  144. {sunholo-0.136.1 → sunholo-0.136.3}/src/sunholo/templates/agent/tools/your_agent.py +0 -0
  145. {sunholo-0.136.1 → sunholo-0.136.3}/src/sunholo/templates/agent/vac_service.py +0 -0
  146. {sunholo-0.136.1 → sunholo-0.136.3}/src/sunholo/templates/project/__init__.py +0 -0
  147. {sunholo-0.136.1 → sunholo-0.136.3}/src/sunholo/templates/project/app.py +0 -0
  148. {sunholo-0.136.1 → sunholo-0.136.3}/src/sunholo/templates/project/my_log.py +0 -0
  149. {sunholo-0.136.1 → sunholo-0.136.3}/src/sunholo/templates/project/vac_service.py +0 -0
  150. {sunholo-0.136.1 → sunholo-0.136.3}/src/sunholo/templates/system_services/__init__.py +0 -0
  151. {sunholo-0.136.1 → sunholo-0.136.3}/src/sunholo/templates/system_services/app.py +0 -0
  152. {sunholo-0.136.1 → sunholo-0.136.3}/src/sunholo/templates/system_services/my_log.py +0 -0
  153. {sunholo-0.136.1 → sunholo-0.136.3}/src/sunholo/terraform/__init__.py +0 -0
  154. {sunholo-0.136.1 → sunholo-0.136.3}/src/sunholo/terraform/tfvars_editor.py +0 -0
  155. {sunholo-0.136.1 → sunholo-0.136.3}/src/sunholo/tools/__init__.py +0 -0
  156. {sunholo-0.136.1 → sunholo-0.136.3}/src/sunholo/tools/web_browser.py +0 -0
  157. {sunholo-0.136.1 → sunholo-0.136.3}/src/sunholo/utils/__init__.py +0 -0
  158. {sunholo-0.136.1 → sunholo-0.136.3}/src/sunholo/utils/api_key.py +0 -0
  159. {sunholo-0.136.1 → sunholo-0.136.3}/src/sunholo/utils/big_context.py +0 -0
  160. {sunholo-0.136.1 → sunholo-0.136.3}/src/sunholo/utils/config.py +0 -0
  161. {sunholo-0.136.1 → sunholo-0.136.3}/src/sunholo/utils/config_class.py +0 -0
  162. {sunholo-0.136.1 → sunholo-0.136.3}/src/sunholo/utils/config_schema.py +0 -0
  163. {sunholo-0.136.1 → sunholo-0.136.3}/src/sunholo/utils/gcp.py +0 -0
  164. {sunholo-0.136.1 → sunholo-0.136.3}/src/sunholo/utils/gcp_project.py +0 -0
  165. {sunholo-0.136.1 → sunholo-0.136.3}/src/sunholo/utils/mime.py +0 -0
  166. {sunholo-0.136.1 → sunholo-0.136.3}/src/sunholo/utils/parsers.py +0 -0
  167. {sunholo-0.136.1 → sunholo-0.136.3}/src/sunholo/utils/timedelta.py +0 -0
  168. {sunholo-0.136.1 → sunholo-0.136.3}/src/sunholo/utils/user_ids.py +0 -0
  169. {sunholo-0.136.1 → sunholo-0.136.3}/src/sunholo/utils/version.py +0 -0
  170. {sunholo-0.136.1 → sunholo-0.136.3}/src/sunholo/vertex/__init__.py +0 -0
  171. {sunholo-0.136.1 → sunholo-0.136.3}/src/sunholo/vertex/extensions_call.py +0 -0
  172. {sunholo-0.136.1 → sunholo-0.136.3}/src/sunholo/vertex/extensions_class.py +0 -0
  173. {sunholo-0.136.1 → sunholo-0.136.3}/src/sunholo/vertex/genai_functions.py +0 -0
  174. {sunholo-0.136.1 → sunholo-0.136.3}/src/sunholo/vertex/init.py +0 -0
  175. {sunholo-0.136.1 → sunholo-0.136.3}/src/sunholo/vertex/memory_tools.py +0 -0
  176. {sunholo-0.136.1 → sunholo-0.136.3}/src/sunholo/vertex/safety.py +0 -0
  177. {sunholo-0.136.1 → sunholo-0.136.3}/src/sunholo/vertex/type_dict_to_json.py +0 -0
  178. {sunholo-0.136.1 → sunholo-0.136.3}/src/sunholo.egg-info/SOURCES.txt +0 -0
  179. {sunholo-0.136.1 → sunholo-0.136.3}/src/sunholo.egg-info/dependency_links.txt +0 -0
  180. {sunholo-0.136.1 → sunholo-0.136.3}/src/sunholo.egg-info/entry_points.txt +0 -0
  181. {sunholo-0.136.1 → sunholo-0.136.3}/src/sunholo.egg-info/requires.txt +0 -0
  182. {sunholo-0.136.1 → sunholo-0.136.3}/src/sunholo.egg-info/top_level.txt +0 -0
  183. {sunholo-0.136.1 → sunholo-0.136.3}/tests/test_async.py +0 -0
  184. {sunholo-0.136.1 → sunholo-0.136.3}/tests/test_async_genai2.py +0 -0
  185. {sunholo-0.136.1 → sunholo-0.136.3}/tests/test_chat_history.py +0 -0
  186. {sunholo-0.136.1 → sunholo-0.136.3}/tests/test_config.py +0 -0
  187. {sunholo-0.136.1 → sunholo-0.136.3}/tests/test_genai2.py +0 -0
  188. {sunholo-0.136.1 → sunholo-0.136.3}/tests/test_unstructured.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: sunholo
3
- Version: 0.136.1
3
+ Version: 0.136.3
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.136.1"
7
+ version = "0.136.3"
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"
@@ -486,35 +486,53 @@ class DiscoveryEngineClient:
486
486
  """Process a search response containing documents into a formatted string."""
487
487
  all_documents = []
488
488
  result_count = 0
489
+
489
490
  # Check if the response contains results
490
491
  if not response or not hasattr(response, 'results') or not response.results:
491
492
  log.info(f'No results found in response: {response=}')
492
493
  return []
493
494
 
494
- should_break=False
495
- # Process the pager properly
496
- for page in response.pages:
497
- if should_break:
498
- break
499
- if hasattr(page, 'results') and page.results:
500
- for result in page.results:
501
- if result_count >= max_limit:
502
- log.info("Breaking results loop as max limit reached")
503
- should_break = True # Set flag to break outer loop
504
- break
505
-
506
- if hasattr(result, 'document'):
507
- document = result.document
508
- all_documents.append(self.document_format(document))
509
- result_count += 1
510
-
511
- # Check if we've reached max_limit
512
- if max_limit is not None and result_count >= max_limit:
513
- log.info(f"Reached max_limit of {max_limit} results, stopping processing")
514
- should_break = True
515
- break
516
- else:
517
- log.warning("No document found in result")
495
+ # Simpler approach: Just process the direct results from the response
496
+ # This handles the case where it's just a simple SearchResponse
497
+ for result in response.results:
498
+ if hasattr(result, 'document'):
499
+ document = result.document
500
+ all_documents.append(self.document_format(document))
501
+ result_count += 1
502
+
503
+ # Check if we've reached max_limit
504
+ if max_limit is not None and result_count >= max_limit:
505
+ log.info(f"Reached max_limit of {max_limit} results, stopping processing")
506
+ break
507
+ else:
508
+ log.warning("No document found in result")
509
+
510
+ # If there are pages, check gently without assuming too much about the structure
511
+ # Only process if we haven't already hit the max_limit
512
+ if (max_limit is None or result_count < max_limit) and hasattr(response, 'pages'):
513
+ try:
514
+ # For each page (after the first which we've already processed)
515
+ for page in list(response.pages)[1:]: # Skip first page as we already processed it
516
+ if hasattr(page, 'results'):
517
+ for result in page.results:
518
+ if hasattr(result, 'document'):
519
+ document = result.document
520
+ all_documents.append(self.document_format(document))
521
+ result_count += 1
522
+
523
+ # Check if we've reached max_limit
524
+ if max_limit is not None and result_count >= max_limit:
525
+ log.info(f"Reached max_limit of {max_limit} results while processing pages")
526
+ break
527
+ else:
528
+ log.warning("No document found in result during page processing")
529
+
530
+ # Break out of the page loop if we've reached max_limit
531
+ if max_limit is not None and result_count >= max_limit:
532
+ break
533
+ except Exception as e:
534
+ # Don't let page iteration issues break the whole function
535
+ log.warning(f"Error during page iteration, proceeding with results already collected: {e}")
518
536
 
519
537
  # Combine all documents into one long string
520
538
  result_string = "\n\n".join(all_documents)
@@ -531,30 +549,52 @@ class DiscoveryEngineClient:
531
549
  log.info(f'No results found in response: {response=}')
532
550
  return []
533
551
 
534
- should_break=False
535
- # Process the pager properly
536
- async for page in response.pages:
537
- if should_break:
538
- break
539
- if hasattr(page, 'results') and page.results:
540
- for result in page.results:
541
- if result_count >= max_limit:
542
- log.info("Breaking results loop as max limit reached")
543
- should_break = True # Set flag to break outer loop
544
- break
545
-
546
- if hasattr(result, 'document'):
547
- document = result.document
548
- all_documents.append(self.document_format(document))
549
- result_count += 1
550
-
551
- # Check if we've reached max_limit
552
- if max_limit is not None and result_count >= max_limit:
553
- log.info(f"Reached max_limit of {max_limit} results, stopping processing")
554
- should_break = True
555
- break
556
- else:
557
- log.warning("No document found in result")
552
+ # Simpler approach: Just process the direct results from the response
553
+ # This handles the case where it's just a simple SearchResponse
554
+ for result in response.results:
555
+ if hasattr(result, 'document'):
556
+ document = result.document
557
+ all_documents.append(self.document_format(document))
558
+ result_count += 1
559
+
560
+ # Check if we've reached max_limit
561
+ if max_limit is not None and result_count >= max_limit:
562
+ log.info(f"Reached max_limit of {max_limit} results, stopping processing")
563
+ break
564
+ else:
565
+ log.warning("No document found in result")
566
+
567
+ # If there are pages, check gently without assuming too much about the structure
568
+ # Only process if we haven't already hit the max_limit
569
+ if (max_limit is None or result_count < max_limit) and hasattr(response, 'pages'):
570
+ try:
571
+ # Since pages is an async iterator, we need special handling
572
+ first_page = True # Flag to skip first page (already processed above)
573
+ async for page in response.pages:
574
+ if first_page:
575
+ first_page = False
576
+ continue # Skip first page as we already processed it
577
+
578
+ if hasattr(page, 'results'):
579
+ for result in page.results:
580
+ if hasattr(result, 'document'):
581
+ document = result.document
582
+ all_documents.append(self.document_format(document))
583
+ result_count += 1
584
+
585
+ # Check if we've reached max_limit
586
+ if max_limit is not None and result_count >= max_limit:
587
+ log.info(f"Reached max_limit of {max_limit} results while processing pages")
588
+ break
589
+ else:
590
+ log.warning("No document found in result during page processing")
591
+
592
+ # Break out of the page loop if we've reached max_limit
593
+ if max_limit is not None and result_count >= max_limit:
594
+ break
595
+ except Exception as e:
596
+ # Don't let page iteration issues break the whole function
597
+ log.warning(f"Error during async page iteration, proceeding with results already collected: {e}")
558
598
 
559
599
  # Combine all documents into one long string
560
600
  result_string = "\n\n".join(all_documents)
@@ -884,33 +924,6 @@ class DiscoveryEngineClient:
884
924
  except Exception as e:
885
925
  log.info(f"No results {search_request.data_store_specs=}: {str(e)}")
886
926
  return None
887
-
888
- # Apply max_limit if needed
889
- if content_search_spec_type=="documents" and max_limit is not None:
890
- # For raw response objects (when parse_chunks_to_string=False)
891
- if not parse_chunks_to_string:
892
- # We need to limit the pager results before returning
893
- limited_response = search_response
894
- # Store the original pages iterator method
895
- original_pages = limited_response.pages
896
-
897
- # Override the pages property with a custom iterator that respects max_limit
898
- def limited_pages_iterator():
899
- results_count = 0
900
- for page in original_pages:
901
- yield page
902
-
903
- # Count results in this page
904
- if hasattr(page, 'results'):
905
- results_count += len(page.results)
906
-
907
- # Stop if we've reached max_limit
908
- if results_count >= max_limit:
909
- break
910
-
911
- # Replace the pages property with our custom iterator
912
- limited_response.pages = limited_pages_iterator()
913
- return limited_response
914
927
 
915
928
  if parse_chunks_to_string:
916
929
  if content_search_spec_type=="chunks":
@@ -995,33 +1008,6 @@ class DiscoveryEngineClient:
995
1008
  except Exception as e:
996
1009
  log.info(f"No results {search_request.data_store_specs=}: {str(e)}")
997
1010
  return None
998
-
999
- # Apply max_limit if needed
1000
- if content_search_spec_type=="documents" and max_limit is not None:
1001
- # For raw response objects (when parse_chunks_to_string=False)
1002
- if not parse_chunks_to_string:
1003
- # We need to limit the pager results before returning
1004
- limited_response = search_response
1005
- # Store the original pages iterator method
1006
- original_pages = limited_response.pages
1007
-
1008
- # Override the pages property with a custom iterator that respects max_limit
1009
- async def limited_pages_iterator():
1010
- results_count = 0
1011
- async for page in original_pages:
1012
- yield page
1013
-
1014
- # Count results in this page
1015
- if hasattr(page, 'results'):
1016
- results_count += len(page.results)
1017
-
1018
- # Stop if we've reached max_limit
1019
- if results_count >= max_limit:
1020
- break
1021
-
1022
- # Replace the pages property with our custom iterator
1023
- limited_response.pages = limited_pages_iterator()
1024
- return limited_response
1025
1011
 
1026
1012
  if parse_chunks_to_string:
1027
1013
  if content_search_spec_type=="chunks":
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: sunholo
3
- Version: 0.136.1
3
+ Version: 0.136.3
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
File without changes