Skip to content

Type definitions#

Index > BedrockRuntime > Type definitions

Auto-generated documentation for BedrockRuntime type annotations stubs module mypy-boto3-bedrock-runtime.

BlobTypeDef#

# BlobTypeDef definition

BlobTypeDef = Union[
    str,
    bytes,
    IO[Any],
    StreamingBody,
]

MessageUnionTypeDef#

# MessageUnionTypeDef definition

MessageUnionTypeDef = Union[
    MessageTypeDef,  # (1)
    MessageOutputTypeDef,  # (2)
]
  1. See MessageTypeDef
  2. See MessageOutputTypeDef

GuardrailOutputContentTypeDef#

# GuardrailOutputContentTypeDef definition

class GuardrailOutputContentTypeDef(TypedDict):
    text: NotRequired[str],

GuardrailUsageTypeDef#

# GuardrailUsageTypeDef definition

class GuardrailUsageTypeDef(TypedDict):
    topicPolicyUnits: int,
    contentPolicyUnits: int,
    wordPolicyUnits: int,
    sensitiveInformationPolicyUnits: int,
    sensitiveInformationPolicyFreeUnits: int,
    contextualGroundingPolicyUnits: int,

ResponseMetadataTypeDef#

# ResponseMetadataTypeDef definition

class ResponseMetadataTypeDef(TypedDict):
    RequestId: str,
    HTTPStatusCode: int,
    HTTPHeaders: Dict[str, str],
    RetryAttempts: int,
    HostId: NotRequired[str],

ToolUseBlockDeltaTypeDef#

# ToolUseBlockDeltaTypeDef definition

class ToolUseBlockDeltaTypeDef(TypedDict):
    input: str,

ToolUseBlockOutputTypeDef#

# ToolUseBlockOutputTypeDef definition

class ToolUseBlockOutputTypeDef(TypedDict):
    toolUseId: str,
    name: str,
    input: Dict[str, Any],

ToolUseBlockStartTypeDef#

# ToolUseBlockStartTypeDef definition

class ToolUseBlockStartTypeDef(TypedDict):
    toolUseId: str,
    name: str,

ContentBlockStopEventTypeDef#

# ContentBlockStopEventTypeDef definition

class ContentBlockStopEventTypeDef(TypedDict):
    contentBlockIndex: int,

ToolUseBlockTypeDef#

# ToolUseBlockTypeDef definition

class ToolUseBlockTypeDef(TypedDict):
    toolUseId: str,
    name: str,
    input: Mapping[str, Any],

ConverseMetricsTypeDef#

# ConverseMetricsTypeDef definition

class ConverseMetricsTypeDef(TypedDict):
    latencyMs: int,

GuardrailConfigurationTypeDef#

# GuardrailConfigurationTypeDef definition

class GuardrailConfigurationTypeDef(TypedDict):
    guardrailIdentifier: str,
    guardrailVersion: str,
    trace: NotRequired[GuardrailTraceType],  # (1)
  1. See GuardrailTraceType

InferenceConfigurationTypeDef#

# InferenceConfigurationTypeDef definition

class InferenceConfigurationTypeDef(TypedDict):
    maxTokens: NotRequired[int],
    temperature: NotRequired[float],
    topP: NotRequired[float],
    stopSequences: NotRequired[Sequence[str]],

TokenUsageTypeDef#

# TokenUsageTypeDef definition

class TokenUsageTypeDef(TypedDict):
    inputTokens: int,
    outputTokens: int,
    totalTokens: int,

ConverseStreamMetricsTypeDef#

# ConverseStreamMetricsTypeDef definition

class ConverseStreamMetricsTypeDef(TypedDict):
    latencyMs: int,

InternalServerExceptionTypeDef#

# InternalServerExceptionTypeDef definition

class InternalServerExceptionTypeDef(TypedDict):
    message: NotRequired[str],

MessageStartEventTypeDef#

# MessageStartEventTypeDef definition

class MessageStartEventTypeDef(TypedDict):
    role: ConversationRoleType,  # (1)
  1. See ConversationRoleType

MessageStopEventTypeDef#

# MessageStopEventTypeDef definition

class MessageStopEventTypeDef(TypedDict):
    stopReason: StopReasonType,  # (1)
    additionalModelResponseFields: NotRequired[Dict[str, Any]],
  1. See StopReasonType

