The Model automatically decides if a tool should be called or whether to
generate text instead. For example, {"auto" : {}}. 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
8886
8887
8888
8889
8890
8891
8892
8893
8894
8895
8896
8897
8898
8899
8900
8901
8902
8903
8904
8905
8906
8907
8908
8909
8910
8911
8912
8913
8914
8915 | @dataclass(kw_only=True)
class AutoToolChoice:
"""The Model automatically decides if a tool should be called or whether to
generate text instead. For example, `{"auto" : {}}`. 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
"""
def serialize(self, serializer: ShapeSerializer):
serializer.write_struct(_SCHEMA_AUTO_TOOL_CHOICE, self)
def serialize_members(self, serializer: ShapeSerializer):
pass
@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 _:
logger.debug("Unexpected member schema: %s", schema)
deserializer.read_struct(_SCHEMA_AUTO_TOOL_CHOICE, consumer=_consumer)
return kwargs
|