skip to Main Content

I am running this code:

 response = textract.start_document_analysis( DocumentLocation={  
 'S3Object': { 'Bucket': bucketname, 'Name': filename } }, FeatureTypes= ['QUERIES'], QueriesConfig={'Queries':[ {'Text':'{}'.format("Who are  
 you?")} ]}, NotificationChannel={ 'SNSTopicArn': SNS_TOPIC_ARN, 'RoleArn':   SNS_ROLE_ARN }, OutputConfig={ 'S3Bucket': OUTPUT_BUCKET_NAME } ) 

This is the error I am getting:

[ERROR] ParamValidationError: Parameter validation failed:
Unknown parameter in input: "QueriesConfig", must be one of: DocumentLocation, FeatureTypes, ClientRequestToken, JobTag, NotificationChannel, OutputConfig, KMSKeyId
Traceback (most recent call last):

If I run it without QueriesConfig and give ‘QUERIES’ as FeatureTypes, I am getting the error as below:

"errorMessage": "An error occurred (InvalidParameterException) when calling the StartDocumentAnalysis operation: QueriesConfig must be used with QUERIES FeatureType.",
"errorType": "InvalidParameterException"

How do I resolve this?

2

Answers


  1. Chosen as BEST ANSWER

    Install the latest version of boto3 in your lambda temp workspace.

    import sys
    from pip._internal import main
    
    main(['install', '-I', '-q', 'boto3', '--target', '/tmp/', '--no-cache-dir', '--disable-pip-version-check'])
    sys.path.insert(0,'/tmp/')
    
    import boto3
    

  2. I recommend adding a layer using the latest version of boto3.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search