bedrockruntime

package
v1.51.30 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 26, 2024 License: Apache-2.0 Imports: 17 Imported by: 6

Documentation

Overview

Package bedrockruntime provides the client and types for making API requests to Amazon Bedrock Runtime.

Describes the API operations for running inference using Amazon Bedrock models.

See https://docs.aws.amazon.com/goto/WebAPI/bedrock-runtime-2023-09-30 for more information on this service.

See bedrockruntime package documentation for more information. https://docs.aws.amazon.com/sdk-for-go/api/service/bedrockruntime/

Using the Client

To contact Amazon Bedrock Runtime with the SDK use the New function to create a new service client. With that client you can make API requests to the service. These clients are safe to use concurrently.

See the SDK's documentation for more information on how to use the SDK. https://docs.aws.amazon.com/sdk-for-go/api/

See aws.Config documentation for more information on configuring SDK clients. https://docs.aws.amazon.com/sdk-for-go/api/aws/#Config

See the Amazon Bedrock Runtime client BedrockRuntime for more information on creating client for this service. https://docs.aws.amazon.com/sdk-for-go/api/service/bedrockruntime/#New

Index

Constants

View Source
const (
	// TraceEnabled is a Trace enum value
	TraceEnabled = "ENABLED"

	// TraceDisabled is a Trace enum value
	TraceDisabled = "DISABLED"
)
View Source
const (

	// ErrCodeAccessDeniedException for service response error code
	// "AccessDeniedException".
	//
	// The request is denied because of missing access permissions.
	ErrCodeAccessDeniedException = "AccessDeniedException"

	// ErrCodeInternalServerException for service response error code
	// "InternalServerException".
	//
	// An internal server error occurred. Retry your request.
	ErrCodeInternalServerException = "InternalServerException"

	// ErrCodeModelErrorException for service response error code
	// "ModelErrorException".
	//
	// The request failed due to an error while processing the model.
	ErrCodeModelErrorException = "ModelErrorException"

	// ErrCodeModelNotReadyException for service response error code
	// "ModelNotReadyException".
	//
	// The model specified in the request is not ready to serve inference requests.
	ErrCodeModelNotReadyException = "ModelNotReadyException"

	// ErrCodeModelStreamErrorException for service response error code
	// "ModelStreamErrorException".
	//
	// An error occurred while streaming the response. Retry your request.
	ErrCodeModelStreamErrorException = "ModelStreamErrorException"

	// ErrCodeModelTimeoutException for service response error code
	// "ModelTimeoutException".
	//
	// The request took too long to process. Processing time exceeded the model
	// timeout length.
	ErrCodeModelTimeoutException = "ModelTimeoutException"

	// ErrCodeResourceNotFoundException for service response error code
	// "ResourceNotFoundException".
	//
	// The specified resource ARN was not found. Check the ARN and try your request
	// again.
	ErrCodeResourceNotFoundException = "ResourceNotFoundException"

	// ErrCodeServiceQuotaExceededException for service response error code
	// "ServiceQuotaExceededException".
	//
	// The number of requests exceeds the service quota. Resubmit your request later.
	ErrCodeServiceQuotaExceededException = "ServiceQuotaExceededException"

	// ErrCodeThrottlingException for service response error code
	// "ThrottlingException".
	//
	// The number of requests exceeds the limit. Resubmit your request later.
	ErrCodeThrottlingException = "ThrottlingException"

	// ErrCodeValidationException for service response error code
	// "ValidationException".
	//
	// Input validation failed. Check your request parameters and retry the request.
	ErrCodeValidationException = "ValidationException"
)
View Source
const (
	ServiceName = "Bedrock Runtime" // Name of service.
	EndpointsID = "bedrock-runtime" // ID to lookup a service endpoint with.
	ServiceID   = "Bedrock Runtime" // ServiceID is a unique identifier of a specific service.
)

Service information constants

Variables

This section is empty.

Functions

func Trace_Values added in v1.51.27

func Trace_Values() []string

Trace_Values returns all elements of the Trace enum

Types

type AccessDeniedException

type AccessDeniedException struct {
	RespMetadata protocol.ResponseMetadata `json:"-" xml:"-"`

	Message_ *string `locationName:"message" type:"string"`
	// contains filtered or unexported fields
}

The request is denied because of missing access permissions.

func (*AccessDeniedException) Code

func (s *AccessDeniedException) Code() string

Code returns the exception type name.

func (*AccessDeniedException) Error

func (s *AccessDeniedException) Error() string

func (AccessDeniedException) GoString

func (s AccessDeniedException) GoString() string

GoString returns the string representation.

API parameter values that are decorated as "sensitive" in the API will not be included in the string output. The member name will be present, but the value will be replaced with "sensitive".

func (*AccessDeniedException) Message

func (s *AccessDeniedException) Message() string

Message returns the exception's message.

func (*AccessDeniedException) OrigErr

func (s *AccessDeniedException) OrigErr() error

OrigErr always returns nil, satisfies awserr.Error interface.

func (*AccessDeniedException) RequestID

func (s *AccessDeniedException) RequestID() string

RequestID returns the service's response RequestID for request.

func (*AccessDeniedException) StatusCode

func (s *AccessDeniedException) StatusCode() int

Status code returns the HTTP status code for the request's response error.

func (AccessDeniedException) String

func (s AccessDeniedException) String() string

String returns the string representation.

API parameter values that are decorated as "sensitive" in the API will not be included in the string output. The member name will be present, but the value will be replaced with "sensitive".

type BedrockRuntime

type BedrockRuntime struct {
	*client.Client
}

BedrockRuntime provides the API operation methods for making requests to Amazon Bedrock Runtime. See this package's package overview docs for details on the service.

BedrockRuntime methods are safe to use concurrently. It is not safe to modify mutate any of the struct's properties though.

func New

func New(p client.ConfigProvider, cfgs ...*aws.Config) *BedrockRuntime

