无法使用增强AI启动人工循环-start_human_oop中出现错误



我正试图通过一段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
})

最新更新