support pdf parser block to fix script gen error (#3646)

This commit is contained in:
Shuchang Zheng
2025-10-08 10:21:45 -07:00
committed by GitHub
parent 0c3b5488cc
commit 16736686df
3 changed files with 77 additions and 0 deletions

View File

@@ -37,6 +37,7 @@ from skyvern.forge.sdk.workflow.models.block import (
ForLoopBlock,
HttpRequestBlock,
LoginBlock,
PDFParserBlock,
SendEmailBlock,
TaskBlock,
TextPromptBlock,
@@ -1822,6 +1823,29 @@ async def send_email(
)
async def parse_pdf(
file_url: str,
schema: dict[str, Any] | None = None,
label: str | None = None,
parameters: list[PARAMETER_TYPE] | None = None,
) -> None:
block_validation_output = await _validate_and_get_output_parameter(label)
file_url = _render_template_with_label(file_url, label)
pdf_parser_block = PDFParserBlock(
file_url=file_url,
json_schema=schema,
label=block_validation_output.label,
output_parameter=block_validation_output.output_parameter,
parameters=parameters or [],
)
await pdf_parser_block.execute_safe(
workflow_run_id=block_validation_output.workflow_run_id,
parent_workflow_run_block_id=block_validation_output.context.parent_workflow_run_block_id,
organization_id=block_validation_output.organization_id,
browser_session_id=block_validation_output.browser_session_id,
)
async def parse_file(
file_url: str,
file_type: FileType,