BEDROCK-RUNTIME

ApplyGuardrail

enum_GuardrailContentQualifier := [ "grounding_source", "query", "guard_content" ]
enum_GuardrailContentSource := [ "INPUT", "OUTPUT" ]
enum_GuardrailImageFormat := [ "png", "jpeg" ]

valid {
    input.Body.source == enum_GuardrailContentSource[_]
    input.Body.content[_].text.text == STRING
    input.Body.content[_].text.qualifiers[_] == enum_GuardrailContentQualifier[_]
    input.Body.content[_].image.format == enum_GuardrailImageFormat[_]
    input.Body.content[_].image.source.bytes == BLOB
    input.ReqMap.guardrailIdentifier == STRING
    input.ReqMap.guardrailVersion == STRING
    input.ProviderMetadata.Account == STRING
    input.ProviderMetadata.AccessKeyId == STRING
    input.ProviderMetadata.Region == STRING
}

Converse

enum_ConversationRole := [ "user", "assistant" ]
enum_DocumentFormat := [ "pdf", "csv", "doc", "docx", "xls", "xlsx", "html", "txt", "md" ]
enum_GuardrailConverseContentQualifier := [ "grounding_source", "query", "guard_content" ]
enum_GuardrailConverseImageFormat := [ "png", "jpeg" ]
enum_GuardrailTrace := [ "enabled", "disabled" ]
enum_ImageFormat := [ "png", "jpeg", "gif", "webp" ]
enum_PerformanceConfigLatency := [ "standard", "optimized" ]
enum_ToolResultStatus := [ "success", "error" ]
enum_VideoFormat := [ "mkv", "mov", "mp4", "webm", "flv", "mpeg", "mpg", "wmv", "three_gp" ]

valid {
    input.Body.messages[_].role == enum_ConversationRole[_]
    input.Body.messages[_].content[_].text == STRING
    input.Body.messages[_].content[_].image.format == enum_ImageFormat[_]
    input.Body.messages[_].content[_].image.source.bytes == BLOB
    input.Body.messages[_].content[_].document.format == enum_DocumentFormat[_]
    input.Body.messages[_].content[_].document.name == STRING
    input.Body.messages[_].content[_].document.source.bytes == BLOB
    input.Body.messages[_].content[_].video.format == enum_VideoFormat[_]
    input.Body.messages[_].content[_].video.source.bytes == BLOB
    input.Body.messages[_].content[_].video.source.s3Location.uri == STRING
    input.Body.messages[_].content[_].video.source.s3Location.bucketOwner == STRING
    input.Body.messages[_].content[_].toolUse.toolUseId == STRING
    input.Body.messages[_].content[_].toolUse.name == STRING
    input.Body.messages[_].content[_].toolUse.input == {}
    input.Body.messages[_].content[_].toolResult.toolUseId == STRING
    input.Body.messages[_].content[_].toolResult.content[_].json == {}
    input.Body.messages[_].content[_].toolResult.content[_].text == STRING
    input.Body.messages[_].content[_].toolResult.content[_].image.format == enum_ImageFormat[_]
    input.Body.messages[_].content[_].toolResult.content[_].image.source.bytes == BLOB
    input.Body.messages[_].content[_].toolResult.content[_].document.format == enum_DocumentFormat[_]
    input.Body.messages[_].content[_].toolResult.content[_].document.name == STRING
    input.Body.messages[_].content[_].toolResult.content[_].document.source.bytes == BLOB
    input.Body.messages[_].content[_].toolResult.content[_].video.format == enum_VideoFormat[_]
    input.Body.messages[_].content[_].toolResult.content[_].video.source.bytes == BLOB
    input.Body.messages[_].content[_].toolResult.content[_].video.source.s3Location.uri == STRING
    input.Body.messages[_].content[_].toolResult.content[_].video.source.s3Location.bucketOwner == STRING
    input.Body.messages[_].content[_].toolResult.status == enum_ToolResultStatus[_]
    input.Body.messages[_].content[_].guardContent.text.text == STRING
    input.Body.messages[_].content[_].guardContent.text.qualifiers[_] == enum_GuardrailConverseContentQualifier[_]
    input.Body.messages[_].content[_].guardContent.image.format == enum_GuardrailConverseImageFormat[_]
    input.Body.messages[_].content[_].guardContent.image.source.bytes == BLOB
    input.Body.system[_].text == STRING
    input.Body.system[_].guardContent.text.text == STRING
    input.Body.system[_].guardContent.text.qualifiers[_] == enum_GuardrailConverseContentQualifier[_]
    input.Body.system[_].guardContent.image.format == enum_GuardrailConverseImageFormat[_]
    input.Body.system[_].guardContent.image.source.bytes == BLOB
    input.Body.inferenceConfig.maxTokens == INTEGER
    input.Body.inferenceConfig.temperature == FLOAT
    input.Body.inferenceConfig.topP == FLOAT
    input.Body.inferenceConfig.stopSequences[_] == STRING
    input.Body.toolConfig.tools[_].toolSpec.name == STRING
    input.Body.toolConfig.tools[_].toolSpec.description == STRING
    input.Body.toolConfig.tools[_].toolSpec.inputSchema.json == {}
    input.Body.toolConfig.toolChoice.auto == {}
    input.Body.toolConfig.toolChoice.any == {}
    input.Body.toolConfig.toolChoice.tool.name == STRING
    input.Body.guardrailConfig.guardrailIdentifier == STRING
    input.Body.guardrailConfig.guardrailVersion == STRING
    input.Body.guardrailConfig.trace == enum_GuardrailTrace[_]
    input.Body.additionalModelRequestFields == {}
    input.Body.promptVariables.STRING.text == STRING
    input.Body.additionalModelResponseFieldPaths[_] == STRING
    input.Body.requestMetadata.STRING == STRING
    input.Body.performanceConfig.latency == enum_PerformanceConfigLatency[_]
    input.ReqMap.modelId == STRING
    input.ProviderMetadata.Account == STRING
    input.ProviderMetadata.AccessKeyId == STRING
    input.ProviderMetadata.Region == STRING
}

