Pipeline

The SynthesisPerformancePipeline is the main orchestrator for end-to-end extraction. It chains material extraction, synthesis extraction, judge evaluation, and optional figure/performance linking.

SynthesisPerformancePipeline

SynthesisPerformancePipeline

class SynthesisPerformancePipeline(material_extractor, synthesis_extractor, judge=None, linking_judge=None, plot_extractor=None, series_linker=None, plot_filter_config=None, figure_segmenter='dino', florence_repo_id='amayuelas/plot-visualization-florence-2-lora-32')

End-to-end pipeline: Paper → Materials → Synthesis → Performance Linking.

This pipeline processes scientific papers to extract:

  1. Materials synthesized in the paper
  2. Detailed synthesis procedures for each material
  3. Performance data from plots, linked to specific materials

The pipeline is modular - each component can be customized or replaced.

Initialize the pipeline.

Parameters:

NameTypeDescriptionDefault
material_extractorExtractor for identifying materials in paperrequired
synthesis_extractorExtractor for synthesis proceduresrequired
judgeOptional judge for evaluating synthesis qualityNone
linking_judgeOptional judge for evaluating linking qualityNone
plot_extractorOptional plot extractor (e.g. ClaudeLinePlotDataExtractor).None
series_linkerSeriesMaterialLinker | NoneOptional linker for matching series to materialsNone
plot_filter_configPlotFilterConfig | NoneOptional config for filtering plotsNone
figure_segmenterstrBackend for figure segmentation, "dino" (default) or "florence".'dino'
florence_repo_idstrHuggingFace LoRA repo used when figure_segmenter="florence".'amayuelas/plot-visualization-florence-2-lora-32'

Methods

extract_materials(paper_text)
def extract_materials(paper_text)

Step 1: Extract list of materials from paper text.

Parameters:

NameTypeDescriptionDefault
paper_textstrFull paper textrequired

Returns:

TypeDescription
list[str]List of material names
extract_synthesis(paper_text, material)
def extract_synthesis(paper_text, material)

Step 2: Extract synthesis procedure for a single material.

Parameters:

NameTypeDescriptionDefault
paper_textstrFull paper textrequired
materialstrMaterial name to extract synthesis forrequired

Returns:

TypeDescription
tuple[GeneralSynthesisOntology, Any]Tuple of (synthesis ontology, evaluation result or None)
extract_figures(markdown_text)
def extract_figures(markdown_text)

Step 3: Extract and classify figures from markdown.

Parameters:

NameTypeDescriptionDefault
markdown_textstrMarkdown text with embedded base64 imagesrequired

Returns:

TypeDescription
list[FigureInfo]List of quantitative figure info objects
extract_plot_data(figures, paper_text, si_text='')
def extract_plot_data(figures, paper_text, si_text='')

Step 4: Extract data from quantitative plots.

Parameters:

NameTypeDescriptionDefault
figureslist[FigureInfo]List of FigureInfo for quantitative figuresrequired
paper_textstrFull paper text for contextrequired
si_textstrSupplementary information text''

Returns:

TypeDescription
tuple[list[ExtractedLinePlotData], list[FigureInfo]]Tuple of (list of plot data, list of corresponding figures)
def link_performance(materials, plots, figures)

Step 5: Link plot series to materials.

Parameters:

NameTypeDescriptionDefault
materialslist[str]List of material namesrequired
plotslist[ExtractedLinePlotData]List of extracted plot datarequired
figureslist[FigureInfo]List of corresponding figure inforequired

Returns:

TypeDescription
tuple[list[PlotMaterialMapping], LinkingStats]Tuple of (list of mappings, linking statistics)
process_paper(paper, skip_figures=False)
def process_paper(paper, skip_figures=False)

Process a single paper through the full pipeline.

Parameters:

NameTypeDescriptionDefault
paperPaperPaper object with text contentrequired
skip_figuresboolIf True, skip figures and performance linkingFalse

Returns:

TypeDescription
PipelineResult | NonePipelineResult or None if processing failed
process_paper_async(paper, semaphore, skip_figures=False)
def process_paper_async(paper, semaphore, skip_figures=False)

Process one paper with concurrent LLM calls (asyncio + semaphore).

Same as process_paper but runs independent LLM calls in parallel:

  • Materials: one call, then synthesis+judge per material in parallel
  • Plot extraction: one call per figure in parallel
  • Linking: one call per plot in parallel

Parameters:

NameTypeDescriptionDefault
paperPaperPaper object with text contentrequired
semaphoreSemaphoreCap on concurrent LLM callsrequired
skip_figuresboolIf True, skip figures and performance linkingFalse

Returns:

TypeDescription
PipelineResult | NonePipelineResult or None if processing failed
save_results(result, output_dir)
def save_results(result, output_dir)

Save pipeline results to disk.

Parameters:

NameTypeDescriptionDefault
resultPipelineResultPipelineResult to saverequired
output_dirstrBase output directoryrequired

Result models

PipelineResult

class PipelineResult(BaseModel)

Bases: BaseModel

Complete result from the synthesis + performance pipeline.

SynthesisWithPerformanceEntry

class SynthesisWithPerformanceEntry(BaseModel)

Bases: BaseModel

A material’s synthesis procedure with linked performance data.