Skip to content

Commit

Permalink
Merge branch 'main' into feat/UN-1451-pdm-lock-automation
Browse files Browse the repository at this point in the history
  • Loading branch information
kirtimanmishrazipstack authored Jul 19, 2024
2 parents 17d59e7 + d2ea640 commit 2c30994
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
5 changes: 3 additions & 2 deletions backend/prompt_studio/prompt_studio_registry/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -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."
)


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)} "
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
16 changes: 0 additions & 16 deletions prompt-service/src/unstract/prompt_service/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 2c30994

Please sign in to comment.