Image extraction with the OpenAI API

Prompt:

This should be an image of a receipt. If possible, read the date, the name of the shop, and the total amount and return it in the following format. Do not return any other text:

Date’’’Name of shop’’’Total amount

If it is not possible or if the image contains multiple receipts return a description of why you could not read the data. Formulate this as an email. Use nice language, but make sure the recipient knows they need to re-upload a valid receipt. In this case the first line in your response must be 'INVALID'.

Custom headers for the API call:

Authorization: Bearer %ApiKey%

JSON body for the API call:

{
"model": "gpt-4-turbo",
"messages": [
{
"role": "user",
"content": [
{"type": "text", "text": "%Prompt%"},
{
"type": "image_url",
"image_url": {
"url": "data:image/jpeg;base64,%Base64Text%",
"detail": "high"
}
}
]
}
],
"max_tokens": 300
}

Complete and Continue  
Discussion

0 comments