diff --git a/backend/prompt_studio/prompt_studio_output_manager/output_manager_helper.py b/backend/prompt_studio/prompt_studio_output_manager/output_manager_helper.py index b88a25602..6d97cf633 100644 --- a/backend/prompt_studio/prompt_studio_output_manager/output_manager_helper.py +++ b/backend/prompt_studio/prompt_studio_output_manager/output_manager_helper.py @@ -101,7 +101,7 @@ def update_or_create_prompt_output( document_manager = DocumentManager.objects.get(pk=document_id) for prompt in prompts: - if prompt.prompt_type == PSOMKeys.NOTES or not prompt.active: + if prompt.prompt_type == PSOMKeys.NOTES: continue if not is_single_pass_extract: diff --git a/backend/prompt_studio/prompt_studio_registry/exceptions.py b/backend/prompt_studio/prompt_studio_registry/exceptions.py index 12a182991..93086d815 100644 --- a/backend/prompt_studio/prompt_studio_registry/exceptions.py +++ b/backend/prompt_studio/prompt_studio_registry/exceptions.py @@ -19,8 +19,9 @@ class ToolSaveError(APIException): class EmptyToolExportError(APIException): status_code = 500 default_detail = ( - "Empty Prompt Studio project without prompts cannot be exported. " - "Try adding a prompt and executing it." + "Prompt Studio project without prompts cannot be exported. " + "Please ensure there is at least one prompt and " + "it is active before exporting." ) diff --git a/backend/prompt_studio/prompt_studio_registry/prompt_studio_registry_helper.py b/backend/prompt_studio/prompt_studio_registry/prompt_studio_registry_helper.py index 33c253205..8a9877a85 100644 --- a/backend/prompt_studio/prompt_studio_registry/prompt_studio_registry_helper.py +++ b/backend/prompt_studio/prompt_studio_registry/prompt_studio_registry_helper.py @@ -325,6 +325,9 @@ def frame_export_json( llm = "" embedding_model = "" + if not outputs: + raise EmptyToolExportError() + if invalidated_prompts: raise InValidCustomToolError( f"Cannot export tool. Prompt(s): {', '.join(invalidated_prompts)} " diff --git a/frontend/src/components/custom-tools/prompt-card/PromptCard.jsx b/frontend/src/components/custom-tools/prompt-card/PromptCard.jsx index c945faec7..883433f3d 100644 --- a/frontend/src/components/custom-tools/prompt-card/PromptCard.jsx +++ b/frontend/src/components/custom-tools/prompt-card/PromptCard.jsx @@ -481,13 +481,7 @@ function PromptCard({ .then((res) => { const data = res?.data?.output; const outputValue = data[promptDetails?.prompt_key]; - if (outputValue || outputValue === 0) { - updateDocCoverage( - promptDetails?.prompt_id, - profileManagerId, - docId - ); - } + updateDocCoverage(promptDetails?.prompt_id, profileManagerId, docId); handleDocOutputs( docId, promptDetails?.prompt_id, diff --git a/prompt-service/src/unstract/prompt_service/main.py b/prompt-service/src/unstract/prompt_service/main.py index 73787685d..aeb9f022c 100644 --- a/prompt-service/src/unstract/prompt_service/main.py +++ b/prompt-service/src/unstract/prompt_service/main.py @@ -204,28 +204,12 @@ def prompt_processor() -> Any: for output in outputs: # type:ignore variable_names.append(output[PSKeys.NAME]) for output in outputs: # type:ignore - is_active = output[PSKeys.ACTIVE] prompt_name = output[PSKeys.NAME] promptx = output[PSKeys.PROMPT] chunk_size = output[PSKeys.CHUNK_SIZE] util = PromptServiceBaseTool(log_level=LogLevel.INFO, platform_key=platform_key) index = Index(tool=util) - if is_active is False: - app.logger.info(f"[{tool_id}] Skipping inactive prompt: {prompt_name}") - _publish_log( - log_events_id, - { - "tool_id": tool_id, - "prompt_key": prompt_name, - "doc_name": doc_name, - }, - LogLevel.INFO, - RunLevel.RUN, - "Skipping inactive prompt", - ) - continue - app.logger.info(f"[{tool_id}] Executing prompt: {prompt_name}") _publish_log( log_events_id,