The start of a tool use block. For more information, see Call a tool
with the Converse
API
in the Amazon Bedrock User Guide.
Source code in src/aws_sdk_bedrock_runtime/models.py
11573
11574
11575
11576
11577
11578
11579
11580
11581
11582
11583
11584
11585
11586
11587
11588
11589
11590
11591
11592
11593
11594
11595
11596
11597
11598
11599
11600
11601
11602
11603
11604
11605
11606
11607
11608
11609
11610
11611
11612
11613
11614
11615
11616
11617
11618
11619
11620
11621
11622
11623
11624
11625
11626
11627
11628
11629
11630
11631
11632 | @dataclass(kw_only=True)
class ToolUseBlockStart:
"""The start of a tool use block. For more information, see [Call a tool
with the Converse
API](https://docs.aws.amazon.com/bedrock/latest/userguide/tool-use.html)
in the Amazon Bedrock User Guide.
"""
tool_use_id: str
"""The ID for the tool request."""
name: str
"""The name of the tool that the model is requesting to use."""
type: str | None = None
"""The type for the tool request."""
def serialize(self, serializer: ShapeSerializer):
serializer.write_struct(_SCHEMA_TOOL_USE_BLOCK_START, self)
def serialize_members(self, serializer: ShapeSerializer):
serializer.write_string(
_SCHEMA_TOOL_USE_BLOCK_START.members["toolUseId"], self.tool_use_id
)
serializer.write_string(_SCHEMA_TOOL_USE_BLOCK_START.members["name"], self.name)
if self.type is not None:
serializer.write_string(
_SCHEMA_TOOL_USE_BLOCK_START.members["type"], self.type
)
@classmethod
def deserialize(cls, deserializer: ShapeDeserializer) -> Self:
return cls(**cls.deserialize_kwargs(deserializer))
@classmethod
def deserialize_kwargs(cls, deserializer: ShapeDeserializer) -> dict[str, Any]:
kwargs: dict[str, Any] = {}
def _consumer(schema: Schema, de: ShapeDeserializer) -> None:
match schema.expect_member_index():
case 0:
kwargs["tool_use_id"] = de.read_string(
_SCHEMA_TOOL_USE_BLOCK_START.members["toolUseId"]
)
case 1:
kwargs["name"] = de.read_string(
_SCHEMA_TOOL_USE_BLOCK_START.members["name"]
)
case 2:
kwargs["type"] = de.read_string(
_SCHEMA_TOOL_USE_BLOCK_START.members["type"]
)
case _:
logger.debug("Unexpected member schema: %s", schema)
deserializer.read_struct(_SCHEMA_TOOL_USE_BLOCK_START, consumer=_consumer)
return kwargs
|
The name of the tool that the model is requesting to use.
The ID for the tool request.
The type for the tool request.