JavaScript is disabled on your browser.
Skip navigation links

AWS SDK for Java 1.x API Reference - 1.12.795

We announced the upcoming end-of-support for AWS SDK for Java (v1). We recommend that you migrate to AWS SDK for Java v2. For dates, additional details, and information on how to migrate, please refer to the linked announcement.
com.amazonaws.services.bedrockruntime.model

Class InvokeModelRequest

    • Constructor Detail

      • InvokeModelRequest

        public InvokeModelRequest()
    • Method Detail

      • setBody

        public void setBody(ByteBuffer body)

        The prompt and inference parameters in the format specified in the contentType in the header. You must provide the body in JSON format. To see the format and content of the request and response bodies for different models, refer to Inference parameters. For more information, see Run inference in the Bedrock User Guide.

        The AWS SDK for Java performs a Base64 encoding on this field before sending this request to the AWS service. Users of the SDK should not perform Base64 encoding on this field.

        Warning: ByteBuffers returned by the SDK are mutable. Changes to the content or position of the byte buffer will be seen by all objects that have a reference to this object. It is recommended to call ByteBuffer.duplicate() or ByteBuffer.asReadOnlyBuffer() before using or reading from the buffer. This behavior will be changed in a future major version of the SDK.

        Parameters:
        body - The prompt and inference parameters in the format specified in the contentType in the header. You must provide the body in JSON format. To see the format and content of the request and response bodies for different models, refer to Inference parameters. For more information, see Run inference in the Bedrock User Guide.
      • getBody

        public ByteBuffer getBody()

        The prompt and inference parameters in the format specified in the contentType in the header. You must provide the body in JSON format. To see the format and content of the request and response bodies for different models, refer to Inference parameters. For more information, see Run inference in the Bedrock User Guide.

        ByteBuffers are stateful. Calling their get methods changes their position. We recommend using ByteBuffer.asReadOnlyBuffer() to create a read-only view of the buffer with an independent position, and calling get methods on this rather than directly on the returned ByteBuffer. Doing so will ensure that anyone else using the ByteBuffer will not be affected by changes to the position.

        Returns:
        The prompt and inference parameters in the format specified in the contentType in the header. You must provide the body in JSON format. To see the format and content of the request and response bodies for different models, refer to Inference parameters. For more information, see Run inference in the Bedrock User Guide.
      • withBody

        public InvokeModelRequest withBody(ByteBuffer body)

        The prompt and inference parameters in the format specified in the contentType in the header. You must provide the body in JSON format. To see the format and content of the request and response bodies for different models, refer to Inference parameters. For more information, see Run inference in the Bedrock User Guide.

        The AWS SDK for Java performs a Base64 encoding on this field before sending this request to the AWS service. Users of the SDK should not perform Base64 encoding on this field.

        Warning: ByteBuffers returned by the SDK are mutable. Changes to the content or position of the byte buffer will be seen by all objects that have a reference to this object. It is recommended to call ByteBuffer.duplicate() or ByteBuffer.asReadOnlyBuffer() before using or reading from the buffer. This behavior will be changed in a future major version of the SDK.

        Parameters:
        body - The prompt and inference parameters in the format specified in the contentType in the header. You must provide the body in JSON format. To see the format and content of the request and response bodies for different models, refer to Inference parameters. For more information, see Run inference in the Bedrock User Guide.
        Returns:
        Returns a reference to this object so that method calls can be chained together.
      • setContentType

        public void setContentType(String contentType)

        The MIME type of the input data in the request. You must specify application/json.

        Parameters:
        contentType - The MIME type of the input data in the request. You must specify application/json.
      • getContentType

        public String getContentType()

        The MIME type of the input data in the request. You must specify application/json.

        Returns:
        The MIME type of the input data in the request. You must specify application/json.
      • withContentType

        public InvokeModelRequest withContentType(String contentType)

        The MIME type of the input data in the request. You must specify application/json.

        Parameters:
        contentType - The MIME type of the input data in the request. You must specify application/json.
        Returns:
        Returns a reference to this object so that method calls can be chained together.
      • setAccept

        public void setAccept(String accept)

        The desired MIME type of the inference body in the response. The default value is application/json.

        Parameters:
        accept - The desired MIME type of the inference body in the response. The default value is application/json.
      • getAccept

        public String getAccept()

        The desired MIME type of the inference body in the response. The default value is application/json.

        Returns:
        The desired MIME type of the inference body in the response. The default value is application/json.
      • withAccept

        public InvokeModelRequest withAccept(String accept)

        The desired MIME type of the inference body in the response. The default value is application/json.

        Parameters:
        accept - The desired MIME type of the inference body in the response. The default value is application/json.
        Returns:
        Returns a reference to this object so that method calls can be chained together.
      • setModelId

        public void setModelId(String modelId)

        The unique identifier of the model to invoke to run inference.

        The modelId to provide depends on the type of model that you use:

        Parameters:
        modelId - The unique identifier of the model to invoke to run inference.

        The modelId to provide depends on the type of model that you use:

      • getModelId

        public String getModelId()

        The unique identifier of the model to invoke to run inference.

        The modelId to provide depends on the type of model that you use:

        Returns:
        The unique identifier of the model to invoke to run inference.

        The modelId to provide depends on the type of model that you use:

      • withModelId

        public InvokeModelRequest withModelId(String modelId)

        The unique identifier of the model to invoke to run inference.

        The modelId to provide depends on the type of model that you use:

        Parameters:
        modelId - The unique identifier of the model to invoke to run inference.

        The modelId to provide depends on the type of model that you use:

        Returns:
        Returns a reference to this object so that method calls can be chained together.
      • setTrace

        public void setTrace(String trace)

        Specifies whether to enable or disable the Bedrock trace. If enabled, you can see the full Bedrock trace.

        Parameters:
        trace - Specifies whether to enable or disable the Bedrock trace. If enabled, you can see the full Bedrock trace.
        See Also:
        Trace
      • getTrace

        public String getTrace()

        Specifies whether to enable or disable the Bedrock trace. If enabled, you can see the full Bedrock trace.

        Returns:
        Specifies whether to enable or disable the Bedrock trace. If enabled, you can see the full Bedrock trace.
        See Also:
        Trace
      • withTrace

        public InvokeModelRequest withTrace(String trace)

        Specifies whether to enable or disable the Bedrock trace. If enabled, you can see the full Bedrock trace.

        Parameters:
        trace - Specifies whether to enable or disable the Bedrock trace. If enabled, you can see the full Bedrock trace.
        Returns:
        Returns a reference to this object so that method calls can be chained together.
        See Also:
        Trace
      • withTrace

        public InvokeModelRequest withTrace(Trace trace)

        Specifies whether to enable or disable the Bedrock trace. If enabled, you can see the full Bedrock trace.

        Parameters:
        trace - Specifies whether to enable or disable the Bedrock trace. If enabled, you can see the full Bedrock trace.
        Returns:
        Returns a reference to this object so that method calls can be chained together.
        See Also:
        Trace
      • setGuardrailIdentifier

        public void setGuardrailIdentifier(String guardrailIdentifier)

        The unique identifier of the guardrail that you want to use. If you don't provide a value, no guardrail is applied to the invocation.

        An error will be thrown in the following situations.

        • You don't provide a guardrail identifier but you specify the amazon-bedrock-guardrailConfig field in the request body.

        • You enable the guardrail but the contentType isn't application/json.

        • You provide a guardrail identifier, but guardrailVersion isn't specified.

        Parameters:
        guardrailIdentifier - The unique identifier of the guardrail that you want to use. If you don't provide a value, no guardrail is applied to the invocation.

        An error will be thrown in the following situations.

        • You don't provide a guardrail identifier but you specify the amazon-bedrock-guardrailConfig field in the request body.

        • You enable the guardrail but the contentType isn't application/json.

        • You provide a guardrail identifier, but guardrailVersion isn't specified.

      • getGuardrailIdentifier

        public String getGuardrailIdentifier()

        The unique identifier of the guardrail that you want to use. If you don't provide a value, no guardrail is applied to the invocation.

        An error will be thrown in the following situations.

        • You don't provide a guardrail identifier but you specify the amazon-bedrock-guardrailConfig field in the request body.

        • You enable the guardrail but the contentType isn't application/json.

        • You provide a guardrail identifier, but guardrailVersion isn't specified.

        Returns:
        The unique identifier of the guardrail that you want to use. If you don't provide a value, no guardrail is applied to the invocation.

        An error will be thrown in the following situations.

        • You don't provide a guardrail identifier but you specify the amazon-bedrock-guardrailConfig field in the request body.

        • You enable the guardrail but the contentType isn't application/json.

        • You provide a guardrail identifier, but guardrailVersion isn't specified.

      • withGuardrailIdentifier

        public InvokeModelRequest withGuardrailIdentifier(String guardrailIdentifier)

        The unique identifier of the guardrail that you want to use. If you don't provide a value, no guardrail is applied to the invocation.

        An error will be thrown in the following situations.

        • You don't provide a guardrail identifier but you specify the amazon-bedrock-guardrailConfig field in the request body.

        • You enable the guardrail but the contentType isn't application/json.

        • You provide a guardrail identifier, but guardrailVersion isn't specified.

        Parameters:
        guardrailIdentifier - The unique identifier of the guardrail that you want to use. If you don't provide a value, no guardrail is applied to the invocation.

        An error will be thrown in the following situations.

        • You don't provide a guardrail identifier but you specify the amazon-bedrock-guardrailConfig field in the request body.

        • You enable the guardrail but the contentType isn't application/json.

        • You provide a guardrail identifier, but guardrailVersion isn't specified.

        Returns:
        Returns a reference to this object so that method calls can be chained together.
      • setGuardrailVersion

        public void setGuardrailVersion(String guardrailVersion)

        The version number for the guardrail. The value can also be DRAFT.

        Parameters:
        guardrailVersion - The version number for the guardrail. The value can also be DRAFT.
      • getGuardrailVersion

        public String getGuardrailVersion()

        The version number for the guardrail. The value can also be DRAFT.

        Returns:
        The version number for the guardrail. The value can also be DRAFT.
      • withGuardrailVersion

        public InvokeModelRequest withGuardrailVersion(String guardrailVersion)

        The version number for the guardrail. The value can also be DRAFT.

        Parameters:
        guardrailVersion - The version number for the guardrail. The value can also be DRAFT.
        Returns:
        Returns a reference to this object so that method calls can be chained together.
      • toString

        public String toString()
        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.
        Overrides:
        toString in class Object
        Returns:
        A string representation of this object.
        See Also:
        Object.toString()
Skip navigation links

AltStyle によって変換されたページ (->オリジナル) /