Class: AWSCDK::Bedrock::CfnPrompt::ToolChoiceProperty

Inherits:
Jsii::Struct
  • Object
show all
Defined in:
bedrock/cfn_prompt.rb

Overview

Determines which tools the model should request in a call to Converse or ConverseStream .

For more information, see Call a tool with the Converse API in the Amazon Bedrock User Guide.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(any: nil, auto: nil, tool: nil) ⇒ ToolChoiceProperty

Returns a new instance of ToolChoiceProperty.

Parameters:



1408
1409
1410
1411
1412
1413
1414
1415
# File 'bedrock/cfn_prompt.rb', line 1408

def initialize(any: nil, auto: nil, tool: nil)
  @any = any
  Jsii::Type.check_type(@any, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJhbnkifQ==")), "any") unless @any.nil?
  @auto = auto
  Jsii::Type.check_type(@auto, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJhbnkifQ==")), "auto") unless @auto.nil?
  @tool = tool.is_a?(Hash) ? ::AWSCDK::Bedrock::CfnPrompt::SpecificToolChoiceProperty.new(**tool.transform_keys(&:to_sym)) : tool
  Jsii::Type.check_type(@tool, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3siZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifSx7ImZxbiI6ImF3cy1jZGstbGliLmF3c19iZWRyb2NrLkNmblByb21wdC5TcGVjaWZpY1Rvb2xDaG9pY2VQcm9wZXJ0eSJ9XX19")), "tool") unless @tool.nil?
end

Instance Attribute Details

#anyObject? (readonly)

The model must request at least one tool (no text is generated).



1421
1422
1423
# File 'bedrock/cfn_prompt.rb', line 1421

def any
  @any
end

#autoObject? (readonly)

(Default).

The Model automatically decides if a tool should be called or whether to generate text instead.



1428
1429
1430
# File 'bedrock/cfn_prompt.rb', line 1428

def auto
  @auto
end

#toolAWSCDK::IResolvable, ... (readonly)

The Model must request the specified tool.

Only supported by Anthropic Claude 3 and Amazon Nova models.



1435
1436
1437
# File 'bedrock/cfn_prompt.rb', line 1435

def tool
  @tool
end

Class Method Details

.jsii_propertiesObject



1437
1438
1439
1440
1441
1442
1443
# File 'bedrock/cfn_prompt.rb', line 1437

def self.jsii_properties
  {
    :any => "any",
    :auto => "auto",
    :tool => "tool",
  }
end

Instance Method Details

#to_jsiiObject



1445
1446
1447
1448
1449
1450
1451
1452
1453
# File 'bedrock/cfn_prompt.rb', line 1445

def to_jsii
  result = {}
  result.merge!({
    "any" => @any,
    "auto" => @auto,
    "tool" => @tool,
  })
  result.compact
end