Skip to content

LLM-Driven Extraction of Unstructured Data — Built for API Deployments & ETL Pipeline Workflows

Load file util function fix (#483)

Rahul Johnyc23194efd87e
diff --git a/backend/workflow_manager/endpoint/source.py b/backend/workflow_manager/endpoint/source.py
index 4dd096044..9a4306e4c 100644
--- a/backend/workflow_manager/endpoint/source.py
+++ b/backend/workflow_manager/endpoint/source.py
@@ -386,6 +386,17 @@ class SourceConnector(BaseConnector):
results.append({"file": file_name, "result": result})
def load_file(self, input_file_path: str) -> tuple[str, BytesIO]:
+ """Load file contnt and file name based on the file path.
+
+ Args:
+ input_file_path (str): source file
+
+ Raises:
+ InvalidSource: _description_
+
+ Returns:
+ tuple[str, BytesIO]: file_name , file content
+ """
connector: ConnectorInstance = self.endpoint.connector_instance
connector_settings: dict[str, Any] = connector.connector_metadata
source_fs: fsspec.AbstractFileSystem = self.get_fsspec(
@@ -395,7 +406,7 @@ class SourceConnector(BaseConnector):
file_content = remote_file.read()
file_stream = BytesIO(file_content)
- return remote_file.key, file_stream
+ return os.path.basename(input_file_path), file_stream
@classmethod
def add_input_file_to_api_storage(