Close Menu
NCIJ Network NCIJ Network
    What's Hot

    UK must not be beholden to foreign AI, says head of Alan Turing Institute | AI (artificial intelligence)

    October 10, 2026

    Rogue Anthropic AI agent gave police fake tip in unsolved murder case

    October 10, 2026

    Nace AI Open-Sources Drex 1.5: A 9B Decision Model That Scores Options, Not Text

    October 10, 2026
    Facebook X (Twitter) Instagram
    Trending
    • UK must not be beholden to foreign AI, says head of Alan Turing Institute | AI (artificial intelligence)
    • Rogue Anthropic AI agent gave police fake tip in unsolved murder case
    • Nace AI Open-Sources Drex 1.5: A 9B Decision Model That Scores Options, Not Text
    • How to keep AI agents within their permissions
    • Treasury Secretary Threatens To Freeze $1B Of Iran’s Crypto
    • Fishmeal factories take Senegal’s fish from the dinner table
    • ‘We’re not asking for luxury’: school protesters in Paris suburb feel abandoned by French state | France
    • How This Tiny Startup Built the World’s Safest Bike Helmet
    • About
      • Our Team
      • Editorial Policy
      • Editorial Independence
      • International Support
    • Trust & Standards
      • AI Usage Policy
      • Conflict of Interest Policy
      • Corrections Policy
      • Ethics Policy
      • Fact-Checking Policy
      • Source Protection
    • Get Involved
      • Guide for Sources
      • Support Independent Journalism
    • Legal
      • Cookie Policy
      • Privacy Policy
      • Terms of Use
    Facebook X (Twitter) Instagram
    NCIJ Network NCIJ Network
    Saturday, October 10
    • Home
    • World
    • Ai
    • Business
    • Politics
    • Health
    • Crypto
    • Science
    • Technology
    • Cybersecurity
    • Defense & Security
    • Economy
    • Energy
    • Europe
    • More
      • Fact Check
      • Investigations
      • Opinion & Analysis
      • Environment
    NCIJ Network NCIJ Network
    Home»Artificial Intelligence

    Building Agentic Document Intelligence Pipelines: Creating Scientific Figures with AutoFigure

    NCIJ NETWNCIJ NETWORKBy NCIJ NETWNCIJ NETWORKAugust 21, 2026 Artificial Intelligence No Comments3 Mins Read
    Share
    Facebook Twitter LinkedIn Pinterest Email

    heading("4. Creating a custom reference figure")
    reference_dir = OUTPUT_ROOT / "01_custom_references"
    reference_dir.mkdir(parents=True, exist_ok=True)
    reference_path = reference_dir / "reference_architecture_style.png"
    W, H = 1333, 750
    img = Image.new("RGB", (W, H), "white")
    draw = ImageDraw.Draw(img)
    try:
       title_font = ImageFont.truetype("DejaVuSans-Bold.ttf", 36)
       box_font = ImageFont.truetype("DejaVuSans-Bold.ttf", 24)
       small_font = ImageFont.truetype("DejaVuSans.ttf", 18)
    except Exception:
       title_font = None
       box_font = None
       small_font = None
    draw.text(
       (W // 2, 55),
       "Reference Layout: Modular Scientific Pipeline",
       anchor="mm",
       fill="black",
       font=title_font,
    )
    boxes = [
       (90, 215, 290, 120, "Input", "documents"),
       (365, 215, 290, 120, "Planner", "route by task"),
       (640, 215, 290, 120, "Experts", "summary / table / vision"),
       (915, 215, 290, 120, "Verifier", "grounded output"),
    ]
    for i, (x, y, bw, bh, title, subtitle) in enumerate(boxes):
       draw.rounded_rectangle(
           [x, y, x + bw, y + bh],
           radius=22,
           fill=(245, 245, 245),
           outline=(20, 20, 20),
           width=3,
       )
       draw.text(
           (x + bw / 2, y + 45),
           title,
           anchor="mm",
           fill="black",
           font=box_font,
       )
       draw.text(
           (x + bw / 2, y + 82),
           subtitle,
           anchor="mm",
           fill=(70, 70, 70),
           font=small_font,
       )
       if i < len(boxes) - 1:
           ax = x + bw + 20
           ay = y + bh / 2
           bx = boxes[i + 1][0] - 20
           by = ay
           draw.line([ax, ay, bx, by], fill="black", width=5)
           draw.polygon(
               [(bx, by), (bx - 18, by - 10), (bx - 18, by + 10)],
               fill="black",
           )
    draw.rounded_rectangle(
       [180, 500, 1150, 585],
       radius=24,
       fill=(252, 252, 252),
       outline=(80, 80, 80),
       width=2,
    )
    draw.text(
       (665, 542),
       "Design cue: aligned modules, sparse labels, strong flow direction, clean academic styling",
       anchor="mm",
       fill=(40, 40, 40),
       font=small_font,
    )
    img.save(reference_path)
    print(f"Custom reference saved: {reference_path}")
    display_file_if_possible(reference_path, "Custom reference figure")
    heading("5. Configuring API-backed AutoFigure")
    API_KEY = collect_api_key(PROVIDER)
    if not API_KEY:
       print("No API key provided. Cloud generation sections will be skipped.")
    else:
       print(f"Provider: {PROVIDER}")
       print(f"Generation model: {GENERATION_MODEL}")
       print("API key received. The key is not printed.")
    config = None
    agent = None
    if API_KEY:
       config = Config(
           generation_api_key=API_KEY,
           generation_provider=PROVIDER,
           generation_model=GENERATION_MODEL,
           methodology_api_key=API_KEY,
           methodology_provider=PROVIDER,
           methodology_model=GENERATION_MODEL,
           enhancement_api_key=API_KEY if RUN_IMAGE_ENHANCEMENT else None,
           enhancement_provider=PROVIDER,
           enhancement_model=os.environ.get(
               "AUTOFIGURE_ENHANCEMENT_MODEL",
               "google/gemini-3.1-flash-image-preview"
               if PROVIDER == "openrouter"
               else "gemini-3.1-flash-image-preview",
           ),
           max_iterations=MAX_ITERATIONS,
           quality_threshold=QUALITY_THRESHOLD,
           output_dir=str(OUTPUT_ROOT / "02_text_to_figure"),
           custom_references=[str(reference_path)],
           art_style=ART_STYLE,
       )
       validation_errors = config.validate()
       print(f"Config validation errors: {validation_errors if validation_errors else 'none'}")
       print(f"References found by config: {len(config.get_references())}")
       agent = AutoFigureAgent(config)
    heading("6. Prompt template preview")
    prompt_preview = get_initial_prompt_template(
       topic="paper",
       content=FIGURE_DESCRIPTION[:2500],
       output_format="svg",
    )
    print(prompt_preview[:2500])
    print("n... prompt preview truncated ...")
    if API_KEY and RUN_TEXT_TO_FIGURE:
       heading("7. Running text-to-figure generation")
       text_output_dir = OUTPUT_ROOT / "02_text_to_figure"
       text_output_dir.mkdir(parents=True, exist_ok=True)
       text_result = agent.generate(
           description=FIGURE_DESCRIPTION,
           max_iterations=MAX_ITERATIONS,
           quality_threshold=QUALITY_THRESHOLD,
           output_format=TEXT_OUTPUT_FORMAT,
           enable_enhancement=RUN_IMAGE_ENHANCEMENT,
           art_style=ART_STYLE,
           enhancement_input_type="code2prompt",
           enhancement_count=1,
           custom_references=[str(reference_path)],
           output_dir=str(text_output_dir),
           topic="paper",
       )
       summarize_generation_result(text_result, "Text-to-Figure Result")
    else:
       print("Skipping text-to-figure generation.")
    
    agentic AutoFigure building creating document figures Intelligence Pipelines scientific
    NCIJ NETWNCIJ NETWORK
    • Website

    Keep Reading

    UK must not be beholden to foreign AI, says head of Alan Turing Institute | AI (artificial intelligence)

    Nace AI Open-Sources Drex 1.5: A 9B Decision Model That Scores Options, Not Text

    Microsoft AI Releases Microsoft-Decision-1: A Qwen3.5-9B Decision-Scoring Model

    Michigan Spill Prompts Federal Probe of Energy Transfer Pipelines’ Safety

    OpenAI Decisions API Hits Public Beta With 10x Faster Typed Answers

    Alibaba Qwen Releases Qwen-Image-2.1-Turbo, an 8-Step 7B Image Model

    Add A Comment
    Leave A Reply Cancel Reply

    Editors Picks

    UK must not be beholden to foreign AI, says head of Alan Turing Institute | AI (artificial intelligence)

    October 10, 2026

    Rogue Anthropic AI agent gave police fake tip in unsolved murder case

    October 10, 2026

    Nace AI Open-Sources Drex 1.5: A 9B Decision Model That Scores Options, Not Text

    October 10, 2026

    How to keep AI agents within their permissions

    October 10, 2026
    Latest Posts

    Reform donor Arron Banks urged to set out extent of surveillance of journalists | Arron Banks

    August 10, 2026

    The Canadian Secessionists Who Love Trump

    August 10, 2026

    How ‘Harry Potter’ Fans Protected Dobby’s Grave From the Path of a U.K.-Ireland Power Line

    August 10, 2026

    Subscribe to News

    Get the latest sports news from NewsSite about world, sports and politics.

    NCIJ Network is an independent digital news platform delivering trusted investigative journalism, European and global news, in-depth analysis, and fact-based reporting with accuracy, transparency, and integrity.

    Facebook X (Twitter) Instagram Pinterest YouTube

    UK must not be beholden to foreign AI, says head of Alan Turing Institute | AI (artificial intelligence)

    October 10, 2026

    Rogue Anthropic AI agent gave police fake tip in unsolved murder case

    October 10, 2026

    Nace AI Open-Sources Drex 1.5: A 9B Decision Model That Scores Options, Not Text

    October 10, 2026

    Subscribe to Updates

    Get the latest creative news from FooBar about art, design and business.

    Type above and press Enter to search. Press Esc to cancel.