All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.amazonaws.services.bedrockruntime.model.ToolConfiguration Maven / Gradle / Ivy

Go to download

The AWS Java SDK for Amazon Bedrock Runtime module holds the client classes that are used for communicating with Amazon Bedrock Runtime Service

There is a newer version: 1.12.780
Show newest version
/*
 * Copyright 2019-2024 Amazon.com, Inc. or its affiliates. All Rights Reserved.
 * 
 * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
 * the License. A copy of the License is located at
 * 
 * http://aws.amazon.com/apache2.0
 * 
 * or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
 * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
 * and limitations under the License.
 */
package com.amazonaws.services.bedrockruntime.model;

import java.io.Serializable;
import javax.annotation.Generated;
import com.amazonaws.protocol.StructuredPojo;
import com.amazonaws.protocol.ProtocolMarshaller;

/**
 * 

* Configuration information for the tools that you pass to a model. For more information, see Tool use (function calling) in the * Amazon Bedrock User Guide. *

* *

* This field is only supported by Anthropic Claude 3, Cohere Command R, Cohere Command R+, and Mistral Large models. *

*
* * @see AWS * API Documentation */ @Generated("com.amazonaws:aws-java-sdk-code-generator") public class ToolConfiguration implements Serializable, Cloneable, StructuredPojo { /** *

* An array of tools that you want to pass to a model. *

*/ private java.util.List tools; /** *

* If supported by model, forces the model to request a tool. *

*/ private ToolChoice toolChoice; /** *

* An array of tools that you want to pass to a model. *

* * @return An array of tools that you want to pass to a model. */ public java.util.List getTools() { return tools; } /** *

* An array of tools that you want to pass to a model. *

* * @param tools * An array of tools that you want to pass to a model. */ public void setTools(java.util.Collection tools) { if (tools == null) { this.tools = null; return; } this.tools = new java.util.ArrayList(tools); } /** *

* An array of tools that you want to pass to a model. *

*

* NOTE: This method appends the values to the existing list (if any). Use * {@link #setTools(java.util.Collection)} or {@link #withTools(java.util.Collection)} if you want to override the * existing values. *

* * @param tools * An array of tools that you want to pass to a model. * @return Returns a reference to this object so that method calls can be chained together. */ public ToolConfiguration withTools(Tool... tools) { if (this.tools == null) { setTools(new java.util.ArrayList(tools.length)); } for (Tool ele : tools) { this.tools.add(ele); } return this; } /** *

* An array of tools that you want to pass to a model. *

* * @param tools * An array of tools that you want to pass to a model. * @return Returns a reference to this object so that method calls can be chained together. */ public ToolConfiguration withTools(java.util.Collection tools) { setTools(tools); return this; } /** *

* If supported by model, forces the model to request a tool. *

* * @param toolChoice * If supported by model, forces the model to request a tool. */ public void setToolChoice(ToolChoice toolChoice) { this.toolChoice = toolChoice; } /** *

* If supported by model, forces the model to request a tool. *

* * @return If supported by model, forces the model to request a tool. */ public ToolChoice getToolChoice() { return this.toolChoice; } /** *

* If supported by model, forces the model to request a tool. *

* * @param toolChoice * If supported by model, forces the model to request a tool. * @return Returns a reference to this object so that method calls can be chained together. */ public ToolConfiguration withToolChoice(ToolChoice toolChoice) { setToolChoice(toolChoice); return this; } /** * Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be * redacted from this string using a placeholder value. * * @return A string representation of this object. * * @see java.lang.Object#toString() */ @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("{"); if (getTools() != null) sb.append("Tools: ").append(getTools()).append(","); if (getToolChoice() != null) sb.append("ToolChoice: ").append(getToolChoice()); sb.append("}"); return sb.toString(); } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof ToolConfiguration == false) return false; ToolConfiguration other = (ToolConfiguration) obj; if (other.getTools() == null ^ this.getTools() == null) return false; if (other.getTools() != null && other.getTools().equals(this.getTools()) == false) return false; if (other.getToolChoice() == null ^ this.getToolChoice() == null) return false; if (other.getToolChoice() != null && other.getToolChoice().equals(this.getToolChoice()) == false) return false; return true; } @Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getTools() == null) ? 0 : getTools().hashCode()); hashCode = prime * hashCode + ((getToolChoice() == null) ? 0 : getToolChoice().hashCode()); return hashCode; } @Override public ToolConfiguration clone() { try { return (ToolConfiguration) super.clone(); } catch (CloneNotSupportedException e) { throw new IllegalStateException("Got a CloneNotSupportedException from Object.clone() " + "even though we're Cloneable!", e); } } @com.amazonaws.annotation.SdkInternalApi @Override public void marshall(ProtocolMarshaller protocolMarshaller) { com.amazonaws.services.bedrockruntime.model.transform.ToolConfigurationMarshaller.getInstance().marshall(this, protocolMarshaller); } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy