Documentation
¶
Index ¶
- func DecodeResponse(body []byte) (*inference.Response, error)
- func EncodeCountTokensInput(req inference.Request) ([]byte, error)
- func EncodeRequest(req inference.Request) ([]byte, error)
- type Codec
- type ConversationCollisionError
- type DecodeError
- type EncodeError
- type ForeignReasoningSignatureError
- type StreamAPIError
- type StreamDecodeError
- type ToolInputError
- type ToolSchemaError
- type UnsupportedBlockError
- type UnsupportedConversationError
- type UnsupportedEffortError
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DecodeResponse ¶
DecodeResponse parses a native Bedrock Converse response into the shared inference response. Bedrock does not echo the model ID in this envelope, so Model is intentionally left empty for the provider client to fill from the bound request.
func EncodeCountTokensInput ¶
EncodeCountTokensInput emits the Converse union member accepted by Bedrock's CountTokens API. Inference controls, output formatting, response-field paths, guardrails, and service tiers are intentionally excluded because CountTokens accepts only the conversation, system, tool configuration, and additional model-request fields.
Types ¶
type Codec ¶
type Codec struct{}
Codec is Amazon Bedrock's native Converse API dialect. The request body is shared by Converse and ConverseStream; streaming is selected by the provider route and response content type, not by a JSON flag.
func (Codec) DecodeResponse ¶
DecodeResponse is completed in decode.go; keeping the method here makes the codec's public shape explicit while request encoding is developed separately.
func (Codec) DecodeStream ¶
DecodeStream frames a successful ConverseStream response with AWS Event Stream and maps each event to shared content chunks. The returned reader owns resp.Body through the wire framer.
func (Codec) EncodeRequest ¶
func (Codec) EncodeRequest(req inference.Request, _ codec.RequestMode) (codec.EncodedRequest, error)
EncodeRequest implements codec.RequestEncoder. Converse and ConverseStream use the same body, so mode is intentionally ignored.
type ConversationCollisionError ¶
type ConversationCollisionError struct {
Reason string
}
ConversationCollisionError reports adjacent neutral turns that Bedrock cannot represent without mixing ordinary user content and toolResult blocks in one Converse message.
func (*ConversationCollisionError) Error ¶
func (e *ConversationCollisionError) Error() string
type DecodeError ¶
DecodeError is used by the response decoder for malformed successful Bedrock payloads. It is defined with the request codec so callers can use one stable typed error family across the codec's directions.
func (*DecodeError) Error ¶
func (e *DecodeError) Error() string
func (*DecodeError) Unwrap ¶
func (e *DecodeError) Unwrap() error
type EncodeError ¶
EncodeError wraps a request-construction failure that is not a feature or content-type validation error. It intentionally carries bounded diagnostics rather than raw provider payloads.
func (*EncodeError) Error ¶
func (e *EncodeError) Error() string
func (*EncodeError) Unwrap ¶
func (e *EncodeError) Unwrap() error
type ForeignReasoningSignatureError ¶
type ForeignReasoningSignatureError struct {
// Format is the label carried by the signature, or "" when it carries none.
Format string
}
ForeignReasoningSignatureError reports a reasoning signature this dialect cannot prove it minted, either because another dialect's label is attached (Format names it) or because no label is attached at all (Format is empty).
It is a hard error, not a degrade. A reasoning signature is verified by its issuer: measured against api.anthropic.com on 2026-08-13, a verbatim signature is accepted, a tampered one draws HTTP 400, and an EMPTY one draws the same 400. Both degrades therefore lose — forwarding sends a request certain to be rejected, stripping sends an unsigned reasoning block equally certain to be rejected while destroying the only copy of the continuation state. Failing here costs the same turn and names the cause.
Converse fronts the same Claude models as the Anthropic Messages API, so the foreign case is an ordinary session moved between endpoints, not an attack.
func (*ForeignReasoningSignatureError) Error ¶
func (e *ForeignReasoningSignatureError) Error() string
type StreamAPIError ¶
StreamAPIError reports an AWS event-stream exception after the HTTP success boundary. Only its typed exception name and bounded message are retained.
func (*StreamAPIError) Error ¶
func (e *StreamAPIError) Error() string
type StreamDecodeError ¶
StreamDecodeError reports malformed or out-of-order ConverseStream events. It never includes the raw provider event body in its diagnostic.
func (*StreamDecodeError) Error ¶
func (e *StreamDecodeError) Error() string
func (*StreamDecodeError) Unwrap ¶
func (e *StreamDecodeError) Unwrap() error
type ToolInputError ¶
ToolInputError reports malformed arguments on a replayed tool-use block.
func (*ToolInputError) Error ¶
func (e *ToolInputError) Error() string
type ToolSchemaError ¶
ToolSchemaError reports a missing, malformed, or otherwise invalid tool input schema before it reaches the Bedrock endpoint.
func (*ToolSchemaError) Error ¶
func (e *ToolSchemaError) Error() string
type UnsupportedBlockError ¶
UnsupportedBlockError reports a content block that Bedrock Converse cannot represent in the shared request vocabulary.
func (*UnsupportedBlockError) Error ¶
func (e *UnsupportedBlockError) Error() string
type UnsupportedConversationError ¶
type UnsupportedConversationError struct {
Conversation string
}
UnsupportedConversationError reports an unexpected conversation variant.
func (*UnsupportedConversationError) Error ¶
func (e *UnsupportedConversationError) Error() string
type UnsupportedEffortError ¶ added in v0.12.0
type UnsupportedEffortError struct {
Effort string
}
UnsupportedEffortError reports a neutral reasoning effort that the generic Converse request has no model-independent field to represent.
func (*UnsupportedEffortError) Error ¶ added in v0.12.0
func (e *UnsupportedEffortError) Error() string