Delta Workflow

Use the Delta Workflow API to generate structured JSON responses from an array of documents in bulk.

Use cases include:

  1. Extracting structured information from a collection of documents.
  2. Generating structured responses from a collection of documents.
  3. Industry use cases like extracting structured information from invoices, receipts, resumes and more.

To use the Delta Workflows API, you need to:

  1. Create an agent with a form. The form defines the structure of the response, including the fields and their types.
  2. Invoke the workflow with a series of documents as described below
  3. The responses are saved in agent memory and can be retrieved later

Under the hood, the Delta Workflows API uses the chat endpoint with response_format set to json and document parsing endpoint. The function is parallelised to improve performance with managed memory.


POSThttps://api.ailibrary.ai/v1/agent/{namespace}/workflow/delta

Run Workflow

Creates an agent. You can simply create an agent with the type of agent you want to create and then update the agent with more details.

Request body

  • Name
    files
    Type
    array
    Required
    required
    Description

    An array of files to be processed. Here's a sample object.

    Note: Folder and File are represented for better understanding. Do not include them in your code.

    [
    {/* Folder 1 */}
        [
            {/* File 1 */}
            {
                "description": "Description of the document",
                "url": "https://...pdf"
            },
            {/* File 2 */}
            {
                "description": "Description of the document",
                "url": "https://...txt"
            }
        ],
    {/* Folder 2 */}
        [
            {/* File 1 */}
            {
                "description": "...",
                "url": "https://...docx"
            },
            {/* File 2 */}
            {
                "description": "...",
                "url": "https://...pdf"
            }
        ]
        /// ...
    ]
    

Request

POST
/v1/agent/{namespace}/workflow/delta
    curl --location 'https://api.ailibrary.ai/v1/agent/test-namespace/workflow/delta' \
    --header 'Content-Type: application/json' \
    --header 'X-Library-Key: [[X-Library-Key-masked-secret]]' \
    --data-raw '[
        [
            {
                "description": "Description of the document",
                "url": "https://...pdf"
            },
            {
                "description": "Description of the document",
                "url": "https://...txt"
            }
        ],
        [
            {
                "description": "...",
                "url": "https://...docx"
            },
            {
                "description": "...",
                "url": "https://...pdf"
            }
        ]
        /// ...
    ]
    '

Response

{
    "sid": 329381640675566435568818280347392619425,
    "results": [
            {
                "field_1": false,
                "field_2": "john@email.com",
                "field_3": "John Doe",
                "phone": "+1 992 920 3522"
            },
            {
                "field_1": false,
                "field_2": "jane@email.com",
                "field_3": "Jane Smith",
                "phone": "+1 992 934 3547"
            },
            /// ...
        ],
    "failed": [
        {
            "description": "Description of the document",
            "url": "https://...pdf"
        },
        {
            "description": "Description of the document",
            "url": "https://...txt"
        }
    ],
    "meta": {
        "total": 2,
        "successful": 1,
        "failed": 1,
        "duration": 19.07
    }
}




GEThttps://api.ailibrary.ai/v1/agent/{namespace}/workflow/delta

Retrieve Responses

Retrieve the responses generated by the Delta Workflow API.

Path parameters

  • Name
    namespace
    Type
    string
    Required
    required
    Description

    Agent namespace. Note: Agent must have a form.

Query parameters

  • Name
    context
    Type
    boolean
    Required
    optional
    Description

    Include context in the response. This includes the parsed document.

  • Name
    meta
    Type
    boolean
    Required
    optional
    Description

    Include metadata like file name, latency, and more.

Response

[
    {
        "field_1": false,
        "field_2": "",
        "field_3": "John Doe",
        "phone": "+1 992 920 3522",
        "context": "Invoice number 2043...",
        "meta": {
            "files": ["sample.pdf", "sample.txt"],
            "generation_duration": 28.23,
            "scraping_duration": 0.64,
            "total_duration": 28.87
        },
        "gid": "...", // Unique identifier for the response
        "sid": "..." // Unique identifier for the session
    },
    {
        "field_1": false,
        "field_2": "",
        "field_3": "Jane Smith",
        "phone": "+1 992 934 3547",
        "context": "Invoice number 2044....",
        "meta": {
            "files": ["sample.pdf", "sample.txt"],
            "generation_duration": 28.23,
            "scraping_duration": 0.64,
            "total_duration": 28.87
        },
        "gid": "...", // Unique identifier for the response
        "sid": "..." // Unique identifier for the session
    },
    /// ...
]

Was this page helpful?