The model must request a specific tool. For example,
{"tool" : {"name" : "Your tool name"}}. For more information, see
Call a tool with the Converse
API
in the Amazon Bedrock User Guide
Note
This field is only supported by Anthropic Claude 3 models.
Source code in src/aws_sdk_bedrock_runtime/models.py
8918
8919
8920
8921
8922
8923
8924
8925
8926
8927
8928
8929
8930
8931
8932
8933
8934
8935
8936
8937
8938
8939
8940
8941
8942
8943
8944
8945
8946
8947
8948
8949
8950
8951
8952
8953
8954
8955
8956
8957
8958 | @dataclass(kw_only=True)
class SpecificToolChoice:
"""The model must request a specific tool. For example,
`{"tool" : {"name" : "Your tool name"}}`. 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
Note:
This field is only supported by Anthropic Claude 3 models.
"""
name: str
"""The name of the tool that the model must request."""
def serialize(self, serializer: ShapeSerializer):
serializer.write_struct(_SCHEMA_SPECIFIC_TOOL_CHOICE, self)
def serialize_members(self, serializer: ShapeSerializer):
serializer.write_string(_SCHEMA_SPECIFIC_TOOL_CHOICE.members["name"], self.name)
@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["name"] = de.read_string(
_SCHEMA_SPECIFIC_TOOL_CHOICE.members["name"]
)
case _:
logger.debug("Unexpected member schema: %s", schema)
deserializer.read_struct(_SCHEMA_SPECIFIC_TOOL_CHOICE, consumer=_consumer)
return kwargs
|
The name of the tool that the model must request.