LLM-Driven Extraction of Unstructured Data — Built for API Deployments & ETL Pipeline Workflows
Python ai-agentsdata-engineeringdocument-aigenerative-aiidpjson-extractionllmmcp-serverocrpdf-extractionprompt-engineeringstructured-output
Feat/highlight data env (#1219)
vishnuszipstack87049bd13b90
diff --git a/backend/api_v2/api_deployment_views.py b/backend/api_v2/api_deployment_views.pyindex 95e215a9c..92bf5ce69 100644--- a/backend/api_v2/api_deployment_views.py+++ b/backend/api_v2/api_deployment_views.py@@ -14,6 +14,7 @@ from api_v2.serializers import (ExecutionQuerySerializer,ExecutionRequestSerializer,)+from django.conf import settingsfrom django.db.models import QuerySetfrom django.http import HttpResponsefrom permissions.permission import IsOwner@@ -91,7 +92,8 @@ class DeploymentExecution(views.APIView):response_status = status.HTTP_422_UNPROCESSABLE_ENTITYif response.execution_status == CeleryTaskState.COMPLETED.value:response_status = status.HTTP_200_OK- response.remove_result_metadata_keys(["highlight_data"])+ if not settings.ENABLE_HIGHLIGHT_API_DEPLOYMENT:+ response.remove_result_metadata_keys(["highlight_data"])if not include_metadata:response.remove_result_metadata_keys()if not include_metrics:diff --git a/backend/api_v2/deployment_helper.py b/backend/api_v2/deployment_helper.pyindex fb2b9f42e..50595224c 100644--- a/backend/api_v2/deployment_helper.py+++ b/backend/api_v2/deployment_helper.py@@ -13,6 +13,7 @@ from api_v2.key_helper import KeyHelperfrom api_v2.models import APIDeployment, APIKeyfrom api_v2.serializers import APIExecutionResponseSerializerfrom api_v2.utils import APIDeploymentUtils+from django.conf import settingsfrom django.core.files.uploadedfile import UploadedFilefrom rest_framework.request import Requestfrom rest_framework.serializers import Serializer@@ -185,7 +186,8 @@ class DeploymentHelper(BaseAPIKeyValidator):result.status_api = DeploymentHelper.construct_status_endpoint(api_endpoint=api.api_endpoint, execution_id=execution_id)- result.remove_result_metadata_keys(["highlight_data"])+ if not settings.ENABLE_HIGHLIGHT_API_DEPLOYMENT:+ result.remove_result_metadata_keys(["highlight_data"])if not include_metadata:result.remove_result_metadata_keys()if not include_metrics:diff --git a/backend/backend/settings/base.py b/backend/backend/settings/base.pyindex 12d4fb8e4..154c1cf43 100644--- a/backend/backend/settings/base.py+++ b/backend/backend/settings/base.py@@ -509,3 +509,7 @@ if missing_settings:missing_settings)raise ValueError(ERROR_MESSAGE)++ENABLE_HIGHLIGHT_API_DEPLOYMENT = os.environ.get(+ "ENABLE_HIGHLIGHT_API_DEPLOYMENT", False+)diff --git a/backend/sample.env b/backend/sample.envindex 4cbd469e7..d86a1dccf 100644--- a/backend/sample.env+++ b/backend/sample.env@@ -165,3 +165,6 @@ REMOTE_PROMPT_STUDIO_FILE_PATH="unstract/prompt-studio-data"# Storage Provider for Tool registryTOOL_REGISTRY_STORAGE_CREDENTIALS='{"provider":"local"}'++# Highlight data to be available in api deployment+ENABLE_HIGHLIGHT_API_DEPLOYMENT=False