sunholo 0.136.0__tar.gz → 0.136.2__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.
- {sunholo-0.136.0/src/sunholo.egg-info → sunholo-0.136.2}/PKG-INFO +1 -1
- {sunholo-0.136.0 → sunholo-0.136.2}/pyproject.toml +1 -1
- {sunholo-0.136.0 → sunholo-0.136.2}/src/sunholo/discovery_engine/discovery_engine_client.py +51 -83
- {sunholo-0.136.0 → sunholo-0.136.2/src/sunholo.egg-info}/PKG-INFO +1 -1
- {sunholo-0.136.0 → sunholo-0.136.2}/LICENSE.txt +0 -0
- {sunholo-0.136.0 → sunholo-0.136.2}/MANIFEST.in +0 -0
- {sunholo-0.136.0 → sunholo-0.136.2}/README.md +0 -0
- {sunholo-0.136.0 → sunholo-0.136.2}/setup.cfg +0 -0
- {sunholo-0.136.0 → sunholo-0.136.2}/src/sunholo/__init__.py +0 -0
- {sunholo-0.136.0 → sunholo-0.136.2}/src/sunholo/agents/__init__.py +0 -0
- {sunholo-0.136.0 → sunholo-0.136.2}/src/sunholo/agents/chat_history.py +0 -0
- {sunholo-0.136.0 → sunholo-0.136.2}/src/sunholo/agents/dispatch_to_qa.py +0 -0
- {sunholo-0.136.0 → sunholo-0.136.2}/src/sunholo/agents/fastapi/__init__.py +0 -0
- {sunholo-0.136.0 → sunholo-0.136.2}/src/sunholo/agents/fastapi/base.py +0 -0
- {sunholo-0.136.0 → sunholo-0.136.2}/src/sunholo/agents/fastapi/qna_routes.py +0 -0
- {sunholo-0.136.0 → sunholo-0.136.2}/src/sunholo/agents/flask/__init__.py +0 -0
- {sunholo-0.136.0 → sunholo-0.136.2}/src/sunholo/agents/flask/base.py +0 -0
- {sunholo-0.136.0 → sunholo-0.136.2}/src/sunholo/agents/flask/qna_routes.py +0 -0
- {sunholo-0.136.0 → sunholo-0.136.2}/src/sunholo/agents/flask/vac_routes.py +0 -0
- {sunholo-0.136.0 → sunholo-0.136.2}/src/sunholo/agents/langserve.py +0 -0
- {sunholo-0.136.0 → sunholo-0.136.2}/src/sunholo/agents/pubsub.py +0 -0
- {sunholo-0.136.0 → sunholo-0.136.2}/src/sunholo/agents/route.py +0 -0
- {sunholo-0.136.0 → sunholo-0.136.2}/src/sunholo/agents/special_commands.py +0 -0
- {sunholo-0.136.0 → sunholo-0.136.2}/src/sunholo/agents/swagger.py +0 -0
- {sunholo-0.136.0 → sunholo-0.136.2}/src/sunholo/archive/__init__.py +0 -0
- {sunholo-0.136.0 → sunholo-0.136.2}/src/sunholo/archive/archive.py +0 -0
- {sunholo-0.136.0 → sunholo-0.136.2}/src/sunholo/auth/__init__.py +0 -0
- {sunholo-0.136.0 → sunholo-0.136.2}/src/sunholo/auth/gcloud.py +0 -0
- {sunholo-0.136.0 → sunholo-0.136.2}/src/sunholo/auth/refresh.py +0 -0
- {sunholo-0.136.0 → sunholo-0.136.2}/src/sunholo/auth/run.py +0 -0
- {sunholo-0.136.0 → sunholo-0.136.2}/src/sunholo/azure/__init__.py +0 -0
- {sunholo-0.136.0 → sunholo-0.136.2}/src/sunholo/azure/auth.py +0 -0
- {sunholo-0.136.0 → sunholo-0.136.2}/src/sunholo/azure/blobs.py +0 -0
- {sunholo-0.136.0 → sunholo-0.136.2}/src/sunholo/azure/event_grid.py +0 -0
- {sunholo-0.136.0 → sunholo-0.136.2}/src/sunholo/bots/__init__.py +0 -0
- {sunholo-0.136.0 → sunholo-0.136.2}/src/sunholo/bots/discord.py +0 -0
- {sunholo-0.136.0 → sunholo-0.136.2}/src/sunholo/bots/github_webhook.py +0 -0
- {sunholo-0.136.0 → sunholo-0.136.2}/src/sunholo/bots/webapp.py +0 -0
- {sunholo-0.136.0 → sunholo-0.136.2}/src/sunholo/chunker/__init__.py +0 -0
- {sunholo-0.136.0 → sunholo-0.136.2}/src/sunholo/chunker/azure.py +0 -0
- {sunholo-0.136.0 → sunholo-0.136.2}/src/sunholo/chunker/doc_handling.py +0 -0
- {sunholo-0.136.0 → sunholo-0.136.2}/src/sunholo/chunker/encode_metadata.py +0 -0
- {sunholo-0.136.0 → sunholo-0.136.2}/src/sunholo/chunker/images.py +0 -0
- {sunholo-0.136.0 → sunholo-0.136.2}/src/sunholo/chunker/loaders.py +0 -0
- {sunholo-0.136.0 → sunholo-0.136.2}/src/sunholo/chunker/message_data.py +0 -0
- {sunholo-0.136.0 → sunholo-0.136.2}/src/sunholo/chunker/pdfs.py +0 -0
- {sunholo-0.136.0 → sunholo-0.136.2}/src/sunholo/chunker/process_chunker_data.py +0 -0
- {sunholo-0.136.0 → sunholo-0.136.2}/src/sunholo/chunker/publish.py +0 -0
- {sunholo-0.136.0 → sunholo-0.136.2}/src/sunholo/chunker/pubsub.py +0 -0
- {sunholo-0.136.0 → sunholo-0.136.2}/src/sunholo/chunker/splitter.py +0 -0
- {sunholo-0.136.0 → sunholo-0.136.2}/src/sunholo/cli/__init__.py +0 -0
- {sunholo-0.136.0 → sunholo-0.136.2}/src/sunholo/cli/chat_vac.py +0 -0
- {sunholo-0.136.0 → sunholo-0.136.2}/src/sunholo/cli/cli.py +0 -0
- {sunholo-0.136.0 → sunholo-0.136.2}/src/sunholo/cli/cli_init.py +0 -0
- {sunholo-0.136.0 → sunholo-0.136.2}/src/sunholo/cli/configs.py +0 -0
- {sunholo-0.136.0 → sunholo-0.136.2}/src/sunholo/cli/deploy.py +0 -0
- {sunholo-0.136.0 → sunholo-0.136.2}/src/sunholo/cli/embedder.py +0 -0
- {sunholo-0.136.0 → sunholo-0.136.2}/src/sunholo/cli/merge_texts.py +0 -0
- {sunholo-0.136.0 → sunholo-0.136.2}/src/sunholo/cli/run_proxy.py +0 -0
- {sunholo-0.136.0 → sunholo-0.136.2}/src/sunholo/cli/sun_rich.py +0 -0
- {sunholo-0.136.0 → sunholo-0.136.2}/src/sunholo/cli/swagger.py +0 -0
- {sunholo-0.136.0 → sunholo-0.136.2}/src/sunholo/cli/vertex.py +0 -0
- {sunholo-0.136.0 → sunholo-0.136.2}/src/sunholo/components/__init__.py +0 -0
- {sunholo-0.136.0 → sunholo-0.136.2}/src/sunholo/components/llm.py +0 -0
- {sunholo-0.136.0 → sunholo-0.136.2}/src/sunholo/components/retriever.py +0 -0
- {sunholo-0.136.0 → sunholo-0.136.2}/src/sunholo/components/vectorstore.py +0 -0
- {sunholo-0.136.0 → sunholo-0.136.2}/src/sunholo/custom_logging.py +0 -0
- {sunholo-0.136.0 → sunholo-0.136.2}/src/sunholo/database/__init__.py +0 -0
- {sunholo-0.136.0 → sunholo-0.136.2}/src/sunholo/database/alloydb.py +0 -0
- {sunholo-0.136.0 → sunholo-0.136.2}/src/sunholo/database/alloydb_client.py +0 -0
- {sunholo-0.136.0 → sunholo-0.136.2}/src/sunholo/database/database.py +0 -0
- {sunholo-0.136.0 → sunholo-0.136.2}/src/sunholo/database/lancedb.py +0 -0
- {sunholo-0.136.0 → sunholo-0.136.2}/src/sunholo/database/sql/sb/create_function.sql +0 -0
- {sunholo-0.136.0 → sunholo-0.136.2}/src/sunholo/database/sql/sb/create_function_time.sql +0 -0
- {sunholo-0.136.0 → sunholo-0.136.2}/src/sunholo/database/sql/sb/create_table.sql +0 -0
- {sunholo-0.136.0 → sunholo-0.136.2}/src/sunholo/database/sql/sb/delete_source_row.sql +0 -0
- {sunholo-0.136.0 → sunholo-0.136.2}/src/sunholo/database/sql/sb/return_sources.sql +0 -0
- {sunholo-0.136.0 → sunholo-0.136.2}/src/sunholo/database/sql/sb/setup.sql +0 -0
- {sunholo-0.136.0 → sunholo-0.136.2}/src/sunholo/database/static_dbs.py +0 -0
- {sunholo-0.136.0 → sunholo-0.136.2}/src/sunholo/database/uuid.py +0 -0
- {sunholo-0.136.0 → sunholo-0.136.2}/src/sunholo/discovery_engine/__init__.py +0 -0
- {sunholo-0.136.0 → sunholo-0.136.2}/src/sunholo/discovery_engine/chunker_handler.py +0 -0
- {sunholo-0.136.0 → sunholo-0.136.2}/src/sunholo/discovery_engine/cli.py +0 -0
- {sunholo-0.136.0 → sunholo-0.136.2}/src/sunholo/discovery_engine/create_new.py +0 -0
- {sunholo-0.136.0 → sunholo-0.136.2}/src/sunholo/discovery_engine/get_ai_search_chunks.py +0 -0
- {sunholo-0.136.0 → sunholo-0.136.2}/src/sunholo/embedder/__init__.py +0 -0
- {sunholo-0.136.0 → sunholo-0.136.2}/src/sunholo/embedder/embed_chunk.py +0 -0
- {sunholo-0.136.0 → sunholo-0.136.2}/src/sunholo/embedder/embed_metadata.py +0 -0
- {sunholo-0.136.0 → sunholo-0.136.2}/src/sunholo/excel/__init__.py +0 -0
- {sunholo-0.136.0 → sunholo-0.136.2}/src/sunholo/excel/plugin.py +0 -0
- {sunholo-0.136.0 → sunholo-0.136.2}/src/sunholo/gcs/__init__.py +0 -0
- {sunholo-0.136.0 → sunholo-0.136.2}/src/sunholo/gcs/add_file.py +0 -0
- {sunholo-0.136.0 → sunholo-0.136.2}/src/sunholo/gcs/download_folder.py +0 -0
- {sunholo-0.136.0 → sunholo-0.136.2}/src/sunholo/gcs/download_url.py +0 -0
- {sunholo-0.136.0 → sunholo-0.136.2}/src/sunholo/gcs/extract_and_sign.py +0 -0
- {sunholo-0.136.0 → sunholo-0.136.2}/src/sunholo/gcs/metadata.py +0 -0
- {sunholo-0.136.0 → sunholo-0.136.2}/src/sunholo/genai/__init__.py +0 -0
- {sunholo-0.136.0 → sunholo-0.136.2}/src/sunholo/genai/file_handling.py +0 -0
- {sunholo-0.136.0 → sunholo-0.136.2}/src/sunholo/genai/genaiv2.py +0 -0
- {sunholo-0.136.0 → sunholo-0.136.2}/src/sunholo/genai/images.py +0 -0
- {sunholo-0.136.0 → sunholo-0.136.2}/src/sunholo/genai/init.py +0 -0
- {sunholo-0.136.0 → sunholo-0.136.2}/src/sunholo/genai/process_funcs_cls.py +0 -0
- {sunholo-0.136.0 → sunholo-0.136.2}/src/sunholo/genai/safety.py +0 -0
- {sunholo-0.136.0 → sunholo-0.136.2}/src/sunholo/invoke/__init__.py +0 -0
- {sunholo-0.136.0 → sunholo-0.136.2}/src/sunholo/invoke/async_class.py +0 -0
- {sunholo-0.136.0 → sunholo-0.136.2}/src/sunholo/invoke/direct_vac_func.py +0 -0
- {sunholo-0.136.0 → sunholo-0.136.2}/src/sunholo/invoke/invoke_vac_utils.py +0 -0
- {sunholo-0.136.0 → sunholo-0.136.2}/src/sunholo/langchain_types.py +0 -0
- {sunholo-0.136.0 → sunholo-0.136.2}/src/sunholo/langfuse/__init__.py +0 -0
- {sunholo-0.136.0 → sunholo-0.136.2}/src/sunholo/langfuse/callback.py +0 -0
- {sunholo-0.136.0 → sunholo-0.136.2}/src/sunholo/langfuse/evals.py +0 -0
- {sunholo-0.136.0 → sunholo-0.136.2}/src/sunholo/langfuse/prompts.py +0 -0
- {sunholo-0.136.0 → sunholo-0.136.2}/src/sunholo/llamaindex/__init__.py +0 -0
- {sunholo-0.136.0 → sunholo-0.136.2}/src/sunholo/llamaindex/get_files.py +0 -0
- {sunholo-0.136.0 → sunholo-0.136.2}/src/sunholo/llamaindex/import_files.py +0 -0
- {sunholo-0.136.0 → sunholo-0.136.2}/src/sunholo/llamaindex/llamaindex_class.py +0 -0
- {sunholo-0.136.0 → sunholo-0.136.2}/src/sunholo/llamaindex/user_history.py +0 -0
- {sunholo-0.136.0 → sunholo-0.136.2}/src/sunholo/lookup/__init__.py +0 -0
- {sunholo-0.136.0 → sunholo-0.136.2}/src/sunholo/lookup/model_lookup.yaml +0 -0
- {sunholo-0.136.0 → sunholo-0.136.2}/src/sunholo/mcp/__init__.py +0 -0
- {sunholo-0.136.0 → sunholo-0.136.2}/src/sunholo/mcp/cli.py +0 -0
- {sunholo-0.136.0 → sunholo-0.136.2}/src/sunholo/ollama/__init__.py +0 -0
- {sunholo-0.136.0 → sunholo-0.136.2}/src/sunholo/ollama/ollama_images.py +0 -0
- {sunholo-0.136.0 → sunholo-0.136.2}/src/sunholo/pubsub/__init__.py +0 -0
- {sunholo-0.136.0 → sunholo-0.136.2}/src/sunholo/pubsub/process_pubsub.py +0 -0
- {sunholo-0.136.0 → sunholo-0.136.2}/src/sunholo/pubsub/pubsub_manager.py +0 -0
- {sunholo-0.136.0 → sunholo-0.136.2}/src/sunholo/qna/__init__.py +0 -0
- {sunholo-0.136.0 → sunholo-0.136.2}/src/sunholo/qna/parsers.py +0 -0
- {sunholo-0.136.0 → sunholo-0.136.2}/src/sunholo/qna/retry.py +0 -0
- {sunholo-0.136.0 → sunholo-0.136.2}/src/sunholo/senses/__init__.py +0 -0
- {sunholo-0.136.0 → sunholo-0.136.2}/src/sunholo/senses/stream_voice.py +0 -0
- {sunholo-0.136.0 → sunholo-0.136.2}/src/sunholo/streaming/__init__.py +0 -0
- {sunholo-0.136.0 → sunholo-0.136.2}/src/sunholo/streaming/content_buffer.py +0 -0
- {sunholo-0.136.0 → sunholo-0.136.2}/src/sunholo/streaming/langserve.py +0 -0
- {sunholo-0.136.0 → sunholo-0.136.2}/src/sunholo/streaming/stream_lookup.py +0 -0
- {sunholo-0.136.0 → sunholo-0.136.2}/src/sunholo/streaming/streaming.py +0 -0
- {sunholo-0.136.0 → sunholo-0.136.2}/src/sunholo/summarise/__init__.py +0 -0
- {sunholo-0.136.0 → sunholo-0.136.2}/src/sunholo/summarise/summarise.py +0 -0
- {sunholo-0.136.0 → sunholo-0.136.2}/src/sunholo/templates/agent/__init__.py +0 -0
- {sunholo-0.136.0 → sunholo-0.136.2}/src/sunholo/templates/agent/agent_service.py +0 -0
- {sunholo-0.136.0 → sunholo-0.136.2}/src/sunholo/templates/agent/app.py +0 -0
- {sunholo-0.136.0 → sunholo-0.136.2}/src/sunholo/templates/agent/my_log.py +0 -0
- {sunholo-0.136.0 → sunholo-0.136.2}/src/sunholo/templates/agent/tools/__init__.py +0 -0
- {sunholo-0.136.0 → sunholo-0.136.2}/src/sunholo/templates/agent/tools/your_agent.py +0 -0
- {sunholo-0.136.0 → sunholo-0.136.2}/src/sunholo/templates/agent/vac_service.py +0 -0
- {sunholo-0.136.0 → sunholo-0.136.2}/src/sunholo/templates/project/__init__.py +0 -0
- {sunholo-0.136.0 → sunholo-0.136.2}/src/sunholo/templates/project/app.py +0 -0
- {sunholo-0.136.0 → sunholo-0.136.2}/src/sunholo/templates/project/my_log.py +0 -0
- {sunholo-0.136.0 → sunholo-0.136.2}/src/sunholo/templates/project/vac_service.py +0 -0
- {sunholo-0.136.0 → sunholo-0.136.2}/src/sunholo/templates/system_services/__init__.py +0 -0
- {sunholo-0.136.0 → sunholo-0.136.2}/src/sunholo/templates/system_services/app.py +0 -0
- {sunholo-0.136.0 → sunholo-0.136.2}/src/sunholo/templates/system_services/my_log.py +0 -0
- {sunholo-0.136.0 → sunholo-0.136.2}/src/sunholo/terraform/__init__.py +0 -0
- {sunholo-0.136.0 → sunholo-0.136.2}/src/sunholo/terraform/tfvars_editor.py +0 -0
- {sunholo-0.136.0 → sunholo-0.136.2}/src/sunholo/tools/__init__.py +0 -0
- {sunholo-0.136.0 → sunholo-0.136.2}/src/sunholo/tools/web_browser.py +0 -0
- {sunholo-0.136.0 → sunholo-0.136.2}/src/sunholo/utils/__init__.py +0 -0
- {sunholo-0.136.0 → sunholo-0.136.2}/src/sunholo/utils/api_key.py +0 -0
- {sunholo-0.136.0 → sunholo-0.136.2}/src/sunholo/utils/big_context.py +0 -0
- {sunholo-0.136.0 → sunholo-0.136.2}/src/sunholo/utils/config.py +0 -0
- {sunholo-0.136.0 → sunholo-0.136.2}/src/sunholo/utils/config_class.py +0 -0
- {sunholo-0.136.0 → sunholo-0.136.2}/src/sunholo/utils/config_schema.py +0 -0
- {sunholo-0.136.0 → sunholo-0.136.2}/src/sunholo/utils/gcp.py +0 -0
- {sunholo-0.136.0 → sunholo-0.136.2}/src/sunholo/utils/gcp_project.py +0 -0
- {sunholo-0.136.0 → sunholo-0.136.2}/src/sunholo/utils/mime.py +0 -0
- {sunholo-0.136.0 → sunholo-0.136.2}/src/sunholo/utils/parsers.py +0 -0
- {sunholo-0.136.0 → sunholo-0.136.2}/src/sunholo/utils/timedelta.py +0 -0
- {sunholo-0.136.0 → sunholo-0.136.2}/src/sunholo/utils/user_ids.py +0 -0
- {sunholo-0.136.0 → sunholo-0.136.2}/src/sunholo/utils/version.py +0 -0
- {sunholo-0.136.0 → sunholo-0.136.2}/src/sunholo/vertex/__init__.py +0 -0
- {sunholo-0.136.0 → sunholo-0.136.2}/src/sunholo/vertex/extensions_call.py +0 -0
- {sunholo-0.136.0 → sunholo-0.136.2}/src/sunholo/vertex/extensions_class.py +0 -0
- {sunholo-0.136.0 → sunholo-0.136.2}/src/sunholo/vertex/genai_functions.py +0 -0
- {sunholo-0.136.0 → sunholo-0.136.2}/src/sunholo/vertex/init.py +0 -0
- {sunholo-0.136.0 → sunholo-0.136.2}/src/sunholo/vertex/memory_tools.py +0 -0
- {sunholo-0.136.0 → sunholo-0.136.2}/src/sunholo/vertex/safety.py +0 -0
- {sunholo-0.136.0 → sunholo-0.136.2}/src/sunholo/vertex/type_dict_to_json.py +0 -0
- {sunholo-0.136.0 → sunholo-0.136.2}/src/sunholo.egg-info/SOURCES.txt +0 -0
- {sunholo-0.136.0 → sunholo-0.136.2}/src/sunholo.egg-info/dependency_links.txt +0 -0
- {sunholo-0.136.0 → sunholo-0.136.2}/src/sunholo.egg-info/entry_points.txt +0 -0
- {sunholo-0.136.0 → sunholo-0.136.2}/src/sunholo.egg-info/requires.txt +0 -0
- {sunholo-0.136.0 → sunholo-0.136.2}/src/sunholo.egg-info/top_level.txt +0 -0
- {sunholo-0.136.0 → sunholo-0.136.2}/tests/test_async.py +0 -0
- {sunholo-0.136.0 → sunholo-0.136.2}/tests/test_async_genai2.py +0 -0
- {sunholo-0.136.0 → sunholo-0.136.2}/tests/test_chat_history.py +0 -0
- {sunholo-0.136.0 → sunholo-0.136.2}/tests/test_config.py +0 -0
- {sunholo-0.136.0 → sunholo-0.136.2}/tests/test_genai2.py +0 -0
- {sunholo-0.136.0 → sunholo-0.136.2}/tests/test_unstructured.py +0 -0
@@ -487,23 +487,34 @@ class DiscoveryEngineClient:
|
|
487
487
|
all_documents = []
|
488
488
|
result_count = 0
|
489
489
|
# Check if the response contains results
|
490
|
-
if not hasattr(response, 'results') or not response.results:
|
490
|
+
if not response or not hasattr(response, 'results') or not response.results:
|
491
491
|
log.info(f'No results found in response: {response=}')
|
492
492
|
return []
|
493
493
|
|
494
|
-
|
495
|
-
|
496
|
-
|
497
|
-
|
498
|
-
|
499
|
-
|
500
|
-
|
501
|
-
|
502
|
-
|
503
|
-
|
504
|
-
|
505
|
-
|
506
|
-
|
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")
|
507
518
|
|
508
519
|
# Combine all documents into one long string
|
509
520
|
result_string = "\n\n".join(all_documents)
|
@@ -516,23 +527,34 @@ class DiscoveryEngineClient:
|
|
516
527
|
result_count = 0
|
517
528
|
|
518
529
|
# Check if the response contains results
|
519
|
-
if not hasattr(response, 'results') or not response.results:
|
530
|
+
if not response or not hasattr(response, 'results') or not response.results:
|
520
531
|
log.info(f'No results found in response: {response=}')
|
521
532
|
return []
|
522
|
-
|
523
|
-
|
524
|
-
|
525
|
-
|
526
|
-
|
527
|
-
|
528
|
-
|
529
|
-
|
530
|
-
|
531
|
-
|
532
|
-
|
533
|
-
|
534
|
-
|
535
|
-
|
533
|
+
|
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")
|
536
558
|
|
537
559
|
# Combine all documents into one long string
|
538
560
|
result_string = "\n\n".join(all_documents)
|
@@ -862,33 +884,6 @@ class DiscoveryEngineClient:
|
|
862
884
|
except Exception as e:
|
863
885
|
log.info(f"No results {search_request.data_store_specs=}: {str(e)}")
|
864
886
|
return None
|
865
|
-
|
866
|
-
# Apply max_limit if needed
|
867
|
-
if content_search_spec_type=="documents" and max_limit is not None:
|
868
|
-
# For raw response objects (when parse_chunks_to_string=False)
|
869
|
-
if not parse_chunks_to_string:
|
870
|
-
# We need to limit the pager results before returning
|
871
|
-
limited_response = search_response
|
872
|
-
# Store the original pages iterator method
|
873
|
-
original_pages = limited_response.pages
|
874
|
-
|
875
|
-
# Override the pages property with a custom iterator that respects max_limit
|
876
|
-
def limited_pages_iterator():
|
877
|
-
results_count = 0
|
878
|
-
for page in original_pages:
|
879
|
-
yield page
|
880
|
-
|
881
|
-
# Count results in this page
|
882
|
-
if hasattr(page, 'results'):
|
883
|
-
results_count += len(page.results)
|
884
|
-
|
885
|
-
# Stop if we've reached max_limit
|
886
|
-
if results_count >= max_limit:
|
887
|
-
break
|
888
|
-
|
889
|
-
# Replace the pages property with our custom iterator
|
890
|
-
limited_response.pages = limited_pages_iterator()
|
891
|
-
return limited_response
|
892
887
|
|
893
888
|
if parse_chunks_to_string:
|
894
889
|
if content_search_spec_type=="chunks":
|
@@ -973,33 +968,6 @@ class DiscoveryEngineClient:
|
|
973
968
|
except Exception as e:
|
974
969
|
log.info(f"No results {search_request.data_store_specs=}: {str(e)}")
|
975
970
|
return None
|
976
|
-
|
977
|
-
# Apply max_limit if needed
|
978
|
-
if content_search_spec_type=="documents" and max_limit is not None:
|
979
|
-
# For raw response objects (when parse_chunks_to_string=False)
|
980
|
-
if not parse_chunks_to_string:
|
981
|
-
# We need to limit the pager results before returning
|
982
|
-
limited_response = search_response
|
983
|
-
# Store the original pages iterator method
|
984
|
-
original_pages = limited_response.pages
|
985
|
-
|
986
|
-
# Override the pages property with a custom iterator that respects max_limit
|
987
|
-
async def limited_pages_iterator():
|
988
|
-
results_count = 0
|
989
|
-
async for page in original_pages:
|
990
|
-
yield page
|
991
|
-
|
992
|
-
# Count results in this page
|
993
|
-
if hasattr(page, 'results'):
|
994
|
-
results_count += len(page.results)
|
995
|
-
|
996
|
-
# Stop if we've reached max_limit
|
997
|
-
if results_count >= max_limit:
|
998
|
-
break
|
999
|
-
|
1000
|
-
# Replace the pages property with our custom iterator
|
1001
|
-
limited_response.pages = limited_pages_iterator()
|
1002
|
-
return limited_response
|
1003
971
|
|
1004
972
|
if parse_chunks_to_string:
|
1005
973
|
if content_search_spec_type=="chunks":
|
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
|
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
|
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
|
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
|
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
|
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
|
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
|
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
|
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
|
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
|
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
|
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
|
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
|
File without changes
|
File without changes
|