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.
- {sunholo-0.140.8/src/sunholo.egg-info → sunholo-0.140.10}/PKG-INFO +1 -1
- {sunholo-0.140.8 → sunholo-0.140.10}/pyproject.toml +1 -1
- {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/agents/flask/vac_routes.py +24 -101
- {sunholo-0.140.8 → sunholo-0.140.10/src/sunholo.egg-info}/PKG-INFO +1 -1
- {sunholo-0.140.8 → sunholo-0.140.10}/LICENSE.txt +0 -0
- {sunholo-0.140.8 → sunholo-0.140.10}/MANIFEST.in +0 -0
- {sunholo-0.140.8 → sunholo-0.140.10}/README.md +0 -0
- {sunholo-0.140.8 → sunholo-0.140.10}/setup.cfg +0 -0
- {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/__init__.py +0 -0
- {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/agents/__init__.py +0 -0
- {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/agents/chat_history.py +0 -0
- {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/agents/dispatch_to_qa.py +0 -0
- {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/agents/fastapi/__init__.py +0 -0
- {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/agents/fastapi/base.py +0 -0
- {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/agents/fastapi/qna_routes.py +0 -0
- {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/agents/flask/__init__.py +0 -0
- {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/agents/flask/base.py +0 -0
- {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/agents/langserve.py +0 -0
- {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/agents/pubsub.py +0 -0
- {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/agents/route.py +0 -0
- {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/agents/special_commands.py +0 -0
- {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/agents/swagger.py +0 -0
- {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/archive/__init__.py +0 -0
- {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/archive/archive.py +0 -0
- {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/auth/__init__.py +0 -0
- {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/auth/gcloud.py +0 -0
- {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/auth/refresh.py +0 -0
- {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/auth/run.py +0 -0
- {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/azure/__init__.py +0 -0
- {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/azure/auth.py +0 -0
- {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/azure/blobs.py +0 -0
- {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/azure/event_grid.py +0 -0
- {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/bots/__init__.py +0 -0
- {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/bots/discord.py +0 -0
- {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/bots/github_webhook.py +0 -0
- {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/bots/webapp.py +0 -0
- {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/chunker/__init__.py +0 -0
- {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/chunker/azure.py +0 -0
- {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/chunker/doc_handling.py +0 -0
- {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/chunker/encode_metadata.py +0 -0
- {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/chunker/images.py +0 -0
- {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/chunker/loaders.py +0 -0
- {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/chunker/message_data.py +0 -0
- {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/chunker/pdfs.py +0 -0
- {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/chunker/process_chunker_data.py +0 -0
- {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/chunker/publish.py +0 -0
- {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/chunker/pubsub.py +0 -0
- {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/chunker/splitter.py +0 -0
- {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/cli/__init__.py +0 -0
- {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/cli/chat_vac.py +0 -0
- {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/cli/cli.py +0 -0
- {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/cli/cli_init.py +0 -0
- {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/cli/configs.py +0 -0
- {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/cli/deploy.py +0 -0
- {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/cli/embedder.py +0 -0
- {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/cli/merge_texts.py +0 -0
- {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/cli/run_proxy.py +0 -0
- {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/cli/sun_rich.py +0 -0
- {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/cli/swagger.py +0 -0
- {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/cli/vertex.py +0 -0
- {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/components/__init__.py +0 -0
- {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/components/llm.py +0 -0
- {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/components/retriever.py +0 -0
- {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/components/vectorstore.py +0 -0
- {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/custom_logging.py +0 -0
- {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/database/__init__.py +0 -0
- {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/database/alloydb.py +0 -0
- {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/database/alloydb_client.py +0 -0
- {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/database/database.py +0 -0
- {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/database/lancedb.py +0 -0
- {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/database/sql/sb/create_function.sql +0 -0
- {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/database/sql/sb/create_function_time.sql +0 -0
- {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/database/sql/sb/create_table.sql +0 -0
- {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/database/sql/sb/delete_source_row.sql +0 -0
- {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/database/sql/sb/return_sources.sql +0 -0
- {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/database/sql/sb/setup.sql +0 -0
- {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/database/static_dbs.py +0 -0
- {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/database/uuid.py +0 -0
- {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/discovery_engine/__init__.py +0 -0
- {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/discovery_engine/chunker_handler.py +0 -0
- {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/discovery_engine/cli.py +0 -0
- {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/discovery_engine/create_new.py +0 -0
- {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/discovery_engine/discovery_engine_client.py +0 -0
- {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/discovery_engine/get_ai_search_chunks.py +0 -0
- {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/embedder/__init__.py +0 -0
- {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/embedder/embed_chunk.py +0 -0
- {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/embedder/embed_metadata.py +0 -0
- {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/excel/__init__.py +0 -0
- {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/excel/plugin.py +0 -0
- {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/gcs/__init__.py +0 -0
- {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/gcs/add_file.py +0 -0
- {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/gcs/download_folder.py +0 -0
- {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/gcs/download_gcs_text.py +0 -0
- {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/gcs/download_url.py +0 -0
- {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/gcs/extract_and_sign.py +0 -0
- {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/gcs/metadata.py +0 -0
- {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/genai/__init__.py +0 -0
- {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/genai/file_handling.py +0 -0
- {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/genai/genaiv2.py +0 -0
- {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/genai/images.py +0 -0
- {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/genai/init.py +0 -0
- {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/genai/process_funcs_cls.py +0 -0
- {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/genai/safety.py +0 -0
- {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/invoke/__init__.py +0 -0
- {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/invoke/async_class.py +0 -0
- {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/invoke/direct_vac_func.py +0 -0
- {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/invoke/invoke_vac_utils.py +0 -0
- {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/langchain_types.py +0 -0
- {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/langfuse/__init__.py +0 -0
- {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/langfuse/callback.py +0 -0
- {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/langfuse/evals.py +0 -0
- {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/langfuse/prompts.py +0 -0
- {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/llamaindex/__init__.py +0 -0
- {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/llamaindex/get_files.py +0 -0
- {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/llamaindex/import_files.py +0 -0
- {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/llamaindex/llamaindex_class.py +0 -0
- {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/llamaindex/user_history.py +0 -0
- {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/lookup/__init__.py +0 -0
- {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/lookup/model_lookup.yaml +0 -0
- {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/mcp/__init__.py +0 -0
- {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/mcp/cli.py +0 -0
- {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/ollama/__init__.py +0 -0
- {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/ollama/ollama_images.py +0 -0
- {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/pubsub/__init__.py +0 -0
- {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/pubsub/process_pubsub.py +0 -0
- {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/pubsub/pubsub_manager.py +0 -0
- {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/qna/__init__.py +0 -0
- {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/qna/parsers.py +0 -0
- {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/qna/retry.py +0 -0
- {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/senses/__init__.py +0 -0
- {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/senses/stream_voice.py +0 -0
- {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/streaming/__init__.py +0 -0
- {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/streaming/content_buffer.py +0 -0
- {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/streaming/langserve.py +0 -0
- {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/streaming/stream_lookup.py +0 -0
- {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/streaming/streaming.py +0 -0
- {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/summarise/__init__.py +0 -0
- {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/summarise/summarise.py +0 -0
- {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/templates/agent/__init__.py +0 -0
- {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/templates/agent/agent_service.py +0 -0
- {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/templates/agent/app.py +0 -0
- {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/templates/agent/my_log.py +0 -0
- {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/templates/agent/tools/__init__.py +0 -0
- {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/templates/agent/tools/your_agent.py +0 -0
- {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/templates/agent/vac_service.py +0 -0
- {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/templates/project/__init__.py +0 -0
- {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/templates/project/app.py +0 -0
- {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/templates/project/my_log.py +0 -0
- {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/templates/project/vac_service.py +0 -0
- {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/templates/system_services/__init__.py +0 -0
- {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/templates/system_services/app.py +0 -0
- {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/templates/system_services/my_log.py +0 -0
- {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/terraform/__init__.py +0 -0
- {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/terraform/tfvars_editor.py +0 -0
- {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/tools/__init__.py +0 -0
- {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/tools/web_browser.py +0 -0
- {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/utils/__init__.py +0 -0
- {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/utils/api_key.py +0 -0
- {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/utils/big_context.py +0 -0
- {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/utils/config.py +0 -0
- {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/utils/config_class.py +0 -0
- {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/utils/config_schema.py +0 -0
- {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/utils/gcp.py +0 -0
- {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/utils/gcp_project.py +0 -0
- {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/utils/mime.py +0 -0
- {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/utils/parsers.py +0 -0
- {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/utils/timedelta.py +0 -0
- {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/utils/user_ids.py +0 -0
- {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/utils/version.py +0 -0
- {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/vertex/__init__.py +0 -0
- {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/vertex/extensions_call.py +0 -0
- {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/vertex/extensions_class.py +0 -0
- {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/vertex/genai_functions.py +0 -0
- {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/vertex/init.py +0 -0
- {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/vertex/memory_tools.py +0 -0
- {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/vertex/safety.py +0 -0
- {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/vertex/type_dict_to_json.py +0 -0
- {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo.egg-info/SOURCES.txt +0 -0
- {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo.egg-info/dependency_links.txt +0 -0
- {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo.egg-info/entry_points.txt +0 -0
- {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo.egg-info/requires.txt +0 -0
- {sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo.egg-info/top_level.txt +0 -0
- {sunholo-0.140.8 → sunholo-0.140.10}/tests/test_async.py +0 -0
- {sunholo-0.140.8 → sunholo-0.140.10}/tests/test_async_genai2.py +0 -0
- {sunholo-0.140.8 → sunholo-0.140.10}/tests/test_chat_history.py +0 -0
- {sunholo-0.140.8 → sunholo-0.140.10}/tests/test_config.py +0 -0
- {sunholo-0.140.8 → sunholo-0.140.10}/tests/test_genai2.py +0 -0
- {sunholo-0.140.8 → sunholo-0.140.10}/tests/test_unstructured.py +0 -0
@@ -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
|
-
|
297
|
-
|
298
|
-
|
299
|
-
|
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'
|
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
|
-
|
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("
|
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
|
-
|
398
|
-
log.error(error_msg)
|
399
|
-
yield error_msg
|
384
|
+
yield f"Streaming Error: {str(e)} {traceback.format_exc()}"
|
400
385
|
|
401
|
-
#
|
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.
|
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
|
-
|
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
|
-
#
|
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
|
-
#
|
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)
|
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
|
{sunholo-0.140.8 → sunholo-0.140.10}/src/sunholo/discovery_engine/discovery_engine_client.py
RENAMED
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
|