com.amazonaws.services.bedrockruntime.model.SystemContentBlock 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 system content block.
*
*
* @see AWS
* API Documentation
*/
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class SystemContentBlock implements Serializable, Cloneable, StructuredPojo {
/**
*
* A system prompt for the model.
*
*/
private String text;
/**
*
* A content block to assess with the guardrail. Use with the Converse or ConverseStream
* API operations.
*
*
* For more information, see Use a guardrail with the Converse API in the Amazon Bedrock User Guide.
*
*/
private GuardrailConverseContentBlock guardContent;
/**
*
* A system prompt for the model.
*
*
* @param text
* A system prompt for the model.
*/
public void setText(String text) {
this.text = text;
}
/**
*
* A system prompt for the model.
*
*
* @return A system prompt for the model.
*/
public String getText() {
return this.text;
}
/**
*
* A system prompt for the model.
*
*
* @param text
* A system prompt for the model.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public SystemContentBlock withText(String text) {
setText(text);
return this;
}
/**
*
* A content block to assess with the guardrail. Use with the Converse or ConverseStream
* API operations.
*
*
* For more information, see Use a guardrail with the Converse API in the Amazon Bedrock User Guide.
*
*
* @param guardContent
* A content block to assess with the guardrail. Use with the Converse or
*
* ConverseStream API operations.
*
* For more information, see Use a guardrail with the Converse API in the Amazon Bedrock User
* Guide.
*/
public void setGuardContent(GuardrailConverseContentBlock guardContent) {
this.guardContent = guardContent;
}
/**
*
* A content block to assess with the guardrail. Use with the Converse or ConverseStream
* API operations.
*
*
* For more information, see Use a guardrail with the Converse API in the Amazon Bedrock User Guide.
*
*
* @return A content block to assess with the guardrail. Use with the Converse or
*
* ConverseStream API operations.
*
* For more information, see Use a guardrail with the Converse API in the Amazon Bedrock User
* Guide.
*/
public GuardrailConverseContentBlock getGuardContent() {
return this.guardContent;
}
/**
*
* A content block to assess with the guardrail. Use with the Converse or ConverseStream
* API operations.
*
*
* For more information, see Use a guardrail with the Converse API in the Amazon Bedrock User Guide.
*
*
* @param guardContent
* A content block to assess with the guardrail. Use with the Converse or
*
* ConverseStream API operations.
*
* For more information, see Use a guardrail with the Converse API in the Amazon Bedrock User
* Guide.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public SystemContentBlock withGuardContent(GuardrailConverseContentBlock guardContent) {
setGuardContent(guardContent);
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 (getText() != null)
sb.append("Text: ").append(getText()).append(",");
if (getGuardContent() != null)
sb.append("GuardContent: ").append(getGuardContent());
sb.append("}");
return sb.toString();
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (obj instanceof SystemContentBlock == false)
return false;
SystemContentBlock other = (SystemContentBlock) obj;
if (other.getText() == null ^ this.getText() == null)
return false;
if (other.getText() != null && other.getText().equals(this.getText()) == false)
return false;
if (other.getGuardContent() == null ^ this.getGuardContent() == null)
return false;
if (other.getGuardContent() != null && other.getGuardContent().equals(this.getGuardContent()) == false)
return false;
return true;
}
@Override
public int hashCode() {
final int prime = 31;
int hashCode = 1;
hashCode = prime * hashCode + ((getText() == null) ? 0 : getText().hashCode());
hashCode = prime * hashCode + ((getGuardContent() == null) ? 0 : getGuardContent().hashCode());
return hashCode;
}
@Override
public SystemContentBlock clone() {
try {
return (SystemContentBlock) 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.SystemContentBlockMarshaller.getInstance().marshall(this, protocolMarshaller);
}
}