LLM-Driven Extraction of Unstructured Data — Built for API Deployments & ETL Pipeline Workflows
Python ai-agentsdata-engineeringdocument-aigenerative-aiidpjson-extractionllmmcp-serverocrpdf-extractionprompt-engineeringstructured-output
[FIX] Added missing stream_update() Method (#1675)
Praveen Kumard00f9e691d8b
diff --git a/unstract/sdk1/src/unstract/sdk1/tool/stream.py b/unstract/sdk1/src/unstract/sdk1/tool/stream.pyindex 0fde90efa..92e3b6735 100644--- a/unstract/sdk1/src/unstract/sdk1/tool/stream.py+++ b/unstract/sdk1/src/unstract/sdk1/tool/stream.py@@ -4,6 +4,7 @@ import loggingimport osfrom typing import Any+from deprecated import deprecatedfrom unstract.sdk1.constants import Command, LogLevel, LogStage, ToolEnvfrom unstract.sdk1.exceptions import SdkErrorfrom unstract.sdk1.utils.common import Utils@@ -234,3 +235,24 @@ class StreamMixin:**kwargs,}print(json.dumps(record))++ @staticmethod+ @deprecated(version="0.4.4", reason="Use `BaseTool.write_to_result()` instead")+ def stream_result(result: dict[Any, Any], **kwargs: dict[str, Any]) -> None:+ """Streams tool result (review if required).++ Args:+ result (dict): The result of the tool. Refer to the+ Unstract protocol for the format of the result.+ **kwargs: Additional keyword arguments to include in the record.++ Returns:+ None+ """+ record = {+ "type": "RESULT",+ "result": result,+ "emitted_at": datetime.datetime.now().isoformat(),+ **kwargs,+ }+ print(json.dumps(record))