What's the API call to get gpt4 to analyse an attached PDF file?

I can make an API by attaching an image by base64 encoding it with the code block below. How can I do the same but for PDFs; I want to attach a PDF and GPT to give me a summary of the PDF. Do I modify the type parameter below? I can’t find the docs for this anywhere. I heard 4 months ago GPT4 can now take PDFs.


    payload = {
    "model": "gpt-4-vision-preview",
    "messages": [
        "role": "user",
        "content": [
            "type": "text",
            "text": "Tell me the results of my blood test report."
            "type": "image_url", # CHANGE THIS?
            "image_url": {
                "url": f"data:image/jpeg;base64,{base64_image}"
    "max_tokens": 300

    response = requests.post("https://api.openai.com/v1/chat/completions", headers=headers, json=payload)

Ah, well, you’d have to use assistants. (but a better starting point would probably be the playground https://platform.openai.com/playground?mode=assistant )

the raw endpoints can’t do anything with your pdf, you’d have to OCR it yourself first.