ModelStreamErrorExceptionTypeDef#

# ModelStreamErrorExceptionTypeDef definition

class ModelStreamErrorExceptionTypeDef(TypedDict):
    message: NotRequired[str],
    originalStatusCode: NotRequired[int],
    originalMessage: NotRequired[str],

ServiceUnavailableExceptionTypeDef#

# ServiceUnavailableExceptionTypeDef definition

class ServiceUnavailableExceptionTypeDef(TypedDict):
    message: NotRequired[str],

ThrottlingExceptionTypeDef#

# ThrottlingExceptionTypeDef definition

class ThrottlingExceptionTypeDef(TypedDict):
    message: NotRequired[str],

ValidationExceptionTypeDef#

# ValidationExceptionTypeDef definition

class ValidationExceptionTypeDef(TypedDict):
    message: NotRequired[str],

GuardrailStreamConfigurationTypeDef#

# GuardrailStreamConfigurationTypeDef definition

class GuardrailStreamConfigurationTypeDef(TypedDict):
    guardrailIdentifier: str,
    guardrailVersion: str,
    trace: NotRequired[GuardrailTraceType],  # (1)
    streamProcessingMode: NotRequired[GuardrailStreamProcessingModeType],  # (2)
  1. See GuardrailTraceType
  2. See GuardrailStreamProcessingModeType

DocumentSourceOutputTypeDef#

# DocumentSourceOutputTypeDef definition

class DocumentSourceOutputTypeDef(TypedDict):
    bytes: NotRequired[bytes],

GuardrailTextBlockTypeDef#

# GuardrailTextBlockTypeDef definition

class GuardrailTextBlockTypeDef(TypedDict):
    text: str,
    qualifiers: NotRequired[Sequence[GuardrailContentQualifierType]],  # (1)
  1. See GuardrailContentQualifierType

GuardrailContentFilterTypeDef#

# GuardrailContentFilterTypeDef definition

class GuardrailContentFilterTypeDef(TypedDict):
    type: GuardrailContentFilterTypeType,  # (1)
    confidence: GuardrailContentFilterConfidenceType,  # (2)
    action: GuardrailContentPolicyActionType,  # (3)
  1. See GuardrailContentFilterTypeType
  2. See GuardrailContentFilterConfidenceType
  3. See GuardrailContentPolicyActionType

GuardrailContextualGroundingFilterTypeDef#

# GuardrailContextualGroundingFilterTypeDef definition

class GuardrailContextualGroundingFilterTypeDef(TypedDict):
    type: GuardrailContextualGroundingFilterTypeType,  # (1)
    threshold: float,
    score: float,
    action: GuardrailContextualGroundingPolicyActionType,  # (2)
  1. See GuardrailContextualGroundingFilterTypeType
  2. See GuardrailContextualGroundingPolicyActionType

GuardrailConverseTextBlockOutputTypeDef#

# GuardrailConverseTextBlockOutputTypeDef definition

class GuardrailConverseTextBlockOutputTypeDef(TypedDict):
    text: str,
    qualifiers: NotRequired[List[GuardrailConverseContentQualifierType]],  # (1)
  1. See GuardrailConverseContentQualifierType

GuardrailConverseTextBlockTypeDef#

# GuardrailConverseTextBlockTypeDef definition

class GuardrailConverseTextBlockTypeDef(TypedDict):
    text: str,
    qualifiers: NotRequired[Sequence[GuardrailConverseContentQualifierType]],  # (1)
  1. See GuardrailConverseContentQualifierType

GuardrailCustomWordTypeDef#

# GuardrailCustomWordTypeDef definition

class GuardrailCustomWordTypeDef(TypedDict):
    match: str,
    action: GuardrailWordPolicyActionType,  # (1)
  1. See GuardrailWordPolicyActionType

GuardrailManagedWordTypeDef#

# GuardrailManagedWordTypeDef definition

class GuardrailManagedWordTypeDef(TypedDict):
    match: str,
    type: GuardrailManagedWordTypeType,  # (1)
    action: GuardrailWordPolicyActionType,  # (2)
  1. See GuardrailManagedWordTypeType
  2. See GuardrailWordPolicyActionType

GuardrailPiiEntityFilterTypeDef#

