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
}

Get files in folder (Power Automate Desktop)

The File filter parameter allows you to define specific file types or patterns for the Get files in folder action in Power Automate Desktop. This can be done by using wildcard characters, such as * and ?, to target files based on their extensions or naming patterns.

Key Points:

  1. Wildcards:
    1. The * character represents any sequence of characters (including none). It is commonly used to retrieve files with a specific extension.
    2. The ? character represents exactly one character, useful for retrieving files with minor variations in the name.
  2. File extensions:
    1. Use *.png to retrieve any file that ends with the .png extension (e.g., "image.png" or "logo.png").
    2. Use *.jpg to retrieve any file that ends with the .jpg extension (e.g., "photo.jpg" or "banner.jpg").
  3. Multiple filters:
    1. You can combine filters to retrieve multiple file types by separating them with a semicolon (;).
    2. For example: *.png;*.jpg will retrieve files that have either a .png or .jpg extension.

Example Filters:

  • *.png: Retrieves all PNG image files in the folder.
  • *.jpg: Retrieves all JPG image files in the folder.
  • *.png;*.jpg: Retrieves both PNG and JPG image files in the folder.

This is especially useful in Power Automate Desktop when you want to focus on specific file types in a directory, filtering out other files that do not match the criteria.


Complete and Continue  
Discussion

0 comments