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] Fixing regression for remote storage file view (#1063)
harini-venkataraman078bff4d6f4e
diff --git a/backend/utils/file_storage/helpers/prompt_studio_file_helper.py b/backend/utils/file_storage/helpers/prompt_studio_file_helper.pyindex 8b6811069..5bd01c73d 100644--- a/backend/utils/file_storage/helpers/prompt_studio_file_helper.py+++ b/backend/utils/file_storage/helpers/prompt_studio_file_helper.py@@ -2,7 +2,7 @@ import base64import loggingimport osfrom pathlib import Path-from typing import Any, Union+from typing import Anyfrom file_management.file_management_helper import FileManagerHelperfrom unstract.sdk.file_storage import FileStorage@@ -77,7 +77,7 @@ class PromptStudioFileHelper:@staticmethoddef fetch_file_contents(org_id: str, user_id: str, tool_id: str, file_name: str- ) -> Union[bytes, str]:+ ) -> dict[str, Any]:"""Method to fetch file contents from the remote location.The path is constructed in runtime based on the args"""fs_instance = EnvHelper.get_storage(@@ -125,7 +125,7 @@ class PromptStudioFileHelper:encoding="utf-8",)encoded_string = base64.b64encode(bytes(text_content_bytes))- return encoded_string+ return {"data": encoded_string, "mime_type": file_content_type}elif file_content_type == "text/plain":text_content_string: str = fs_instance.read(@@ -134,7 +134,7 @@ class PromptStudioFileHelper:legacy_storage_path=legacy_file_path,encoding="utf-8",)- return text_content_string+ return {"data": text_content_string, "mime_type": file_content_type}else:raise ValueError(f"Unsupported file type: {file_content_type}")