New creates a new instance of the BedrockRuntime client with a session. If additional configuration is needed for the client instance use the optional aws.Config parameter to add your extra config.

Example:

mySession := session.Must(session.NewSession())

// Create a BedrockRuntime client from just a session.
svc := bedrockruntime.New(mySession)

// Create a BedrockRuntime client with additional configuration
svc := bedrockruntime.New(mySession, aws.NewConfig().WithRegion("us-west-2"))

func (*BedrockRuntime) InvokeModel

func (c *BedrockRuntime) InvokeModel(input *InvokeModelInput) (*InvokeModelOutput, error)

InvokeModel API operation for Amazon Bedrock Runtime.

Invokes the specified Amazon Bedrock model to run inference using the prompt and inference parameters provided in the request body. You use model inference to generate text, images, and embeddings.

For example code, see Invoke model code examples in the Amazon Bedrock User Guide.

This operation requires permission for the bedrock:InvokeModel action.

Returns awserr.Error for service API and SDK errors. Use runtime type assertions with awserr.Error's Code and Message methods to get detailed information about the error.

See the AWS API reference guide for Amazon Bedrock Runtime's API operation InvokeModel for usage and error information.

Returned Error Types:

  • AccessDeniedException The request is denied because of missing access permissions.

  • ResourceNotFoundException The specified resource ARN was not found. Check the ARN and try your request again.

  • ThrottlingException The number of requests exceeds the limit. Resubmit your request later.

  • ModelTimeoutException The request took too long to process. Processing time exceeded the model timeout length.

  • InternalServerException An internal server error occurred. Retry your request.

  • ValidationException Input validation failed. Check your request parameters and retry the request.

  • ModelNotReadyException The model specified in the request is not ready to serve inference requests.

  • ServiceQuotaExceededException The number of requests exceeds the service quota. Resubmit your request later.

  • ModelErrorException The request failed due to an error while processing the model.

See also, https://docs.aws.amazon.com/goto/WebAPI/bedrock-runtime-2023-09-30/InvokeModel

func (*BedrockRuntime) InvokeModelRequest

func (c *BedrockRuntime) InvokeModelRequest(input *InvokeModelInput) (req *request.Request, output *InvokeModelOutput)

InvokeModelRequest generates a "aws/request.Request" representing the client's request for the InvokeModel operation. The "output" return value will be populated with the request's response once the request completes successfully.

Use "Send" method on the returned Request to send the API call to the service. the "output" return value is not valid until after Send returns without error.

See InvokeModel for more information on using the InvokeModel API call, and error handling.

This method is useful when you want to inject custom logic or configuration into the SDK's request lifecycle. Such as custom headers, or retry logic.

// Example sending a request using the InvokeModelRequest method.
req, resp := client.InvokeModelRequest(params)

err := req.Send()
if err == nil { // resp is now filled
    fmt.Println(resp)
}

See also, https://docs.aws.amazon.com/goto/WebAPI/bedrock-runtime-2023-09-30/InvokeModel

func (*BedrockRuntime) InvokeModelWithContext

func (c *BedrockRuntime) InvokeModelWithContext(ctx aws.Context, input *InvokeModelInput, opts ...request.Option) (*InvokeModelOutput, error)

InvokeModelWithContext is the same as InvokeModel with the addition of the ability to pass a context and additional request options.

See InvokeModel for details on how to use this API operation.

The context must be non-nil and will be used for request cancellation. If the context is nil a panic will occur. In the future the SDK may create sub-contexts for http.Requests. See https://golang.org/pkg/context/ for more information on using Contexts.

func (*BedrockRuntime) InvokeModelWithResponseStream

InvokeModelWithResponseStream API operation for Amazon Bedrock Runtime.

Invoke the specified Amazon Bedrock model to run inference using the prompt and inference parameters provided in the request body. The response is returned in a stream.

