Skip to content

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

[FIX] Passed missing param in replace_variables_in_prompt function (#781)

Deepak Ke56f0b834a82
diff --git a/prompt-service/src/unstract/prompt_service/main.py b/prompt-service/src/unstract/prompt_service/main.py
index 50a920ef5..e27549164 100644
--- a/prompt-service/src/unstract/prompt_service/main.py
+++ b/prompt-service/src/unstract/prompt_service/main.py
@@ -128,11 +128,12 @@ def prompt_processor() -> Any:
if VariableExtractor.is_variables_present(prompt_text=prompt_text):
prompt_text = VariableExtractor.replace_variables_in_prompt(
+ prompt=output,
+ structured_output=structured_output,
log_events_id=log_events_id,
tool_id=tool_id,
prompt_name=prompt_name,
doc_name=doc_name,
- prompt=output,
)
app.logger.info(f"[{tool_id}] Executing prompt: {prompt_name}")
diff --git a/prompt-service/src/unstract/prompt_service/variable_extractor/base.py b/prompt-service/src/unstract/prompt_service/variable_extractor/base.py
index e0a44a937..7740fecd0 100644
--- a/prompt-service/src/unstract/prompt_service/variable_extractor/base.py
+++ b/prompt-service/src/unstract/prompt_service/variable_extractor/base.py
@@ -44,7 +44,7 @@ class VariableExtractor:
prompt (str): Prompt to check
Returns:
- bool: True if variables are presentm else False
+ bool: True if variables are present else False
"""
return bool(len(VariableService.extract_variables_from_prompt(prompt_text)))
@@ -60,11 +60,13 @@ class VariableExtractor:
"""Replaces variables in prompt.
Args:
+ prompt (dict[str, Any]): Dict representing the prompt card
+ structured_output (dict[str, Any]): Structured data used for variable
+ replacement when variable map is not present in `prompt`.
log_events_id (str): UUID for the WS communication
tool_id (str): UUID for the prompt studio project
prompt_name (str): Name of the prompt being run
doc_name (str): Name of the document being run with
- prompt (dict[str, Any]): Dict representing the prompt card
Returns:
prompt_text (str): Prompt with variables replaced
"""