Library to support Base64.ai service for intelligent document processing (IDP).

Added with rpaframework version 19.0.0.

Service supports identifying fields in the documents, which can be given to the service in multiple different file formats and via URL.

Robot Framework example usage

*** Settings ***
Library   RPA.DocumentAI.Base64AI
Library   RPA.Robocorp.Vault

*** Tasks ***
Identify document
    ${secrets}=   Get Secret  base64ai-auth
    Set Authorization  ${secrets}[email-address]   ${secrets}[apikey]
    ${results}=  Scan Document File
    ...   ${CURDIR}${/}invoice.pdf
    ...   model_types=finance/check/usa,finance/invoice/usa
    # Scan response contains list of detected models in the document
    FOR  ${result}  IN  @{results}
        Log To Console  Model: ${result}[model]
        Log To Console  Field keys: ${{','.join($result['fields'].keys())}}
        Log To Console  Fields: ${result}[fields]
        Log To Console  Text (OCR): ${result}[ocr]
    END

Python example usage

from RPA.DocumentAI.Base64AI import Base64AI
from RPA.Robocorp.Vault import Vault

secrets = Vault().get_secret("base64ai-auth")
baselib = Base64AI()
baselib.set_authorization(secrets["email-address"], secrets["apikey"])
result = baselib.scan_document_file(
    "invoice.pdf",
    model_types="finance/invoice,finance/check/usa",
)
for r in result:
    print(f"Model: {r['model']}")
    for key, props in r["fields"].items():
        print(f"FIELD {key}: {props['value']}")
    print(f"Text (OCR): {r['ocr']}")