Gemini API large PDF file upload limited tokens?

Hi there, so I have a large PDF file with over 100 pages, when I try to use the client to upload, and do Question answering over it, it seems to only reference the first N out of the 100 pages.

If I were to do question answering specifically looking at say pages 60-80, Gemini’s response would be there is only N pages available. May I know how to check the file upload context limit? What are ways to split the file upload and batch query over the split-pdfs?

client = genai.Client(api_key=api_key)

file_ref = client.files.upload(file="data/sample.pdf", config={"display_name": "PDF with 100pages"})
# prepare prompt
extract_themes_prompt = """
You are good document reader that spans all pages. Return the text for specifications of content from pages 60-80. Provide reference to the page number.
"""
# send the prompt and file to gemini
result = client.models.generate_content(
    model=model,
    contents=[file_ref, extract_themes_prompt],
)

Response does not return contents from PDF pages 60-80. When asked to do text extraction of each page, it could only return up to page 18 or so and token count was only ~222,000. What am I missing here?

Hi @AIngineer, I have tried to upload a PDF containing around 70 pages and passed the prompt to get the data in the 51 page it was able to get the data, the model I used was 2.0 flash . If possible could you please share the PDF file you are using to reproduce the issue. Thank You.