bedrock

package module
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 5, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Overview

Package bedrock handles Bedrock Agent function-based action-group invocations.

Index

Constants

View Source
const (
	Failure  = "FAILURE"
	Reprompt = "REPROMPT"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Configuration

type Configuration struct{ Name, Description string }

type Error

type Error struct {
	Message string
	Cause   error
}

Error preserves the ordinary JavaScript Error name in Lambda Runtime API errors.

func (*Error) Error

func (e *Error) Error() string

func (*Error) ErrorName

func (e *Error) ErrorName() string

func (*Error) Unwrap

func (e *Error) Unwrap() error

type Event

type Event = map[string]any

type FunctionResponse

type FunctionResponse struct {
	Body                        any
	ResponseState               any
	SessionAttributes           any
	PromptSessionAttributes     any
	KnowledgeBasesConfiguration any
}

FunctionResponse bypasses ordinary JSON body conversion. Construct it with NewFunctionResponse to obtain the reference's empty session-attribute defaults. Set optional fields to nil to omit them. Fields remain invocation-owned.

func NewFunctionResponse

func NewFunctionResponse(body any) *FunctionResponse

func (*FunctionResponse) Build

func (r *FunctionResponse) Build(actionGroup, function string) map[string]any

Build creates the wire envelope without modifying or cloning supplied fields.

type NamedError

type NamedError struct {
	Name, Message string
	Cause         error
}

func (*NamedError) Error

func (e *NamedError) Error() string

func (*NamedError) ErrorName

func (e *NamedError) ErrorName() string

func (*NamedError) Unwrap

func (e *NamedError) Unwrap() error

type Options

type Options struct {
	// Diagnostic runs outside locks and may be called concurrently. Registration
	// uses context.Background; execution diagnostics retain the invocation context.
	Diagnostic func(context.Context, string, string, error)
}

type Parameters

type Parameters struct {
	// contains filtered or unexported fields
}

Parameters retains insertion order so returning the received parameters preserves the reference JSON body. Each invocation receives an independent instance.

func (*Parameters) Delete

func (p *Parameters) Delete(name string)

func (*Parameters) Get

func (p *Parameters) Get(name string) any

func (*Parameters) Has

func (p *Parameters) Has(name string) bool

func (*Parameters) Keys

func (p *Parameters) Keys() []string

Keys follows Object.keys ordering: numeric indices first, then insertion order.

func (*Parameters) MarshalJSON

func (p *Parameters) MarshalJSON() ([]byte, error)

func (*Parameters) Set

func (p *Parameters) Set(name string, value any)

Set replaces a value without moving its original key position.

func (*Parameters) Values

func (p *Parameters) Values() map[string]any

Values returns a shallow map copy. Go maps do not preserve insertion order.

type Resolver

type Resolver struct {
	// contains filtered or unexported fields
}

func New

func New(options Options) *Resolver

func (*Resolver) Resolve

func (r *Resolver) Resolve(ctx context.Context, input any) (any, error)

Resolve validates the event before calling a tool. Business and serialization failures become Bedrock response bodies; malformed input returns an error.

func (*Resolver) Tool

func (r *Resolver) Tool(handler ToolHandler, configuration Configuration)

Tool registers a handler by function name. Description is accepted for source compatibility; the reference stores it without validating or publishing it.

type ToolHandler

type ToolHandler func(context.Context, *Parameters, Event) (any, error)

type Undefined

type Undefined struct{}

Undefined represents an absent JavaScript value. Nil represents JSON null.

Jump to

Keyboard shortcuts

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