paper_firehose.processors.pdf_summarizer

Full-text PDF summarization with a single OpenAI call per paper.

The paper’s text is extracted locally with pypdf and sent, together with the topic’s prompt, to the OpenAI Responses API. Structured outputs (a strict JSON schema) guarantee a {"summary": ..., "methods": ...} object, which is the shape the HTML and email renderers expect in paper_qa_summary.

Functions

build_instructions(prompt, ranking_query)

Combine the base instructions with the topic prompt ({ranking_query} substituted).

extract_pdf_text(pdf_path, *[, max_chars])

Extract text from a PDF, truncated to max_chars.

Classes

PdfSummarizer([model, reasoning_effort, client])

Summarize paper full text with one OpenAI Responses API call.

class paper_firehose.processors.pdf_summarizer.PdfSummarizer(model=None, *, reasoning_effort=None, client=None)[source]

Bases: object

Summarize paper full text with one OpenAI Responses API call.

Parameters:
  • model (Optional[str])

  • reasoning_effort (Optional[str])

  • client (Any)

summarize_pdf(pdf_path, instructions)[source]

Extract the PDF’s text and summarize it.

Return type:

Optional[Dict[str, str]]

Parameters:
  • pdf_path (str)

  • instructions (str)

summarize_text(text, instructions)[source]

Return {"summary", "methods"} for the given paper text, or None on failure.

Return type:

Optional[Dict[str, str]]

Parameters:
  • text (str)

  • instructions (str)

paper_firehose.processors.pdf_summarizer.build_instructions(prompt, ranking_query)[source]

Combine the base instructions with the topic prompt ({ranking_query} substituted).

Return type:

str

Parameters:
  • prompt (str | None)

  • ranking_query (str | None)

paper_firehose.processors.pdf_summarizer.extract_pdf_text(pdf_path, *, max_chars=600000)[source]

Extract text from a PDF, truncated to max_chars. Returns ‘’ on failure.

Return type:

str

Parameters:
  • pdf_path (str)

  • max_chars (int)