ConverseStream

enum_ConversationRole := [ "user", "assistant" ]
enum_DocumentFormat := [ "pdf", "csv", "doc", "docx", "xls", "xlsx", "html", "txt", "md" ]
enum_GuardrailConverseContentQualifier := [ "grounding_source", "query", "guard_content" ]
enum_GuardrailConverseImageFormat := [ "png", "jpeg" ]
enum_GuardrailStreamProcessingMode := [ "sync", "async" ]
enum_GuardrailTrace := [ "enabled", "disabled" ]
enum_ImageFormat := [ "png", "jpeg", "gif", "webp" ]
enum_PerformanceConfigLatency := [ "standard", "optimized" ]
enum_ToolResultStatus := [ "success", "error" ]
enum_VideoFormat := [ "mkv", "mov", "mp4", "webm", "flv", "mpeg", "mpg", "wmv", "three_gp" ]

valid {
    input.Body.messages[_].role == enum_ConversationRole[_]
    input.Body.messages[_].content[_].text == STRING
    input.Body.messages[_].content[_].image.format == enum_ImageFormat[_]
    input.Body.messages[_].content[_].image.source.bytes == BLOB
    input.Body.messages[_].content[_].document.format == enum_DocumentFormat[_]
    input.Body.messages[_].content[_].document.name == STRING
    input.Body.messages[_].content[_].document.source.bytes == BLOB
    input.Body.messages[_].content[_].video.format == enum_VideoFormat[_]
    input.Body.messages[_].content[_].video.source.bytes == BLOB
    input.Body.messages[_].content[_].video.source.s3Location.uri == STRING
    input.Body.messages[_].content[_].video.source.s3Location.bucketOwner == STRING
    input.Body.messages[_].content[_].toolUse.toolUseId == STRING
    input.Body.messages[_].content[_].toolUse.name == STRING
    input.Body.messages[_].content[_].toolUse.input == {}
    input.Body.messages[_].content[_].toolResult.toolUseId == STRING
    input.Body.messages[_].content[_].toolResult.content[_].json == {}
    input.Body.messages[_].content[_].toolResult.content[_].text == STRING
    input.Body.messages[_].content[_].toolResult.content[_].image.format == enum_ImageFormat[_]
    input.Body.messages[_].content[_].toolResult.content[_].image.source.bytes == BLOB
    input.Body.messages[_].content[_].toolResult.content[_].document.format == enum_DocumentFormat[_]
    input.Body.messages[_].content[_].toolResult.content[_].document.name == STRING
    input.Body.messages[_].content[_].toolResult.content[_].document.source.bytes == BLOB
    input.Body.messages[_].content[_].toolResult.content[_].video.format == enum_VideoFormat[_]
    input.Body.messages[_].content[_].toolResult.content[_].video.source.bytes == BLOB
    input.Body.messages[_].content[_].toolResult.content[_].video.source.s3Location.uri == STRING
    input.Body.messages[_].content[_].toolResult.content[_].video.source.s3Location.bucketOwner == STRING
    input.Body.messages[_].content[_].toolResult.status == enum_ToolResultStatus[_]
    input.Body.messages[_].content[_].guardContent.text.text == STRING
    input.Body.messages[_].content[_].guardContent.text.qualifiers[_] == enum_GuardrailConverseContentQualifier[_]
    input.Body.messages[_].content[_].guardContent.image.format == enum_GuardrailConverseImageFormat[_]
    input.Body.messages[_].content[_].guardContent.image.source.bytes == BLOB
    input.Body.system[_].text == STRING
    input.Body.system[_].guardContent.text.text == STRING
    input.Body.system[_].guardContent.text.qualifiers[_] == enum_GuardrailConverseContentQualifier[_]
    input.Body.system[_].guardContent.image.format == enum_GuardrailConverseImageFormat[_]
    input.Body.system[_].guardContent.image.source.bytes == BLOB
    input.Body.inferenceConfig.maxTokens == INTEGER
    input.Body.inferenceConfig.temperature == FLOAT
    input.Body.inferenceConfig.topP == FLOAT
    input.Body.inferenceConfig.stopSequences[_] == STRING
    input.Body.toolConfig.tools[_].toolSpec.name == STRING
    input.Body.toolConfig.tools[_].toolSpec.description == STRING
    input.Body.toolConfig.tools[_].toolSpec.inputSchema.json == {}
    input.Body.toolConfig.toolChoice.auto == {}
    input.Body.toolConfig.toolChoice.any == {}
    input.Body.toolConfig.toolChoice.tool.name == STRING
    input.Body.guardrailConfig.guardrailIdentifier == STRING
    input.Body.guardrailConfig.guardrailVersion == STRING
    input.Body.guardrailConfig.trace == enum_GuardrailTrace[_]
    input.Body.guardrailConfig.streamProcessingMode == enum_GuardrailStreamProcessingMode[_]
    input.Body.additionalModelRequestFields == {}
    input.Body.promptVariables.STRING.text == STRING
    input.Body.additionalModelResponseFieldPaths[_] == STRING
    input.Body.requestMetadata.STRING == STRING
    input.Body.performanceConfig.latency == enum_PerformanceConfigLatency[_]
    input.ReqMap.modelId == STRING
    input.ProviderMetadata.Account == STRING
    input.ProviderMetadata.AccessKeyId == STRING
    input.ProviderMetadata.Region == STRING
}

