Unable to start a human loop using Augmented AI - Error in start_human_loop

312 views Asked by At

I am trying to trigger a human workflow through a piece of python code. This is to include Human Review for Textract.

The code snippet is as below:

sentiment = "Neutral"

blurb = "The sentiment of this document is neutral"

response = client.start_human_loop(
        HumanLoopName='',#Loop name and FlowDefinitionArn are used, have been omitted in the question
        FlowDefinitionArn='',
        HumanLoopInput={
            'InputContent': {
                                "initialValue": sentiment,
                                "taskObject": blurb
                            }
            },
        DataAttributes={
            'ContentClassifiers': [
            'FreeOfAdultContent',
            ]
        }

When I run this, an exception occurs : botocore.exceptions.ParamValidationError: Parameter validation failed: Invalid type for parameter HumanLoopInput

Can anyone help me with an example of HumanLoopInput? Its configuration is already done in the analyze_document() function (HumanLoopConfig). Is there any other way to avoid this exception?

1

There are 1 answers

0
voyager On BEST ANSWER

InputContent should be string try:

'InputContent': json.dumps({
                                "initialValue": sentiment,
                                "taskObject": blurb
                            })