From b67768c7748e362250a46e0154f2e20d9e10c8d0 Mon Sep 17 00:00:00 2001 From: Deepak K <89829542+Deepak-Kesavan@users.noreply.github.com> Date: Thu, 9 Jan 2025 09:45:18 +0530 Subject: [PATCH] FIX: Fixed missing keys in highlight data (#861) Fixed missing keys in highlight data Signed-off-by: Deepak K <89829542+Deepak-Kesavan@users.noreply.github.com> --- prompt-service/src/unstract/prompt_service/helper.py | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/prompt-service/src/unstract/prompt_service/helper.py b/prompt-service/src/unstract/prompt_service/helper.py index 913fb118d..e451a2030 100644 --- a/prompt-service/src/unstract/prompt_service/helper.py +++ b/prompt-service/src/unstract/prompt_service/helper.py @@ -327,13 +327,10 @@ def run_completion( extract_json=prompt_type.lower() != PSKeys.TEXT, ) answer: str = completion[PSKeys.RESPONSE].text - highlight_data = completion.get(PSKeys.HIGHLIGHT_DATA) + highlight_data = completion.get(PSKeys.HIGHLIGHT_DATA, []) confidence_data = completion.get(PSKeys.CONFIDENCE_DATA) if metadata is not None and prompt_key: - if highlight_data: - metadata.setdefault(PSKeys.HIGHLIGHT_DATA, {})[ - prompt_key - ] = highlight_data + metadata.setdefault(PSKeys.HIGHLIGHT_DATA, {})[prompt_key] = highlight_data if confidence_data: metadata.setdefault(PSKeys.CONFIDENCE_DATA, {})[