LLM-Driven Extraction of Unstructured Data — Built for API Deployments & ETL Pipeline Workflows
Python ai-agentsdata-engineeringdocument-aigenerative-aiidpjson-extractionllmmcp-serverocrpdf-extractionprompt-engineeringstructured-output
UN-2444 [FIX] Fixing output format for Rent rolls (#1417)
harini-venkataraman02f04304f52d
diff --git a/backend/prompt_studio/prompt_studio_output_manager_v2/output_manager_helper.py b/backend/prompt_studio/prompt_studio_output_manager_v2/output_manager_helper.pyindex 39cff534a..f20d3c88d 100644--- a/backend/prompt_studio/prompt_studio_output_manager_v2/output_manager_helper.py+++ b/backend/prompt_studio/prompt_studio_output_manager_v2/output_manager_helper.py@@ -141,7 +141,8 @@ class OutputManagerHelper:continueif not is_single_pass_extract:- context = context.get(prompt.prompt_key)+ if context:+ context = context.get(prompt.prompt_key)if highlight_data:highlight_data = highlight_data.get(prompt.prompt_key)if confidence_data:@@ -152,12 +153,12 @@ class OutputManagerHelper:if challenge_data:challenge_data["file_name"] = metadata.get("file_name")- output = outputs.get(prompt.prompt_key)# TODO: use enums here+ output = outputs.get(prompt.prompt_key)if prompt.enforce_type in {"json", "table", "record", "line-item"}:output = json.dumps(output)- profile_manager = default_profileeval_metrics = outputs.get(f"{prompt.prompt_key}__evaluation", [])+ profile_manager = default_profile# Update or create the prompt outputprompt_output = update_or_create_prompt_output(diff --git a/prompt-service/src/unstract/prompt_service/controllers/answer_prompt.py b/prompt-service/src/unstract/prompt_service/controllers/answer_prompt.pyindex 3e8ad369b..52bf7dfd2 100644--- a/prompt-service/src/unstract/prompt_service/controllers/answer_prompt.py+++ b/prompt-service/src/unstract/prompt_service/controllers/answer_prompt.py@@ -227,8 +227,9 @@ def prompt_processor() -> Any:# Update structured output with the extraction result# TODO: Add metrics# TODO: Add metadata+ structured_output[output[PSKeys.NAME]] = extraction_resultresponse = {- PSKeys.OUTPUT: extraction_result,+ PSKeys.OUTPUT: structured_output,PSKeys.METADATA: {},PSKeys.METRICS: {},}