# GuardrailPiiEntityFilterTypeDef definition

class GuardrailPiiEntityFilterTypeDef(TypedDict):
    match: str,
    type: GuardrailPiiEntityTypeType,  # (1)
    action: GuardrailSensitiveInformationPolicyActionType,  # (2)
  1. See GuardrailPiiEntityTypeType
  2. See GuardrailSensitiveInformationPolicyActionType

GuardrailRegexFilterTypeDef#

# GuardrailRegexFilterTypeDef definition

class GuardrailRegexFilterTypeDef(TypedDict):
    action: GuardrailSensitiveInformationPolicyActionType,  # (1)
    name: NotRequired[str],
    match: NotRequired[str],
    regex: NotRequired[str],
  1. See GuardrailSensitiveInformationPolicyActionType

GuardrailTopicTypeDef#

# GuardrailTopicTypeDef definition

class GuardrailTopicTypeDef(TypedDict):
    name: str,
    type: GuardrailTopicTypeType,  # (1)
    action: GuardrailTopicPolicyActionType,  # (2)
  1. See GuardrailTopicTypeType
  2. See GuardrailTopicPolicyActionType

ImageSourceOutputTypeDef#

# ImageSourceOutputTypeDef definition

class ImageSourceOutputTypeDef(TypedDict):
    bytes: NotRequired[bytes],

ModelTimeoutExceptionTypeDef#

# ModelTimeoutExceptionTypeDef definition

class ModelTimeoutExceptionTypeDef(TypedDict):
    message: NotRequired[str],

PayloadPartTypeDef#

# PayloadPartTypeDef definition

class PayloadPartTypeDef(TypedDict):
    bytes: NotRequired[bytes],

SpecificToolChoiceTypeDef#

# SpecificToolChoiceTypeDef definition

class SpecificToolChoiceTypeDef(TypedDict):
    name: str,

ToolInputSchemaTypeDef#

# ToolInputSchemaTypeDef definition

class ToolInputSchemaTypeDef(TypedDict):
    json: NotRequired[Mapping[str, Any]],

InvokeModelResponseTypeDef#

# InvokeModelResponseTypeDef definition

class InvokeModelResponseTypeDef(TypedDict):
    body: StreamingBody,
    contentType: str,
    ResponseMetadata: ResponseMetadataTypeDef,  # (1)
  1. See ResponseMetadataTypeDef

DocumentSourceTypeDef#

# DocumentSourceTypeDef definition

class DocumentSourceTypeDef(TypedDict):
    bytes: NotRequired[Union[str, bytes, IO[Any], StreamingBody]],

ImageSourceTypeDef#

# ImageSourceTypeDef definition

class ImageSourceTypeDef(TypedDict):
    bytes: NotRequired[Union[str, bytes, IO[Any], StreamingBody]],

InvokeModelRequestRequestTypeDef#

# InvokeModelRequestRequestTypeDef definition

class InvokeModelRequestRequestTypeDef(TypedDict):
    body: Union[str, bytes, IO[Any], StreamingBody],
    modelId: str,
    contentType: NotRequired[str],
    accept: NotRequired[str],
    trace: NotRequired[TraceType],  # (1)
    guardrailIdentifier: NotRequired[str],
    guardrailVersion: NotRequired[str],
  1. See TraceType

InvokeModelWithResponseStreamRequestRequestTypeDef#

# InvokeModelWithResponseStreamRequestRequestTypeDef definition

class InvokeModelWithResponseStreamRequestRequestTypeDef(TypedDict):
    body: Union[str, bytes, IO[Any], StreamingBody],
    modelId: str,
    contentType: NotRequired[str],
    accept: NotRequired[str],
    trace: NotRequired[TraceType],  # (1)
    guardrailIdentifier: NotRequired[str],
    guardrailVersion: NotRequired[str],
  1. See TraceType

ContentBlockDeltaTypeDef#

# ContentBlockDeltaTypeDef definition

class ContentBlockDeltaTypeDef(TypedDict):
    text: NotRequired[str],
    toolUse: NotRequired[ToolUseBlockDeltaTypeDef],  # (1)
  1. See ToolUseBlockDeltaTypeDef

ContentBlockStartTypeDef#

# ContentBlockStartTypeDef definition

