The pipeline.run() method executes a pipeline you’ve created in Reducto Studio. Pipelines bundle parse, extract, split, and edit operations into a single reusable workflow. You configure the pipeline in Studio, deploy it to get a pipeline_id, then call it from your code.
from pathlib import Pathfrom reducto import Reductoclient = Reducto()# Upload documentupload = client.upload(file=Path("invoice.pdf"))# Run a deployed pipelineresult = client.pipeline.run( input=upload.file_id, pipeline_id="your_pipeline_id" # From Studio deployment)# Access results based on pipeline typeif result.result.extract: print(result.result.extract)elif result.result.parse: for chunk in result.result.parse.result.chunks: print(chunk.content)
For Parse + Extract pipelines, extract is a single object:
Copy
Ask AI
if result.result.extract and not isinstance(result.result.extract, list): print(result.result.extract.result)
For Parse + Split + Extract pipelines, extract is a list (one per section):
Copy
Ask AI
if result.result.extract and isinstance(result.result.extract, list): for section in result.result.extract: print(f"{section.split_name}: {section.result}")