You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

AWS Nova视频理解输入验证异常排查请求

AWS Nova视频理解调用InvokeModel触发ValidationException问题排查

问题概述

已将测试视频上传至S3,尝试使用AWS Nova进行视频理解,严格遵循代码示例实现,但调用InvokeModel操作时触发ValidationException,提示输入不符合预期标准。以下是相关请求输入、代码片段及错误信息,需定位问题根源。

请求输入

{
  "schemaVersion": "messages-v1",
  "messages": [
    {
      "role": "user",
      "content": [
        {
          "video": {
            "format": "mp4",
            "source": {
              "s3Location": {
                "uri": "s3://my-bucket/sample_video_for_understanding.mp4"
              }
            }
          }
        },
        {
          "text": "Provide a description of the video"
        }
      ]
    }
  ],
  "system": [
    {
      "text": "You are an expert media analyst. When the user provides you with a video, analyze it carefully to answer the questions"
    }
  ],
  "inferenceConfig": {
    "maxTokens": 600,
    "topP": 0.9,
    "topK": 20,
    "temperature": 0.3
  }
}

代码片段

MODEL_ID = "arn:aws:bedrock:us-west-2:<myaccountid>:inference-profile/us.amazon.nova-pro-v1:0"

client = boto3.client(
    "bedrock-runtime",
    aws_access_key_id = AWS_ACCESS_KEY_ID,
    aws_secret_access_key = AWS_SECRET_ACCESS_KEY,
    aws_session_token = AWS_SESSION_TOKEN,
    region_name="us-west-2",
)

response = client.invoke_model(
    modelId=MODEL_ID, 
    body=json.dumps(native_request)       
)

错误信息

An error occurred (ValidationException) when calling the InvokeModel operation: Invalid Input: The input does not adhere to the expected standards. Please refer to the model user guide and adjust the input before trying again.
  File "C:\Users\\src\tools\nova_test\video_understanding.py", line 76, in analyze_video
    response = client.invoke_model(
  File "C:\Users\\src\tools\nova_test\video_understanding.py", line 93, in <module>
    resp = analyze_video(path)
botocore.errorfactory.ValidationException: An error occurred (ValidationException) when calling the InvokeModel operation: Invalid Input: The input does not adhere to the expected standards. Please refer to the model user guide and adjust the input before trying again.

排查方向及解决方案

1. 请求结构不符合模型要求

AWS Nova的视频理解接口中,system字段格式可能存在错误。当前使用数组嵌套结构,部分模型要求system为单个字符串或单对象:

  • 尝试修改为字符串格式:
    "system": "You are an expert media analyst. When the user provides you with a video, analyze it carefully to answer the questions"
    
  • 或调整为单对象结构:
    "system": {
      "text": "You are an expert media analyst. When the user provides you with a video, analyze it carefully to answer the questions"
    }
    

2. S3视频权限不足

确保调用Bedrock的IAM角色/用户拥有目标S3视频文件的s3:GetObject权限,同时S3桶政策需允许Bedrock服务访问该资源。

3. 请求头缺失

调用InvokeModel时需指定正确的contentType和accept头,补充后重试:

response = client.invoke_model(
    modelId=MODEL_ID, 
    body=json.dumps(native_request),
    contentType="application/json",
    accept="application/json"
)

4. 模型ID或区域不匹配

确认MODEL_ID中的账户ID已正确替换,且us-west-2区域支持该Nova模型版本。部分模型仅在特定区域可用,需核对官方文档确认区域兼容性。

5. 视频文件不符合要求

检查视频是否符合Nova的限制:比如时长、文件大小、编码格式等。超出限制会触发输入验证失败,需更换符合要求的测试视频。

内容的提问来源于stack exchange,提问作者Nevo

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.13 17:10:16