无法使用增强型 AI 启动人工循环 - start_human_loop 中的错误

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

我试图通过一段 python 代码来触发人工工作流程。这将包括 Textract 的人工审核。

代码片段如下:

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',
            ]
        }

当我运行这个的时候,出现异常: botocore.exceptions.ParamValidationError:参数验证失败: 参数 HumanLoopInput

的类型无效

谁能帮我举个 HumanLoopInput 的例子?它的配置已经在 analyze_document() 函数 (HumanLoopConfig) 中完成。 有没有其他方法可以避免这个异常?

InputContent 应该是字符串 try:

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