From ae4fda742986ab42e27718d27125a818f01d1f05 Mon Sep 17 00:00:00 2001 From: Jake Poznanski Date: Mon, 7 Apr 2025 14:15:32 -0700 Subject: [PATCH] Bugfixes --- olmocr/bench/prompts.py | 1 + olmocr/bench/runners/run_rolmocr.py | 4 +--- olmocr/bench/runners/run_server.py | 3 +-- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/olmocr/bench/prompts.py b/olmocr/bench/prompts.py index 23f1319..7404de3 100644 --- a/olmocr/bench/prompts.py +++ b/olmocr/bench/prompts.py @@ -1,6 +1,7 @@ def build_basic_prompt() -> str: return "Just return the markdown representation of this document as if you were reading it naturally. Convert equations to markdown using \( \) for inline math, and \[ \] otherwise." + def claude_response_format_schema() -> dict: return ( { diff --git a/olmocr/bench/runners/run_rolmocr.py b/olmocr/bench/runners/run_rolmocr.py index 247e9ba..4bfb4fe 100644 --- a/olmocr/bench/runners/run_rolmocr.py +++ b/olmocr/bench/runners/run_rolmocr.py @@ -3,6 +3,7 @@ from typing import Literal import httpx +from olmocr.bench.prompts import build_basic_prompt, build_rolmocr_prompt from olmocr.data.renderpdf import render_pdf_to_base64png from olmocr.prompts.anchor import get_anchor_text from olmocr.prompts.prompts import ( @@ -11,8 +12,6 @@ from olmocr.prompts.prompts import ( build_openai_silver_data_prompt, ) -from olmocr.bench.prompts import build_basic_prompt, build_rolmocr_prompt - async def run_rolmcr( pdf_path: str, @@ -31,7 +30,6 @@ async def run_rolmcr( # Convert the first page of the PDF to a base64-encoded PNG image. image_base64 = render_pdf_to_base64png(pdf_path, page_num=page_num, target_longest_image_dim=target_longest_image_dim) - request = { "model": model, "messages": [ diff --git a/olmocr/bench/runners/run_server.py b/olmocr/bench/runners/run_server.py index 71f36ba..37514c4 100644 --- a/olmocr/bench/runners/run_server.py +++ b/olmocr/bench/runners/run_server.py @@ -3,6 +3,7 @@ from typing import Literal import httpx +from olmocr.bench.prompts import build_basic_prompt from olmocr.data.renderpdf import render_pdf_to_base64png from olmocr.prompts.anchor import get_anchor_text from olmocr.prompts.prompts import ( @@ -11,8 +12,6 @@ from olmocr.prompts.prompts import ( build_openai_silver_data_prompt, ) -from olmocr.bench.prompts import build_basic_prompt, build_rolmocr_prompt - async def run_server( pdf_path: str,