To see if a model supports streaming, call GetFoundationModel (https://docs.aws.amazon.com/bedrock/latest/APIReference/API_GetFoundationModel.html) and check the responseStreamingSupported field in the response.

The CLI doesn't support InvokeModelWithResponseStream.

For example code, see Invoke model with streaming code example in the Amazon Bedrock User Guide.

This operation requires permissions to perform the bedrock:InvokeModelWithResponseStream action.

Returns awserr.Error for service API and SDK errors. Use runtime type assertions with awserr.Error's Code and Message methods to get detailed information about the error.

See the AWS API reference guide for Amazon Bedrock Runtime's API operation InvokeModelWithResponseStream for usage and error information.

Returned Error Types:

  • AccessDeniedException The request is denied because of missing access permissions.

  • ResourceNotFoundException The specified resource ARN was not found. Check the ARN and try your request again.

  • ThrottlingException The number of requests exceeds the limit. Resubmit your request later.

  • ModelTimeoutException The request took too long to process. Processing time exceeded the model timeout length.

  • InternalServerException An internal server error occurred. Retry your request.

  • ModelStreamErrorException An error occurred while streaming the response. Retry your request.

  • ValidationException Input validation failed. Check your request parameters and retry the request.

  • ModelNotReadyException The model specified in the request is not ready to serve inference requests.

  • ServiceQuotaExceededException The number of requests exceeds the service quota. Resubmit your request later.

  • ModelErrorException The request failed due to an error while processing the model.

See also, https://docs.aws.amazon.com/goto/WebAPI/bedrock-runtime-2023-09-30/InvokeModelWithResponseStream

func (*BedrockRuntime) InvokeModelWithResponseStreamRequest

func (c *BedrockRuntime) InvokeModelWithResponseStreamRequest(input *InvokeModelWithResponseStreamInput) (req *request.Request, output *InvokeModelWithResponseStreamOutput)

InvokeModelWithResponseStreamRequest generates a "aws/request.Request" representing the client's request for the InvokeModelWithResponseStream operation. The "output" return value will be populated with the request's response once the request completes successfully.

Use "Send" method on the returned Request to send the API call to the service. the "output" return value is not valid until after Send returns without error.

See InvokeModelWithResponseStream for more information on using the InvokeModelWithResponseStream API call, and error handling.

This method is useful when you want to inject custom logic or configuration into the SDK's request lifecycle. Such as custom headers, or retry logic.

// Example sending a request using the InvokeModelWithResponseStreamRequest method.
req, resp := client.InvokeModelWithResponseStreamRequest(params)

err := req.Send()
if err == nil { // resp is now filled
    fmt.Println(resp)
}

See also, https://docs.aws.amazon.com/goto/WebAPI/bedrock-runtime-2023-09-30/InvokeModelWithResponseStream

func (*BedrockRuntime) InvokeModelWithResponseStreamWithContext

func (c *BedrockRuntime) InvokeModelWithResponseStreamWithContext(ctx aws.Context, input *InvokeModelWithResponseStreamInput, opts ...request.Option) (*InvokeModelWithResponseStreamOutput, error)

InvokeModelWithResponseStreamWithContext is the same as InvokeModelWithResponseStream with the addition of the ability to pass a context and additional request options.

See InvokeModelWithResponseStream for details on how to use this API operation.

The context must be non-nil and will be used for request cancellation. If the context is nil a panic will occur. In the future the SDK may create sub-contexts for http.Requests. See https://golang.org/pkg/context/ for more information on using Contexts.

type InternalServerException

type InternalServerException struct {
	RespMetadata protocol.ResponseMetadata `json:"-" xml:"-"`

	Message_ *string `locationName:"message" type:"string"`
	// contains filtered or unexported fields
}

An internal server error occurred. Retry your request.

func (*InternalServerException) Code

func (s *InternalServerException) Code() string

Code returns the exception type name.

func (*InternalServerException) Error

func (s *InternalServerException) Error() string

func (InternalServerException) GoString

func (s InternalServerException) GoString() string

GoString returns the string representation.

API parameter values that are decorated as "sensitive" in the API will not be included in the string output. The member name will be present, but the value will be replaced with "sensitive".

func (*InternalServerException) MarshalEvent

MarshalEvent marshals the type into an stream event value. This method should only used internally within the SDK's EventStream handling.

func (*InternalServerException) Message

func (s *InternalServerException) Message() string

Message returns the exception's message.

func (*InternalServerException) OrigErr

func (s *InternalServerException) OrigErr() error

OrigErr always returns nil, satisfies awserr.Error interface.

func (*InternalServerException) RequestID

func (s *InternalServerException) RequestID() string

RequestID returns the service's response RequestID for request.

func (*InternalServerException) StatusCode

func (s *InternalServerException) StatusCode() int

Status code returns the HTTP status code for the request's response error.

func (InternalServerException) String

func (s InternalServerException) String() string

String returns the string representation.

API parameter values that are decorated as "sensitive" in the API will not be included in the string output. The member name will be present, but the value will be replaced with "sensitive".

func (*InternalServerException) UnmarshalEvent

func (s *InternalServerException) UnmarshalEvent(
	payloadUnmarshaler protocol.PayloadUnmarshaler,
	msg eventstream.Message,
) error

UnmarshalEvent unmarshals the EventStream Message into the InternalServerException value. This method is only used internally within the SDK's EventStream handling.

type InvokeModelInput

type InvokeModelInput struct {

	// The desired MIME type of the inference body in the response. The default
	// value is application/json.
	Accept *string `location:"header" locationName:"Accept" type:"string"`

	// The prompt and inference parameters in the format specified in the contentType
	// in the header. To see the format and content of the request and response
	// bodies for different models, refer to Inference parameters (https://docs.aws.amazon.com/bedrock/latest/userguide/model-parameters.html).
	// For more information, see Run inference (https://docs.aws.amazon.com/bedrock/latest/userguide/api-methods-run.html)
	// in the Bedrock User Guide.
	//
	// Body is a sensitive parameter and its value will be
	// replaced with "sensitive" in string returned by InvokeModelInput's
	// String and GoString methods.
	//
	// Body is a required field
	Body []byte `locationName:"body" type:"blob" required:"true" sensitive:"true"`

	// The MIME type of the input data in the request. The default value is application/json.
	ContentType *string `location:"header" locationName:"Content-Type" type:"string"`

	// 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.
	GuardrailIdentifier *string `location:"header" locationName:"X-Amzn-Bedrock-GuardrailIdentifier" type:"string"`

	// The version number for the guardrail. The value can also be DRAFT.
	GuardrailVersion *string `location:"header" locationName:"X-Amzn-Bedrock-GuardrailVersion" type:"string"`

	// The unique identifier of the model to invoke to run inference.
	//
	// The modelId to provide depends on the type of model that you use:
	//
	//    * If you use a base model, specify the model ID or its ARN. For a list
	//    of model IDs for base models, see Amazon Bedrock base model IDs (on-demand
	//    throughput) (https://docs.aws.amazon.com/bedrock/latest/userguide/model-ids.html#model-ids-arns)
	//    in the Amazon Bedrock User Guide.
	//
	//    * If you use a provisioned model, specify the ARN of the Provisioned Throughput.
	//    For more information, see Run inference using a Provisioned Throughput
	//    (https://docs.aws.amazon.com/bedrock/latest/userguide/prov-thru-use.html)
	//    in the Amazon Bedrock User Guide.
	//
	//    * If you use a custom model, first purchase Provisioned Throughput for
	//    it. Then specify the ARN of the resulting provisioned model. For more
	//    information, see Use a custom model in Amazon Bedrock (https://docs.aws.amazon.com/bedrock/latest/userguide/model-customization-use.html)
	//    in the Amazon Bedrock User Guide.
	//
	// ModelId is a required field
	ModelId *string `location:"uri" locationName:"modelId" min:"1" type:"string" required:"true"`

	// Specifies whether to enable or disable the Bedrock trace. If enabled, you
	// can see the full Bedrock trace.
	Trace *string `location:"header" locationName:"X-Amzn-Bedrock-Trace" type:"string" enum:"Trace"`
	// contains filtered or unexported fields
}

func (InvokeModelInput) GoString

func (s InvokeModelInput) GoString() string

GoString returns the string representation.

API parameter values that are decorated as "sensitive" in the API will not be included in the string output. The member name will be present, but the value will be replaced with "sensitive".

func (*InvokeModelInput) SetAccept

func (s *InvokeModelInput) SetAccept(v string) *InvokeModelInput

SetAccept sets the Accept field's value.

func (*InvokeModelInput) SetBody

func (s *InvokeModelInput) SetBody(v []byte) *InvokeModelInput

SetBody sets the Body field's value.

func (*InvokeModelInput) SetContentType

func (s *InvokeModelInput) SetContentType(v string) *InvokeModelInput

SetContentType sets the ContentType field's value.

func (*InvokeModelInput) SetGuardrailIdentifier added in v1.51.27

func (s *InvokeModelInput) SetGuardrailIdentifier(v string) *InvokeModelInput

SetGuardrailIdentifier sets the GuardrailIdentifier field's value.

func (*InvokeModelInput) SetGuardrailVersion added in v1.51.27

func (s *InvokeModelInput) SetGuardrailVersion(v string) *InvokeModelInput

SetGuardrailVersion sets the GuardrailVersion field's value.

func (*InvokeModelInput) SetModelId

func (s *InvokeModelInput) SetModelId(v string) *InvokeModelInput

SetModelId sets the ModelId field's value.

func (*InvokeModelInput) SetTrace added in v1.51.27

func (s *InvokeModelInput) SetTrace(v string) *InvokeModelInput

SetTrace sets the Trace field's value.

func (InvokeModelInput) String

func (s InvokeModelInput) String() string

String returns the string representation.

API parameter values that are decorated as "sensitive" in the API will not be included in the string output. The member name will be present, but the value will be replaced with "sensitive".

func (*InvokeModelInput) Validate

func (s *InvokeModelInput) Validate() error

Validate inspects the fields of the type to determine if they are valid.

type InvokeModelOutput

type InvokeModelOutput struct {

	// Inference response from the model in the format specified in the contentType
	// header. To see the format and content of the request and response bodies
	// for different models, refer to Inference parameters (https://docs.aws.amazon.com/bedrock/latest/userguide/model-parameters.html).
	//
	// Body is a sensitive parameter and its value will be
	// replaced with "sensitive" in string returned by InvokeModelOutput's
	// String and GoString methods.
	//
	// Body is a required field
	Body []byte `locationName:"body" type:"blob" required:"true" sensitive:"true"`

	// The MIME type of the inference result.
	//
	// ContentType is a required field
	ContentType *string `location:"header" locationName:"Content-Type" type:"string" required:"true"`
	// contains filtered or unexported fields
}

func (InvokeModelOutput) GoString

func (s InvokeModelOutput) GoString() string

GoString returns the string representation.

API parameter values that are decorated as "sensitive" in the API will not be included in the string output. The member name will be present, but the value will be replaced with "sensitive".

func (*InvokeModelOutput) SetBody

func (s *InvokeModelOutput) SetBody(v []byte) *InvokeModelOutput

SetBody sets the Body field's value.

func (*InvokeModelOutput) SetContentType

func (s *InvokeModelOutput) SetContentType(v string) *InvokeModelOutput

SetContentType sets the ContentType field's value.

func (InvokeModelOutput) String

func (s InvokeModelOutput) String() string

String returns the string representation.

API parameter values that are decorated as "sensitive" in the API will not be included in the string output. The member name will be present, but the value will be replaced with "sensitive".

type InvokeModelWithResponseStreamEventStream

type InvokeModelWithResponseStreamEventStream struct {

	// Reader is the EventStream reader for the ResponseStream
	// events. This value is automatically set by the SDK when the API call is made
	// Use this member when unit testing your code with the SDK to mock out the
	// EventStream Reader.
	//
	// Must not be nil.
	Reader ResponseStreamReader
	// contains filtered or unexported fields
}

InvokeModelWithResponseStreamEventStream provides the event stream handling for the InvokeModelWithResponseStream.

For testing and mocking the event stream this type should be initialized via the NewInvokeModelWithResponseStreamEventStream constructor function. Using the functional options to pass in nested mock behavior.

func NewInvokeModelWithResponseStreamEventStream

func NewInvokeModelWithResponseStreamEventStream(opts ...func(*InvokeModelWithResponseStreamEventStream)) *InvokeModelWithResponseStreamEventStream

NewInvokeModelWithResponseStreamEventStream initializes an InvokeModelWithResponseStreamEventStream. This function should only be used for testing and mocking the InvokeModelWithResponseStreamEventStream stream within your application.

The Reader member must be set before reading events from the stream.

es := NewInvokeModelWithResponseStreamEventStream(func(o *InvokeModelWithResponseStreamEventStream){
    es.Reader = myMockStreamReader
})

func (*InvokeModelWithResponseStreamEventStream) Close

Close closes the stream. This will also cause the stream to be closed. Close must be called when done using the stream API. Not calling Close may result in resource leaks.

You can use the closing of the Reader's Events channel to terminate your application's read from the API's stream.

func (*InvokeModelWithResponseStreamEventStream) Err

Err returns any error that occurred while reading or writing EventStream Events from the service API's response. Returns nil if there were no errors.

func (*InvokeModelWithResponseStreamEventStream) Events

Events returns a channel to read events from.

These events are:

  • PayloadPart
  • ResponseStreamUnknownEvent

type InvokeModelWithResponseStreamInput

type InvokeModelWithResponseStreamInput struct {

	// The desired MIME type of the inference body in the response. The default
	// value is application/json.
	Accept *string `location:"header" locationName:"X-Amzn-Bedrock-Accept" type:"string"`

	// The prompt and inference parameters in the format specified in the contentType
	// in the header. To see the format and content of the request and response
	// bodies for different models, refer to Inference parameters (https://docs.aws.amazon.com/bedrock/latest/userguide/model-parameters.html).
	// For more information, see Run inference (https://docs.aws.amazon.com/bedrock/latest/userguide/api-methods-run.html)
	// in the Bedrock User Guide.
	//
	// Body is a sensitive parameter and its value will be
	// replaced with "sensitive" in string returned by InvokeModelWithResponseStreamInput's
	// String and GoString methods.
	//
	// Body is a required field
	Body []byte `locationName:"body" type:"blob" required:"true" sensitive:"true"`

	// The MIME type of the input data in the request. The default value is application/json.
	ContentType *string `location:"header" locationName:"Content-Type" type:"string"`

	// 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 is 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.
	GuardrailIdentifier *string `location:"header" locationName:"X-Amzn-Bedrock-GuardrailIdentifier" type:"string"`

	// The version number for the guardrail. The value can also be DRAFT.
	GuardrailVersion *string `location:"header" locationName:"X-Amzn-Bedrock-GuardrailVersion" type:"string"`

	// The unique identifier of the model to invoke to run inference.
	//
	// The modelId to provide depends on the type of model that you use:
	//
	//    * If you use a base model, specify the model ID or its ARN. For a list
	//    of model IDs for base models, see Amazon Bedrock base model IDs (on-demand
	//    throughput) (https://docs.aws.amazon.com/bedrock/latest/userguide/model-ids.html#model-ids-arns)
	//    in the Amazon Bedrock User Guide.
	//
	//    * If you use a provisioned model, specify the ARN of the Provisioned Throughput.
	//    For more information, see Run inference using a Provisioned Throughput
	//    (https://docs.aws.amazon.com/bedrock/latest/userguide/prov-thru-use.html)
	//    in the Amazon Bedrock User Guide.
	//
	//    * If you use a custom model, first purchase Provisioned Throughput for
	//    it. Then specify the ARN of the resulting provisioned model. For more
	//    information, see Use a custom model in Amazon Bedrock (https://docs.aws.amazon.com/bedrock/latest/userguide/model-customization-use.html)
	//    in the Amazon Bedrock User Guide.
	//
	// ModelId is a required field
	ModelId *string `location:"uri" locationName:"modelId" min:"1" type:"string" required:"true"`

	// Specifies whether to enable or disable the Bedrock trace. If enabled, you
	// can see the full Bedrock trace.
	Trace *string `location:"header" locationName:"X-Amzn-Bedrock-Trace" type:"string" enum:"Trace"`
	// contains filtered or unexported fields
}

func (InvokeModelWithResponseStreamInput) GoString

GoString returns the string representation.

API parameter values that are decorated as "sensitive" in the API will not be included in the string output. The member name will be present, but the value will be replaced with "sensitive".

func (*InvokeModelWithResponseStreamInput) SetAccept

SetAccept sets the Accept field's value.

func (*InvokeModelWithResponseStreamInput) SetBody

SetBody sets the Body field's value.

func (*InvokeModelWithResponseStreamInput) SetContentType

SetContentType sets the ContentType field's value.

func (*InvokeModelWithResponseStreamInput) SetGuardrailIdentifier added in v1.51.27

SetGuardrailIdentifier sets the GuardrailIdentifier field's value.

func (*InvokeModelWithResponseStreamInput) SetGuardrailVersion added in v1.51.27

SetGuardrailVersion sets the GuardrailVersion field's value.

func (*InvokeModelWithResponseStreamInput) SetModelId

SetModelId sets the ModelId field's value.

func (*InvokeModelWithResponseStreamInput) SetTrace added in v1.51.27

SetTrace sets the Trace field's value.

func (InvokeModelWithResponseStreamInput) String

String returns the string representation.

API parameter values that are decorated as "sensitive" in the API will not be included in the string output. The member name will be present, but the value will be replaced with "sensitive".

func (*InvokeModelWithResponseStreamInput) Validate

Validate inspects the fields of the type to determine if they are valid.

type InvokeModelWithResponseStreamOutput

type InvokeModelWithResponseStreamOutput struct {

	// The MIME type of the inference result.
	//
	// ContentType is a required field
	ContentType *string `location:"header" locationName:"X-Amzn-Bedrock-Content-Type" type:"string" required:"true"`
	// contains filtered or unexported fields
}

func (*InvokeModelWithResponseStreamOutput) GetStream

GetStream returns the type to interact with the event stream.

func (InvokeModelWithResponseStreamOutput) GoString

GoString returns the string representation.

API parameter values that are decorated as "sensitive" in the API will not be included in the string output. The member name will be present, but the value will be replaced with "sensitive".

func (*InvokeModelWithResponseStreamOutput) SetContentType

SetContentType sets the ContentType field's value.

func (InvokeModelWithResponseStreamOutput) String

String returns the string representation.

API parameter values that are decorated as "sensitive" in the API will not be included in the string output. The member name will be present, but the value will be replaced with "sensitive".

type ModelErrorException

type ModelErrorException struct {
	RespMetadata protocol.ResponseMetadata `json:"-" xml:"-"`

	Message_ *string `locationName:"message" type:"string"`

	// The original status code.
	OriginalStatusCode *int64 `locationName:"originalStatusCode" min:"100" type:"integer"`

	// The resource name.
	ResourceName *string `locationName:"resourceName" type:"string"`
	// contains filtered or unexported fields
}

The request failed due to an error while processing the model.

func (*ModelErrorException) Code

func (s *ModelErrorException) Code() string

Code returns the exception type name.

func (*ModelErrorException) Error

func (s *ModelErrorException) Error() string

func (ModelErrorException) GoString

func (s ModelErrorException) GoString() string

GoString returns the string representation.

API parameter values that are decorated as "sensitive" in the API will not be included in the string output. The member name will be present, but the value will be replaced with "sensitive".

func (*ModelErrorException) Message

func (s *ModelErrorException) Message() string

Message returns the exception's message.

func (*ModelErrorException) OrigErr

func (s *ModelErrorException) OrigErr() error

OrigErr always returns nil, satisfies awserr.Error interface.

func (*ModelErrorException) RequestID

func (s *ModelErrorException) RequestID() string

RequestID returns the service's response RequestID for request.

func (*ModelErrorException) StatusCode

func (s *ModelErrorException) StatusCode() int

Status code returns the HTTP status code for the request's response error.

func (ModelErrorException) String

func (s ModelErrorException) String() string

String returns the string representation.

API parameter values that are decorated as "sensitive" in the API will not be included in the string output. The member name will be present, but the value will be replaced with "sensitive".

type ModelNotReadyException

type ModelNotReadyException struct {
	RespMetadata protocol.ResponseMetadata `json:"-" xml:"-"`

	Message_ *string `locationName:"message" type:"string"`
	// contains filtered or unexported fields
}

The model specified in the request is not ready to serve inference requests.

func (*ModelNotReadyException) Code

func (s *ModelNotReadyException) Code() string

Code returns the exception type name.

func (*ModelNotReadyException) Error

func (s *ModelNotReadyException) Error() string

func (ModelNotReadyException) GoString

func (s ModelNotReadyException) GoString() string

GoString returns the string representation.

API parameter values that are decorated as "sensitive" in the API will not be included in the string output. The member name will be present, but the value will be replaced with "sensitive".

func (*ModelNotReadyException) Message

func (s *ModelNotReadyException) Message() string

Message returns the exception's message.

func (*ModelNotReadyException) OrigErr

func (s *ModelNotReadyException) OrigErr() error

OrigErr always returns nil, satisfies awserr.Error interface.

func (*ModelNotReadyException) RequestID

func (s *ModelNotReadyException) RequestID() string

RequestID returns the service's response RequestID for request.

func (*ModelNotReadyException) StatusCode

func (s *ModelNotReadyException) StatusCode() int

Status code returns the HTTP status code for the request's response error.

func (ModelNotReadyException) String

func (s ModelNotReadyException) String() string

String returns the string representation.

API parameter values that are decorated as "sensitive" in the API will not be included in the string output. The member name will be present, but the value will be replaced with "sensitive".

type ModelStreamErrorException

type ModelStreamErrorException struct {
	RespMetadata protocol.ResponseMetadata `json:"-" xml:"-"`

	Message_ *string `locationName:"message" type:"string"`

	// The original message.
	OriginalMessage *string `locationName:"originalMessage" type:"string"`

	// The original status code.
	OriginalStatusCode *int64 `locationName:"originalStatusCode" min:"100" type:"integer"`
	// contains filtered or unexported fields
}

An error occurred while streaming the response. Retry your request.

func (*ModelStreamErrorException) Code

Code returns the exception type name.

func (*ModelStreamErrorException) Error

func (s *ModelStreamErrorException) Error() string

func (ModelStreamErrorException) GoString

func (s ModelStreamErrorException) GoString() string

GoString returns the string representation.

API parameter values that are decorated as "sensitive" in the API will not be included in the string output. The member name will be present, but the value will be replaced with "sensitive".

func (*ModelStreamErrorException) MarshalEvent

MarshalEvent marshals the type into an stream event value. This method should only used internally within the SDK's EventStream handling.

func (*ModelStreamErrorException) Message

func (s *ModelStreamErrorException) Message() string

Message returns the exception's message.

func (*ModelStreamErrorException) OrigErr

func (s *ModelStreamErrorException) OrigErr() error

OrigErr always returns nil, satisfies awserr.Error interface.

func (*ModelStreamErrorException) RequestID

func (s *ModelStreamErrorException) RequestID() string

RequestID returns the service's response RequestID for request.

func (*ModelStreamErrorException) StatusCode

func (s *ModelStreamErrorException) StatusCode() int

Status code returns the HTTP status code for the request's response error.

func (ModelStreamErrorException) String

func (s ModelStreamErrorException) String() string

String returns the string representation.

API parameter values that are decorated as "sensitive" in the API will not be included in the string output. The member name will be present, but the value will be replaced with "sensitive".

func (*ModelStreamErrorException) UnmarshalEvent

func (s *ModelStreamErrorException) UnmarshalEvent(
	payloadUnmarshaler protocol.PayloadUnmarshaler,
	msg eventstream.Message,
) error

UnmarshalEvent unmarshals the EventStream Message into the ModelStreamErrorException value. This method is only used internally within the SDK's EventStream handling.

type ModelTimeoutException

type ModelTimeoutException struct {
	RespMetadata protocol.ResponseMetadata `json:"-" xml:"-"`

	Message_ *string `locationName:"message" type:"string"`
	// contains filtered or unexported fields
}

The request took too long to process. Processing time exceeded the model timeout length.

func (*ModelTimeoutException) Code

func (s *ModelTimeoutException) Code() string

Code returns the exception type name.

func (*ModelTimeoutException) Error

func (s *ModelTimeoutException) Error() string

func (ModelTimeoutException) GoString

func (s ModelTimeoutException) GoString() string

GoString returns the string representation.

API parameter values that are decorated as "sensitive" in the API will not be included in the string output. The member name will be present, but the value will be replaced with "sensitive".

func (*ModelTimeoutException) MarshalEvent added in v1.45.20

MarshalEvent marshals the type into an stream event value. This method should only used internally within the SDK's EventStream handling.

func (*ModelTimeoutException) Message

func (s *ModelTimeoutException) Message() string

Message returns the exception's message.

func (*ModelTimeoutException) OrigErr

func (s *ModelTimeoutException) OrigErr() error

OrigErr always returns nil, satisfies awserr.Error interface.

func (*ModelTimeoutException) RequestID

func (s *ModelTimeoutException) RequestID() string

RequestID returns the service's response RequestID for request.

func (*ModelTimeoutException) StatusCode

func (s *ModelTimeoutException) StatusCode() int

Status code returns the HTTP status code for the request's response error.

func (ModelTimeoutException) String

func (s ModelTimeoutException) String() string

String returns the string representation.

API parameter values that are decorated as "sensitive" in the API will not be included in the string output. The member name will be present, but the value will be replaced with "sensitive".

func (*ModelTimeoutException) UnmarshalEvent added in v1.45.20

func (s *ModelTimeoutException) UnmarshalEvent(
	payloadUnmarshaler protocol.PayloadUnmarshaler,
	msg eventstream.Message,
) error

UnmarshalEvent unmarshals the EventStream Message into the ModelTimeoutException value. This method is only used internally within the SDK's EventStream handling.

type PayloadPart

type PayloadPart struct {

	// Base64-encoded bytes of payload data.
	//
	// Bytes is a sensitive parameter and its value will be
	// replaced with "sensitive" in string returned by PayloadPart's
	// String and GoString methods.
	//
	// Bytes is automatically base64 encoded/decoded by the SDK.
	Bytes []byte `locationName:"bytes" type:"blob" sensitive:"true"`
	// contains filtered or unexported fields
}

Payload content included in the response.

func (PayloadPart) GoString

func (s PayloadPart) GoString() string

GoString returns the string representation.

API parameter values that are decorated as "sensitive" in the API will not be included in the string output. The member name will be present, but the value will be replaced with "sensitive".

func (*PayloadPart) MarshalEvent

func (s *PayloadPart) MarshalEvent(pm protocol.PayloadMarshaler) (msg eventstream.Message, err error)

MarshalEvent marshals the type into an stream event value. This method should only used internally within the SDK's EventStream handling.

func (*PayloadPart) SetBytes

func (s *PayloadPart) SetBytes(v []byte) *PayloadPart

SetBytes sets the Bytes field's value.

func (PayloadPart) String

func (s PayloadPart) String() string

String returns the string representation.

API parameter values that are decorated as "sensitive" in the API will not be included in the string output. The member name will be present, but the value will be replaced with "sensitive".

func (*PayloadPart) UnmarshalEvent

func (s *PayloadPart) UnmarshalEvent(
	payloadUnmarshaler protocol.PayloadUnmarshaler,
	msg eventstream.Message,
) error

UnmarshalEvent unmarshals the EventStream Message into the PayloadPart value. This method is only used internally within the SDK's EventStream handling.

type ResourceNotFoundException

type ResourceNotFoundException struct {
	RespMetadata protocol.ResponseMetadata `json:"-" xml:"-"`

	Message_ *string `locationName:"message" type:"string"`
	// contains filtered or unexported fields
}

The specified resource ARN was not found. Check the ARN and try your request again.

func (*ResourceNotFoundException) Code

Code returns the exception type name.

func (*ResourceNotFoundException) Error

func (s *ResourceNotFoundException) Error() string

func (ResourceNotFoundException) GoString

func (s ResourceNotFoundException) GoString() string

GoString returns the string representation.

API parameter values that are decorated as "sensitive" in the API will not be included in the string output. The member name will be present, but the value will be replaced with "sensitive".

func (*ResourceNotFoundException) Message

func (s *ResourceNotFoundException) Message() string

Message returns the exception's message.

func (*ResourceNotFoundException) OrigErr

func (s *ResourceNotFoundException) OrigErr() error

OrigErr always returns nil, satisfies awserr.Error interface.

func (*ResourceNotFoundException) RequestID

func (s *ResourceNotFoundException) RequestID() string

RequestID returns the service's response RequestID for request.

func (*ResourceNotFoundException) StatusCode

func (s *ResourceNotFoundException) StatusCode() int

Status code returns the HTTP status code for the request's response error.

func (ResourceNotFoundException) String

func (s ResourceNotFoundException) String() string

String returns the string representation.

API parameter values that are decorated as "sensitive" in the API will not be included in the string output. The member name will be present, but the value will be replaced with "sensitive".

type ResponseStreamEvent

type ResponseStreamEvent interface {
	eventstreamapi.Marshaler
	eventstreamapi.Unmarshaler
	// contains filtered or unexported methods
}

ResponseStreamEvent groups together all EventStream events writes for ResponseStream.

These events are:

  • PayloadPart

type ResponseStreamReader

type ResponseStreamReader interface {
	// Returns a channel of events as they are read from the event stream.
	Events() <-chan ResponseStreamEvent

	// Close will stop the reader reading events from the stream.
	Close() error

	// Returns any error that has occurred while reading from the event stream.
	Err() error
}

ResponseStreamReader provides the interface for reading to the stream. The default implementation for this interface will be ResponseStream.

The reader's Close method must allow multiple concurrent calls.

These events are:

  • PayloadPart
  • ResponseStreamUnknownEvent

type ResponseStreamUnknownEvent

type ResponseStreamUnknownEvent struct {
	Type    string
	Message eventstream.Message
}

ResponseStreamUnknownEvent provides a failsafe event for the ResponseStream group of events when an unknown event is received.

func (*ResponseStreamUnknownEvent) MarshalEvent

MarshalEvent marshals the type into an stream event value. This method should only used internally within the SDK's EventStream handling.

func (*ResponseStreamUnknownEvent) UnmarshalEvent

func (e *ResponseStreamUnknownEvent) UnmarshalEvent(
	payloadUnmarshaler protocol.PayloadUnmarshaler,
	msg eventstream.Message,
) error

UnmarshalEvent unmarshals the EventStream Message into the ResponseStream value. This method is only used internally within the SDK's EventStream handling.

type ServiceQuotaExceededException

type ServiceQuotaExceededException struct {
	RespMetadata protocol.ResponseMetadata `json:"-" xml:"-"`

	Message_ *string `locationName:"message" type:"string"`
	// contains filtered or unexported fields
}

The number of requests exceeds the service quota. Resubmit your request later.

func (*ServiceQuotaExceededException) Code

Code returns the exception type name.

func (*ServiceQuotaExceededException) Error

func (ServiceQuotaExceededException) GoString

GoString returns the string representation.

API parameter values that are decorated as "sensitive" in the API will not be included in the string output. The member name will be present, but the value will be replaced with "sensitive".

func (*ServiceQuotaExceededException) Message

Message returns the exception's message.

func (*ServiceQuotaExceededException) OrigErr

func (s *ServiceQuotaExceededException) OrigErr() error

OrigErr always returns nil, satisfies awserr.Error interface.

func (*ServiceQuotaExceededException) RequestID

func (s *ServiceQuotaExceededException) RequestID() string

RequestID returns the service's response RequestID for request.

func (*ServiceQuotaExceededException) StatusCode

func (s *ServiceQuotaExceededException) StatusCode() int

Status code returns the HTTP status code for the request's response error.

func (ServiceQuotaExceededException) String

String returns the string representation.

API parameter values that are decorated as "sensitive" in the API will not be included in the string output. The member name will be present, but the value will be replaced with "sensitive".

type ThrottlingException

type ThrottlingException struct {
	RespMetadata protocol.ResponseMetadata `json:"-" xml:"-"`

	Message_ *string `locationName:"message" type:"string"`
	// contains filtered or unexported fields
}

The number of requests exceeds the limit. Resubmit your request later.

func (*ThrottlingException) Code

func (s *ThrottlingException) Code() string

Code returns the exception type name.

func (*ThrottlingException) Error

func (s *ThrottlingException) Error() string

func (ThrottlingException) GoString

func (s ThrottlingException) GoString() string

GoString returns the string representation.

API parameter values that are decorated as "sensitive" in the API will not be included in the string output. The member name will be present, but the value will be replaced with "sensitive".

func (*ThrottlingException) MarshalEvent

func (s *ThrottlingException) MarshalEvent(pm protocol.PayloadMarshaler) (msg eventstream.Message, err error)

MarshalEvent marshals the type into an stream event value. This method should only used internally within the SDK's EventStream handling.

func (*ThrottlingException) Message

func (s *ThrottlingException) Message() string

Message returns the exception's message.

func (*ThrottlingException) OrigErr

func (s *ThrottlingException) OrigErr() error

OrigErr always returns nil, satisfies awserr.Error interface.

func (*ThrottlingException) RequestID

func (s *ThrottlingException) RequestID() string

RequestID returns the service's response RequestID for request.

func (*ThrottlingException) StatusCode

func (s *ThrottlingException) StatusCode() int

Status code returns the HTTP status code for the request's response error.

func (ThrottlingException) String

func (s ThrottlingException) String() string

String returns the string representation.

API parameter values that are decorated as "sensitive" in the API will not be included in the string output. The member name will be present, but the value will be replaced with "sensitive".

func (*ThrottlingException) UnmarshalEvent

func (s *ThrottlingException) UnmarshalEvent(
	payloadUnmarshaler protocol.PayloadUnmarshaler,
	msg eventstream.Message,
) error

UnmarshalEvent unmarshals the EventStream Message into the ThrottlingException value. This method is only used internally within the SDK's EventStream handling.

type ValidationException

type ValidationException struct {
	RespMetadata protocol.ResponseMetadata `json:"-" xml:"-"`

	Message_ *string `locationName:"message" type:"string"`
	// contains filtered or unexported fields
}

Input validation failed. Check your request parameters and retry the request.

func (*ValidationException) Code

func (s *ValidationException) Code() string

Code returns the exception type name.

func (*ValidationException) Error

func (s *ValidationException) Error() string

func (ValidationException) GoString

func (s ValidationException) GoString() string

GoString returns the string representation.

API parameter values that are decorated as "sensitive" in the API will not be included in the string output. The member name will be present, but the value will be replaced with "sensitive".

func (*ValidationException) MarshalEvent

func (s *ValidationException) MarshalEvent(pm protocol.PayloadMarshaler) (msg eventstream.Message, err error)

MarshalEvent marshals the type into an stream event value. This method should only used internally within the SDK's EventStream handling.

func (*ValidationException) Message

func (s *ValidationException) Message() string

Message returns the exception's message.

func (*ValidationException) OrigErr

func (s *ValidationException) OrigErr() error

OrigErr always returns nil, satisfies awserr.Error interface.

func (*ValidationException) RequestID

func (s *ValidationException) RequestID() string

RequestID returns the service's response RequestID for request.

func (*ValidationException) StatusCode

func (s *ValidationException) StatusCode() int

Status code returns the HTTP status code for the request's response error.

func (ValidationException) String

func (s ValidationException) String() string

String returns the string representation.

API parameter values that are decorated as "sensitive" in the API will not be included in the string output. The member name will be present, but the value will be replaced with "sensitive".

func (*ValidationException) UnmarshalEvent

func (s *ValidationException) UnmarshalEvent(
	payloadUnmarshaler protocol.PayloadUnmarshaler,
	msg eventstream.Message,
) error

UnmarshalEvent unmarshals the EventStream Message into the ValidationException value. This method is only used internally within the SDK's EventStream handling.

Directories

Path Synopsis
Package bedrockruntimeiface provides an interface to enable mocking the Amazon Bedrock Runtime service client for testing your code.
Package bedrockruntimeiface provides an interface to enable mocking the Amazon Bedrock Runtime service client for testing your code.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL