This commit is contained in:
Jake Poznanski 2025-05-16 22:40:54 +00:00
parent 08806fdec6
commit c97ce8bcd4
2 changed files with 8 additions and 9 deletions

View File

@ -4,13 +4,13 @@ def build_basic_prompt() -> str:
def build_openai_silver_data_prompt_no_document_anchoring(_base_text: str) -> str: def build_openai_silver_data_prompt_no_document_anchoring(_base_text: str) -> str:
return ( return (
f"Below is the image of one page of a PDF document. " "Below is the image of one page of a PDF document. "
f"Just return the plain text representation of this document as if you were reading it naturally.\n" "Just return the plain text representation of this document as if you were reading it naturally.\n"
f"Turn equations into a LaTeX representation, and tables into markdown format. Remove the headers and footers, but keep references and footnotes.\n" "Turn equations into a LaTeX representation, and tables into markdown format. Remove the headers and footers, but keep references and footnotes.\n"
f"Read any natural handwriting.\n" "Read any natural handwriting.\n"
f"This is likely one page out of several in the document, so be sure to preserve any sentences that come from the previous page, or continue onto the next page, exactly as they are.\n" "This is likely one page out of several in the document, so be sure to preserve any sentences that come from the previous page, or continue onto the next page, exactly as they are.\n"
f"If there is no text at all that you think you should read, you can output null.\n" "If there is no text at all that you think you should read, you can output null.\n"
f"Do not hallucinate." "Do not hallucinate."
) )

View File

@ -7,12 +7,11 @@ from google import genai
from google.genai import types from google.genai import types
from olmocr.bench.prompts import ( from olmocr.bench.prompts import (
build_basic_prompt,
build_openai_silver_data_prompt_no_document_anchoring, build_openai_silver_data_prompt_no_document_anchoring,
) )
from olmocr.data.renderpdf import render_pdf_to_base64png from olmocr.data.renderpdf import render_pdf_to_base64png
from olmocr.prompts.anchor import get_anchor_text from olmocr.prompts.anchor import get_anchor_text
from olmocr.prompts.prompts import PageResponse, build_openai_silver_data_prompt from olmocr.prompts.prompts import build_openai_silver_data_prompt
def run_gemini( def run_gemini(