Skip to content

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

Feat/highlight data env (#1219)

vishnuszipstack87049bd13b90
diff --git a/backend/api_v2/api_deployment_views.py b/backend/api_v2/api_deployment_views.py
index 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 settings
from django.db.models import QuerySet
from django.http import HttpResponse
from permissions.permission import IsOwner
@@ -91,7 +92,8 @@ class DeploymentExecution(views.APIView):
response_status = status.HTTP_422_UNPROCESSABLE_ENTITY
if 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.py
index 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 KeyHelper
from api_v2.models import APIDeployment, APIKey
from api_v2.serializers import APIExecutionResponseSerializer
from api_v2.utils import APIDeploymentUtils
+from django.conf import settings
from django.core.files.uploadedfile import UploadedFile
from rest_framework.request import Request
from 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.py
index 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.env
index 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 registry
TOOL_REGISTRY_STORAGE_CREDENTIALS='{"provider":"local"}'
+
+# Highlight data to be available in api deployment
+ENABLE_HIGHLIGHT_API_DEPLOYMENT=False