GetAsyncInvoke

valid {
    input.ReqMap.invocationArn == STRING
    input.ProviderMetadata.Account == STRING
    input.ProviderMetadata.AccessKeyId == STRING
    input.ProviderMetadata.Region == STRING
}

InvokeModel

enum_PerformanceConfigLatency := [ "standard", "optimized" ]
enum_Trace := [ "ENABLED", "DISABLED" ]

valid {
    input.Body.body == BLOB
    input.ReqMap.modelId == STRING
    input.ProviderMetadata.Account == STRING
    input.ProviderMetadata.AccessKeyId == STRING
    input.ProviderMetadata.Region == STRING
}

InvokeModelWithResponseStream

enum_PerformanceConfigLatency := [ "standard", "optimized" ]
enum_Trace := [ "ENABLED", "DISABLED" ]

valid {
    input.Body.body == BLOB
    input.ReqMap.modelId == STRING
    input.ProviderMetadata.Account == STRING
    input.ProviderMetadata.AccessKeyId == STRING
    input.ProviderMetadata.Region == STRING
}

ListAsyncInvokes

enum_AsyncInvokeStatus := [ "InProgress", "Completed", "Failed" ]
enum_SortAsyncInvocationBy := [ "SubmissionTime" ]
enum_SortOrder := [ "Ascending", "Descending" ]

valid {
    input.Qs.submitTimeAfter == TIMESTAMP
    input.Qs.submitTimeBefore == TIMESTAMP
    input.Qs.statusEquals == enum_AsyncInvokeStatus[_]
    input.Qs.maxResults == INTEGER
    input.Qs.nextToken == STRING
    input.Qs.sortBy == enum_SortAsyncInvocationBy[_]
    input.Qs.sortOrder == enum_SortOrder[_]
    input.ProviderMetadata.Account == STRING
    input.ProviderMetadata.AccessKeyId == STRING
    input.ProviderMetadata.Region == STRING
}

StartAsyncInvoke

valid {
    input.Body.clientRequestToken == STRING
    input.Body.modelId == STRING
    input.Body.modelInput == {}
    input.Body.outputDataConfig.s3OutputDataConfig.s3Uri == STRING
    input.Body.outputDataConfig.s3OutputDataConfig.kmsKeyId == STRING
    input.Body.outputDataConfig.s3OutputDataConfig.bucketOwner == STRING
    input.Body.tags[_].key == STRING
    input.Body.tags[_].value == STRING
    input.ProviderMetadata.Account == STRING
    input.ProviderMetadata.AccessKeyId == STRING
    input.ProviderMetadata.Region == STRING
}