class ContentBlockStartTypeDef(TypedDict):
    toolUse: NotRequired[ToolUseBlockStartTypeDef],  # (1)
  1. See ToolUseBlockStartTypeDef

DocumentBlockOutputTypeDef#

# DocumentBlockOutputTypeDef definition

class DocumentBlockOutputTypeDef(TypedDict):
    format: DocumentFormatType,  # (1)
    name: str,
    source: DocumentSourceOutputTypeDef,  # (2)
  1. See DocumentFormatType
  2. See DocumentSourceOutputTypeDef

GuardrailContentBlockTypeDef#

# GuardrailContentBlockTypeDef definition

class GuardrailContentBlockTypeDef(TypedDict):
    text: NotRequired[GuardrailTextBlockTypeDef],  # (1)
  1. See GuardrailTextBlockTypeDef

GuardrailContentPolicyAssessmentTypeDef#

# GuardrailContentPolicyAssessmentTypeDef definition

class GuardrailContentPolicyAssessmentTypeDef(TypedDict):
    filters: List[GuardrailContentFilterTypeDef],  # (1)
  1. See GuardrailContentFilterTypeDef

GuardrailContextualGroundingPolicyAssessmentTypeDef#

# GuardrailContextualGroundingPolicyAssessmentTypeDef definition

class GuardrailContextualGroundingPolicyAssessmentTypeDef(TypedDict):
    filters: NotRequired[List[GuardrailContextualGroundingFilterTypeDef]],  # (1)
  1. See GuardrailContextualGroundingFilterTypeDef

GuardrailConverseContentBlockOutputTypeDef#

# GuardrailConverseContentBlockOutputTypeDef definition

class GuardrailConverseContentBlockOutputTypeDef(TypedDict):
    text: NotRequired[GuardrailConverseTextBlockOutputTypeDef],  # (1)
  1. See GuardrailConverseTextBlockOutputTypeDef

GuardrailConverseContentBlockTypeDef#

# GuardrailConverseContentBlockTypeDef definition

class GuardrailConverseContentBlockTypeDef(TypedDict):
    text: NotRequired[GuardrailConverseTextBlockTypeDef],  # (1)
  1. See GuardrailConverseTextBlockTypeDef

GuardrailWordPolicyAssessmentTypeDef#

# GuardrailWordPolicyAssessmentTypeDef definition

class GuardrailWordPolicyAssessmentTypeDef(TypedDict):
    customWords: List[GuardrailCustomWordTypeDef],  # (1)
    managedWordLists: List[GuardrailManagedWordTypeDef],  # (2)
  1. See GuardrailCustomWordTypeDef
  2. See GuardrailManagedWordTypeDef

GuardrailSensitiveInformationPolicyAssessmentTypeDef#

# GuardrailSensitiveInformationPolicyAssessmentTypeDef definition

class GuardrailSensitiveInformationPolicyAssessmentTypeDef(TypedDict):
    piiEntities: List[GuardrailPiiEntityFilterTypeDef],  # (1)
    regexes: List[GuardrailRegexFilterTypeDef],  # (2)
  1. See GuardrailPiiEntityFilterTypeDef
  2. See GuardrailRegexFilterTypeDef

GuardrailTopicPolicyAssessmentTypeDef#

# GuardrailTopicPolicyAssessmentTypeDef definition

class GuardrailTopicPolicyAssessmentTypeDef(TypedDict):
    topics: List[GuardrailTopicTypeDef],  # (1)
  1. See GuardrailTopicTypeDef

ImageBlockOutputTypeDef#

# ImageBlockOutputTypeDef definition

class ImageBlockOutputTypeDef(TypedDict):
    format: ImageFormatType,  # (1)
    source: ImageSourceOutputTypeDef,  # (2)
  1. See ImageFormatType
  2. See ImageSourceOutputTypeDef

ResponseStreamTypeDef#

# ResponseStreamTypeDef definition

