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.
Thanks!
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)