Zum Inhalt

orchestrator

academic_doc_generator.colloquium.orchestrator

High-level pipeline with comprehensive type annotations for colloquium protocol generation.

run_pipeline(config)

Execute the full colloquium protocol generation pipeline.

This function orchestrates the complete workflow for creating a LaTeX template (and optionally a compiled PDF) that documents the protocol of a thesis colloquium. It processes the thesis PDF, extracts metadata, rewrites examiner comments, and generates a formal letter in LaTeX format.

Parameters:

Name Type Description Default
config ColloquiumWorkflowConfig

Configuration object for the colloquium workflow.

required

Returns:

Type Description
ColloquiumWorkflowResult

ColloquiumWorkflowResult object containing paths to generated files.

Raises:

Type Description
FileNotFoundError

If the provided pdf_path does not exist.

ValueError

If required location parameters are missing (e.g., room for campus).

CalledProcessError

If LaTeX compilation fails when compile_pdf=True.

Exception

Any errors raised by the LLM API (e.g., authentication issues).

Source code in src/academic_doc_generator/colloquium/orchestrator.py
def run_pipeline(config: ColloquiumWorkflowConfig) -> ColloquiumWorkflowResult:
    """Execute the full colloquium protocol generation pipeline.

    This function orchestrates the complete workflow for creating a LaTeX
    template (and optionally a compiled PDF) that documents the protocol
    of a thesis colloquium. It processes the thesis PDF, extracts metadata,
    rewrites examiner comments, and generates a formal letter in LaTeX format.

    Args:
        config: Configuration object for the colloquium workflow.

    Returns:
        ColloquiumWorkflowResult object containing paths to generated files.

    Raises:
        FileNotFoundError: If the provided `pdf_path` does not exist.
        ValueError: If required location parameters are missing (e.g., room for campus).
        subprocess.CalledProcessError: If LaTeX compilation fails when `compile_pdf=True`.
        Exception: Any errors raised by the LLM API (e.g., authentication issues).
    """
    # 1. Initialize
    llm_client, output_folder = _initialize_pipeline(config)

    # 2. Extract & Process
    rewritten, stats, metadata, summary, language, pages_text = _extract_and_process_thesis(
        config, llm_client
    )

    # 3. Optional: Gemini emark
    gemini_emark_text = _get_gemini_emark(config, metadata)

    # 4. Generate LaTeX Output
    tex_path, pdf_path_str = _generate_latex_outputs(
        config, rewritten, metadata, summary, language, output_folder, gemini_emark_text
    )

    # 5. Fill PDF form
    _fill_grading_form(config, metadata, output_folder)

    # 6. Generate Emails and Calendar
    registration_email_text, email_path, ics_path = _generate_emails_and_calendar(
        config, metadata, llm_client, output_folder
    )

    # 7. Create Outlook mail draft
    _create_outlook_draft(metadata, registration_email_text, ics_path, email_path)

    # 8. Generate web metadata
    web_md_path = _generate_web_metadata(config, metadata, pages_text, llm_client, output_folder)

    return ColloquiumWorkflowResult(
        tex_path=tex_path,
        pdf_path=pdf_path_str,
        email_path=email_path,
        metadata_path=web_md_path,
    )