class ResponseStreamTypeDef(TypedDict):
    chunk: NotRequired[PayloadPartTypeDef],  # (1)
    internalServerException: NotRequired[InternalServerExceptionTypeDef],  # (2)
    modelStreamErrorException: NotRequired[ModelStreamErrorExceptionTypeDef],  # (3)
    validationException: NotRequired[ValidationExceptionTypeDef],  # (4)
    throttlingException: NotRequired[ThrottlingExceptionTypeDef],  # (5)
    modelTimeoutException: NotRequired[ModelTimeoutExceptionTypeDef],  # (6)
    serviceUnavailableException: NotRequired[ServiceUnavailableExceptionTypeDef],  # (7)
  1. See PayloadPartTypeDef
  2. See InternalServerExceptionTypeDef
  3. See ModelStreamErrorExceptionTypeDef
  4. See ValidationExceptionTypeDef
  5. See ThrottlingExceptionTypeDef
  6. See ModelTimeoutExceptionTypeDef
  7. See ServiceUnavailableExceptionTypeDef

ToolChoiceTypeDef#

# ToolChoiceTypeDef definition

class ToolChoiceTypeDef(TypedDict):
    auto: NotRequired[Mapping[str, Any]],
    any: NotRequired[Mapping[str, Any]],
    tool: NotRequired[SpecificToolChoiceTypeDef],  # (1)
  1. See SpecificToolChoiceTypeDef

ToolSpecificationTypeDef#

# ToolSpecificationTypeDef definition

class ToolSpecificationTypeDef(TypedDict):
    name: str,
    inputSchema: ToolInputSchemaTypeDef,  # (1)
    description: NotRequired[str],
  1. See ToolInputSchemaTypeDef

DocumentBlockTypeDef#

# DocumentBlockTypeDef definition

class DocumentBlockTypeDef(TypedDict):
    format: DocumentFormatType,  # (1)
    name: str,
    source: DocumentSourceTypeDef,  # (2)
  1. See DocumentFormatType
  2. See DocumentSourceTypeDef

ImageBlockTypeDef#

# ImageBlockTypeDef definition

class ImageBlockTypeDef(TypedDict):
    format: ImageFormatType,  # (1)
    source: ImageSourceTypeDef,  # (2)
  1. See ImageFormatType
  2. See ImageSourceTypeDef

ContentBlockDeltaEventTypeDef#

# ContentBlockDeltaEventTypeDef definition

class ContentBlockDeltaEventTypeDef(TypedDict):
    delta: ContentBlockDeltaTypeDef,  # (1)
    contentBlockIndex: int,
  1. See ContentBlockDeltaTypeDef

ContentBlockStartEventTypeDef#

# ContentBlockStartEventTypeDef definition

class ContentBlockStartEventTypeDef(TypedDict):
    start: ContentBlockStartTypeDef,  # (1)
    contentBlockIndex: int,
  1. See ContentBlockStartTypeDef

ApplyGuardrailRequestRequestTypeDef#

# ApplyGuardrailRequestRequestTypeDef definition

class ApplyGuardrailRequestRequestTypeDef(TypedDict):
    guardrailIdentifier: str,
    guardrailVersion: str,
    source: GuardrailContentSourceType,  # (1)
    content: Sequence[GuardrailContentBlockTypeDef],  # (2)
  1. See GuardrailContentSourceType
  2. See GuardrailContentBlockTypeDef

SystemContentBlockTypeDef#

# SystemContentBlockTypeDef definition

class SystemContentBlockTypeDef(TypedDict):
    text: NotRequired[str],
    guardContent: NotRequired[GuardrailConverseContentBlockTypeDef],  # (1)
  1. See GuardrailConverseContentBlockTypeDef

GuardrailAssessmentTypeDef#

# GuardrailAssessmentTypeDef definition

class GuardrailAssessmentTypeDef(TypedDict):
    topicPolicy: NotRequired[GuardrailTopicPolicyAssessmentTypeDef],  # (1)
    contentPolicy: NotRequired[GuardrailContentPolicyAssessmentTypeDef],  # (2)
    wordPolicy: NotRequired[GuardrailWordPolicyAssessmentTypeDef],  # (3)
    sensitiveInformationPolicy: NotRequired[GuardrailSensitiveInformationPolicyAssessmentTypeDef],  # (4)
    contextualGroundingPolicy: NotRequired[GuardrailContextualGroundingPolicyAssessmentTypeDef],  # (5)
  1. See GuardrailTopicPolicyAssessmentTypeDef
  2. See GuardrailContentPolicyAssessmentTypeDef
  3. See GuardrailWordPolicyAssessmentTypeDef
  4. See GuardrailSensitiveInformationPolicyAssessmentTypeDef
  5. See GuardrailContextualGroundingPolicyAssessmentTypeDef

