Skip to content

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

feat: Minor index error handling enhancement (#294)

Chandrasekharan M2b1afa82d6ce
diff --git a/backend/prompt_studio/prompt_studio_core/exceptions.py b/backend/prompt_studio/prompt_studio_core/exceptions.py
index 9f4d2b73b..8e03342b0 100644
--- a/backend/prompt_studio/prompt_studio_core/exceptions.py
+++ b/backend/prompt_studio/prompt_studio_core/exceptions.py
@@ -19,7 +19,7 @@ class PromptNotValid(APIException):
class IndexingAPIError(APIException):
- status_code = 400
+ status_code = 500
default_detail = "Error while indexing file"
diff --git a/backend/prompt_studio/prompt_studio_core/prompt_studio_helper.py b/backend/prompt_studio/prompt_studio_core/prompt_studio_helper.py
index 154600369..21e1e3eb3 100644
--- a/backend/prompt_studio/prompt_studio_core/prompt_studio_helper.py
+++ b/backend/prompt_studio/prompt_studio_core/prompt_studio_helper.py
@@ -661,13 +661,14 @@ class PromptStudioHelper:
)
return doc_id
except IndexingError as e:
+ doc_name = os.path.split(file_path)[1]
PromptStudioHelper._publish_log(
- {"tool_id": tool_id, "doc_name": os.path.split(file_path)[1]},
+ {"tool_id": tool_id, "doc_name": doc_name},
LogLevels.ERROR,
LogLevels.RUN,
- "Indexing failed",
+ f"Indexing failed : {e}",
)
- raise IndexingAPIError(str(e)) from e
+ raise IndexingAPIError(f"Error while indexing {doc_name}. {str(e)}") from e
@staticmethod
def _fetch_single_pass_response(
diff --git a/backend/sample.env b/backend/sample.env
index f4fc27d7c..e81d824fb 100644
--- a/backend/sample.env
+++ b/backend/sample.env
@@ -123,8 +123,10 @@ SYSTEM_ADMIN_EMAIL="[email protected]"
# Set Django Session Expiry Time (in seconds)
SESSION_COOKIE_AGE=86400
+
# Control async extraction of LLM Whisperer
# Time in seconds to wait before polling LLMWhisperer's status API
ADAPTER_LLMW_POLL_INTERVAL=30
# Total number of times to poll the status API.
-ADAPTER_LLMW_MAX_POLLS=30
+# 500 mins to allow 1500 (max pages limit) * 20 (approx time in sec to process a page)
+ADAPTER_LLMW_MAX_POLLS=1000