com.amazonaws.services.bedrockruntime.model.ToolResultBlock Maven / Gradle / Ivy
Show all versions of aws-java-sdk-bedrockruntime Show documentation
/*
* 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;
/**
*
* A tool result block that contains the results for a tool request that the model previously made.
*
*
* @see AWS
* API Documentation
*/
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class ToolResultBlock implements Serializable, Cloneable, StructuredPojo {
/**
*
* The ID of the tool request that this is the result for.
*
*/
private String toolUseId;
/**
*
* The content for tool result content block.
*
*/
private java.util.List content;
/**
*
* The status for the tool result content block.
*
*
*
* This field is only supported Anthropic Claude 3 models.
*
*
*/
private String status;
/**
*
* The ID of the tool request that this is the result for.
*
*
* @param toolUseId
* The ID of the tool request that this is the result for.
*/
public void setToolUseId(String toolUseId) {
this.toolUseId = toolUseId;
}
/**
*
* The ID of the tool request that this is the result for.
*
*
* @return The ID of the tool request that this is the result for.
*/
public String getToolUseId() {
return this.toolUseId;
}
/**
*
* The ID of the tool request that this is the result for.
*
*
* @param toolUseId
* The ID of the tool request that this is the result for.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public ToolResultBlock withToolUseId(String toolUseId) {
setToolUseId(toolUseId);
return this;
}
/**
*
* The content for tool result content block.
*
*
* @return The content for tool result content block.
*/
public java.util.List getContent() {
return content;
}
/**
*
* The content for tool result content block.
*
*
* @param content
* The content for tool result content block.
*/
public void setContent(java.util.Collection content) {
if (content == null) {
this.content = null;
return;
}
this.content = new java.util.ArrayList(content);
}
/**
*
* The content for tool result content block.
*
*
* NOTE: This method appends the values to the existing list (if any). Use
* {@link #setContent(java.util.Collection)} or {@link #withContent(java.util.Collection)} if you want to override
* the existing values.
*
*
* @param content
* The content for tool result content block.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public ToolResultBlock withContent(ToolResultContentBlock... content) {
if (this.content == null) {
setContent(new java.util.ArrayList(content.length));
}
for (ToolResultContentBlock ele : content) {
this.content.add(ele);
}
return this;
}
/**
*
* The content for tool result content block.
*
*
* @param content
* The content for tool result content block.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public ToolResultBlock withContent(java.util.Collection content) {
setContent(content);
return this;
}
/**
*
* The status for the tool result content block.
*
*
*
* This field is only supported Anthropic Claude 3 models.
*
*
*
* @param status
* The status for the tool result content block.
*
* This field is only supported Anthropic Claude 3 models.
*
* @see ToolResultStatus
*/
public void setStatus(String status) {
this.status = status;
}
/**
*
* The status for the tool result content block.
*
*
*
* This field is only supported Anthropic Claude 3 models.
*
*
*
* @return The status for the tool result content block.
*
* This field is only supported Anthropic Claude 3 models.
*
* @see ToolResultStatus
*/
public String getStatus() {
return this.status;
}
/**
*
* The status for the tool result content block.
*
*
*
* This field is only supported Anthropic Claude 3 models.
*
*
*
* @param status
* The status for the tool result content block.
*
* This field is only supported Anthropic Claude 3 models.
*
* @return Returns a reference to this object so that method calls can be chained together.
* @see ToolResultStatus
*/
public ToolResultBlock withStatus(String status) {
setStatus(status);
return this;
}
/**
*
* The status for the tool result content block.
*
*
*
* This field is only supported Anthropic Claude 3 models.
*
*
*
* @param status
* The status for the tool result content block.
*
* This field is only supported Anthropic Claude 3 models.
*
* @return Returns a reference to this object so that method calls can be chained together.
* @see ToolResultStatus
*/
public ToolResultBlock withStatus(ToolResultStatus status) {
this.status = status.toString();
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 (getToolUseId() != null)
sb.append("ToolUseId: ").append(getToolUseId()).append(",");
if (getContent() != null)
sb.append("Content: ").append(getContent()).append(",");
if (getStatus() != null)
sb.append("Status: ").append(getStatus());
sb.append("}");
return sb.toString();
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (obj instanceof ToolResultBlock == false)
return false;
ToolResultBlock other = (ToolResultBlock) obj;
if (other.getToolUseId() == null ^ this.getToolUseId() == null)
return false;
if (other.getToolUseId() != null && other.getToolUseId().equals(this.getToolUseId()) == false)
return false;
if (other.getContent() == null ^ this.getContent() == null)
return false;
if (other.getContent() != null && other.getContent().equals(this.getContent()) == false)
return false;
if (other.getStatus() == null ^ this.getStatus() == null)
return false;
if (other.getStatus() != null && other.getStatus().equals(this.getStatus()) == false)
return false;
return true;
}
@Override
public int hashCode() {
final int prime = 31;
int hashCode = 1;
hashCode = prime * hashCode + ((getToolUseId() == null) ? 0 : getToolUseId().hashCode());
hashCode = prime * hashCode + ((getContent() == null) ? 0 : getContent().hashCode());
hashCode = prime * hashCode + ((getStatus() == null) ? 0 : getStatus().hashCode());
return hashCode;
}
@Override
public ToolResultBlock clone() {
try {
return (ToolResultBlock) 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.ToolResultBlockMarshaller.getInstance().marshall(this, protocolMarshaller);
}
}