ToolResultContentBlockOutputTypeDef#

# ToolResultContentBlockOutputTypeDef definition

class ToolResultContentBlockOutputTypeDef(TypedDict):
    json: NotRequired[Dict[str, Any]],
    text: NotRequired[str],
    image: NotRequired[ImageBlockOutputTypeDef],  # (1)
    document: NotRequired[DocumentBlockOutputTypeDef],  # (2)
  1. See ImageBlockOutputTypeDef
  2. See DocumentBlockOutputTypeDef

InvokeModelWithResponseStreamResponseTypeDef#

# InvokeModelWithResponseStreamResponseTypeDef definition

class InvokeModelWithResponseStreamResponseTypeDef(TypedDict):
    body: EventStream[ResponseStreamTypeDef],  # (1)
    contentType: str,
    ResponseMetadata: ResponseMetadataTypeDef,  # (2)
  1. See ResponseStreamTypeDef
  2. See ResponseMetadataTypeDef

ToolTypeDef#

# ToolTypeDef definition

class ToolTypeDef(TypedDict):
    toolSpec: NotRequired[ToolSpecificationTypeDef],  # (1)
  1. See ToolSpecificationTypeDef

ToolResultContentBlockTypeDef#

# ToolResultContentBlockTypeDef definition

class ToolResultContentBlockTypeDef(TypedDict):
    json: NotRequired[Mapping[str, Any]],
    text: NotRequired[str],
    image: NotRequired[ImageBlockTypeDef],  # (1)
    document: NotRequired[DocumentBlockTypeDef],  # (2)
  1. See ImageBlockTypeDef
  2. See DocumentBlockTypeDef

ApplyGuardrailResponseTypeDef#

# ApplyGuardrailResponseTypeDef definition

class ApplyGuardrailResponseTypeDef(TypedDict):
    usage: GuardrailUsageTypeDef,  # (1)
    action: GuardrailActionType,  # (2)
    outputs: List[GuardrailOutputContentTypeDef],  # (3)
    assessments: List[GuardrailAssessmentTypeDef],  # (4)
    ResponseMetadata: ResponseMetadataTypeDef,  # (5)
  1. See GuardrailUsageTypeDef
  2. See GuardrailActionType
  3. See GuardrailOutputContentTypeDef
  4. See GuardrailAssessmentTypeDef
  5. See ResponseMetadataTypeDef

GuardrailTraceAssessmentTypeDef#

# GuardrailTraceAssessmentTypeDef definition

class GuardrailTraceAssessmentTypeDef(TypedDict):
    modelOutput: NotRequired[List[str]],
    inputAssessment: NotRequired[Dict[str, GuardrailAssessmentTypeDef]],  # (1)
    outputAssessments: NotRequired[Dict[str, List[GuardrailAssessmentTypeDef]]],  # (2)
  1. See GuardrailAssessmentTypeDef
  2. See GuardrailAssessmentTypeDef

ToolResultBlockOutputTypeDef#

# ToolResultBlockOutputTypeDef definition

class ToolResultBlockOutputTypeDef(TypedDict):
    toolUseId: str,
    content: List[ToolResultContentBlockOutputTypeDef],  # (1)
    status: NotRequired[ToolResultStatusType],  # (2)
  1. See ToolResultContentBlockOutputTypeDef
  2. See ToolResultStatusType

ToolConfigurationTypeDef#

# ToolConfigurationTypeDef definition

class ToolConfigurationTypeDef(TypedDict):
    tools: Sequence[ToolTypeDef],  # (1)
    toolChoice: NotRequired[ToolChoiceTypeDef],  # (2)
  1. See ToolTypeDef
  2. See ToolChoiceTypeDef

ToolResultBlockTypeDef#

# ToolResultBlockTypeDef definition

class ToolResultBlockTypeDef(TypedDict):
    toolUseId: str,
    content: Sequence[ToolResultContentBlockTypeDef],  # (1)
    status: NotRequired[ToolResultStatusType],  # (2)
  1. See ToolResultContentBlockTypeDef
  2. See ToolResultStatusType

ConverseStreamTraceTypeDef#

# ConverseStreamTraceTypeDef definition

class ConverseStreamTraceTypeDef(TypedDict):
    guardrail: NotRequired[GuardrailTraceAssessmentTypeDef],  # (1)
  1. See GuardrailTraceAssessmentTypeDef

ConverseTraceTypeDef#

# ConverseTraceTypeDef definition

class ConverseTraceTypeDef(TypedDict):
    guardrail: NotRequired[GuardrailTraceAssessmentTypeDef],  # (1)
  1. See GuardrailTraceAssessmentTypeDef

ContentBlockOutputTypeDef#

# ContentBlockOutputTypeDef definition

class ContentBlockOutputTypeDef(TypedDict):
    text: NotRequired[str],
    image: NotRequired[ImageBlockOutputTypeDef],  # (1)
    document: NotRequired[DocumentBlockOutputTypeDef],  # (2)
    toolUse: NotRequired[ToolUseBlockOutputTypeDef],  # (3)
    toolResult: NotRequired[ToolResultBlockOutputTypeDef],  # (4)
    guardContent: NotRequired[GuardrailConverseContentBlockOutputTypeDef],  # (5)
  1. See ImageBlockOutputTypeDef
  2. See DocumentBlockOutputTypeDef
  3. See ToolUseBlockOutputTypeDef
  4. See ToolResultBlockOutputTypeDef
  5. See GuardrailConverseContentBlockOutputTypeDef

ContentBlockTypeDef#

# ContentBlockTypeDef definition

class ContentBlockTypeDef(TypedDict):
    text: NotRequired[str],
    image: NotRequired[ImageBlockTypeDef],  # (1)
    document: NotRequired[DocumentBlockTypeDef],  # (2)
    toolUse: NotRequired[ToolUseBlockTypeDef],  # (3)
    toolResult: NotRequired[ToolResultBlockTypeDef],  # (4)
    guardContent: NotRequired[GuardrailConverseContentBlockTypeDef],  # (5)
  1. See ImageBlockTypeDef
  2. See DocumentBlockTypeDef
  3. See ToolUseBlockTypeDef
  4. See ToolResultBlockTypeDef
  5. See GuardrailConverseContentBlockTypeDef

ConverseStreamMetadataEventTypeDef#

# ConverseStreamMetadataEventTypeDef definition

class ConverseStreamMetadataEventTypeDef(TypedDict):
    usage: TokenUsageTypeDef,  # (1)
    metrics: ConverseStreamMetricsTypeDef,  # (2)
    trace: NotRequired[ConverseStreamTraceTypeDef],  # (3)
  1. See TokenUsageTypeDef
  2. See ConverseStreamMetricsTypeDef
  3. See ConverseStreamTraceTypeDef

MessageOutputTypeDef#

# MessageOutputTypeDef definition

class MessageOutputTypeDef(TypedDict):
    role: ConversationRoleType,  # (1)
    content: List[ContentBlockOutputTypeDef],  # (2)
  1. See ConversationRoleType
  2. See ContentBlockOutputTypeDef

MessageTypeDef#

# MessageTypeDef definition

class MessageTypeDef(TypedDict):
    role: ConversationRoleType,  # (1)
    content: Sequence[ContentBlockTypeDef],  # (2)
  1. See ConversationRoleType
  2. See ContentBlockTypeDef

ConverseStreamOutputTypeDef#

# ConverseStreamOutputTypeDef definition

class ConverseStreamOutputTypeDef(TypedDict):
    messageStart: NotRequired[MessageStartEventTypeDef],  # (1)
    contentBlockStart: NotRequired[ContentBlockStartEventTypeDef],  # (2)
    contentBlockDelta: NotRequired[ContentBlockDeltaEventTypeDef],  # (3)
    contentBlockStop: NotRequired[ContentBlockStopEventTypeDef],  # (4)
    messageStop: NotRequired[MessageStopEventTypeDef],  # (5)
    metadata: NotRequired[ConverseStreamMetadataEventTypeDef],  # (6)
    internalServerException: NotRequired[InternalServerExceptionTypeDef],  # (7)
    modelStreamErrorException: NotRequired[ModelStreamErrorExceptionTypeDef],  # (8)
    validationException: NotRequired[ValidationExceptionTypeDef],  # (9)
    throttlingException: NotRequired[ThrottlingExceptionTypeDef],  # (10)
    serviceUnavailableException: NotRequired[ServiceUnavailableExceptionTypeDef],  # (11)
  1. See MessageStartEventTypeDef
  2. See ContentBlockStartEventTypeDef
  3. See ContentBlockDeltaEventTypeDef
  4. See ContentBlockStopEventTypeDef
  5. See MessageStopEventTypeDef
  6. See ConverseStreamMetadataEventTypeDef
  7. See InternalServerExceptionTypeDef
  8. See ModelStreamErrorExceptionTypeDef
  9. See ValidationExceptionTypeDef
  10. See ThrottlingExceptionTypeDef
  11. See ServiceUnavailableExceptionTypeDef

ConverseOutputTypeDef#

# ConverseOutputTypeDef definition

class ConverseOutputTypeDef(TypedDict):
    message: NotRequired[MessageOutputTypeDef],  # (1)
  1. See MessageOutputTypeDef

ConverseStreamResponseTypeDef#

# ConverseStreamResponseTypeDef definition

class ConverseStreamResponseTypeDef(TypedDict):
    stream: EventStream[ConverseStreamOutputTypeDef],  # (1)
    ResponseMetadata: ResponseMetadataTypeDef,  # (2)
  1. See ConverseStreamOutputTypeDef
  2. See ResponseMetadataTypeDef

ConverseResponseTypeDef#

# ConverseResponseTypeDef definition

class ConverseResponseTypeDef(TypedDict):
    output: ConverseOutputTypeDef,  # (1)
    stopReason: StopReasonType,  # (2)
    usage: TokenUsageTypeDef,  # (3)
    metrics: ConverseMetricsTypeDef,  # (4)
    additionalModelResponseFields: Dict[str, Any],
    trace: ConverseTraceTypeDef,  # (5)
    ResponseMetadata: ResponseMetadataTypeDef,  # (6)
  1. See ConverseOutputTypeDef
  2. See StopReasonType
  3. See TokenUsageTypeDef
  4. See ConverseMetricsTypeDef
  5. See ConverseTraceTypeDef
  6. See ResponseMetadataTypeDef

ConverseRequestRequestTypeDef#

# ConverseRequestRequestTypeDef definition

class ConverseRequestRequestTypeDef(TypedDict):
    modelId: str,
    messages: Sequence[Union[MessageTypeDef, MessageOutputTypeDef]],  # (1)
    system: NotRequired[Sequence[SystemContentBlockTypeDef]],  # (2)
    inferenceConfig: NotRequired[InferenceConfigurationTypeDef],  # (3)
    toolConfig: NotRequired[ToolConfigurationTypeDef],  # (4)
    guardrailConfig: NotRequired[GuardrailConfigurationTypeDef],  # (5)
    additionalModelRequestFields: NotRequired[Mapping[str, Any]],
    additionalModelResponseFieldPaths: NotRequired[Sequence[str]],
  1. See MessageTypeDef MessageOutputTypeDef
  2. See SystemContentBlockTypeDef
  3. See InferenceConfigurationTypeDef
  4. See ToolConfigurationTypeDef
  5. See GuardrailConfigurationTypeDef

ConverseStreamRequestRequestTypeDef#

# ConverseStreamRequestRequestTypeDef definition

class ConverseStreamRequestRequestTypeDef(TypedDict):
    modelId: str,
    messages: Sequence[Union[MessageTypeDef, MessageOutputTypeDef]],  # (1)
    system: NotRequired[Sequence[SystemContentBlockTypeDef]],  # (2)
    inferenceConfig: NotRequired[InferenceConfigurationTypeDef],  # (3)
    toolConfig: NotRequired[ToolConfigurationTypeDef],  # (4)
    guardrailConfig: NotRequired[GuardrailStreamConfigurationTypeDef],  # (5)
    additionalModelRequestFields: NotRequired[Mapping[str, Any]],
    additionalModelResponseFieldPaths: NotRequired[Sequence[str]],
  1. See MessageTypeDef MessageOutputTypeDef
  2. See SystemContentBlockTypeDef
  3. See InferenceConfigurationTypeDef
  4. See ToolConfigurationTypeDef
  5. See GuardrailStreamConfigurationTypeDef