bedrockbatch

package module
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2024 License: MIT Imports: 19 Imported by: 1

Documentation

Index

Constants

View Source
const Version = "bedrockbatch/v0.0.1"

Variables

View Source
var (
	// The Amazon Resource Name (ARN) of the service role with permissions to carry
	// out and manage batch inference.
	//
	// This option is required.
	//
	// [See AWS documentation]: https://docs.aws.amazon.com/bedrock/latest/userguide/batch-iam-sr.html
	WithRole = opts.ForName[Client, string]("role")

	// Set AWS S3 bucket for input/output data
	//
	// This option is required.
	WithBucket = opts.ForName[Client, string]("bucket")

	// Set AWS Bedrock Foundational LLM
	//
	// This option is required.
	WithLLM = opts.ForType[Client, bedrockapi.LLM]()

	// Use aws.Config to config the client
	WithConfig = opts.FMap(optsFromConfig)

	// Use region for aws.Config
	WithRegion = opts.FMap(optsFromRegion)

	// Set us-west-2 as default region
	WithDefaultRegion = WithRegion("us-west-2")

	// Set file system client
	WithFileSystem = opts.ForType[Client, FileSystem]()

	// Set batch inference client
	WithBedrock = opts.ForType[Client, Bedrock]()
)

Functions

func NewInferenceRole

func NewInferenceRole(scope constructs.Construct, id *string, props *RoleProps) awsiam.Role

Types

type Bedrock

type Bedrock interface {
	CreateModelInvocationJob(ctx context.Context, params *bedrock.CreateModelInvocationJobInput, optFns ...func(*bedrock.Options)) (*bedrock.CreateModelInvocationJobOutput, error)
}

AWS Bedrock API used by the client for batch inference

type Client

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

func New

func New(opt ...Option) (*Client, error)

Create new AWS Bedrock batch inference client

func (*Client) Prepare

func (c *Client) Prepare() (*Job, error)

Prepare the inference job.

type FileSystem

type FileSystem = stream.CreateFS[struct{}]

File System API used by the client for S3 I/O

type Job

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

func (*Job) Cancel

func (job *Job) Cancel() error

func (Job) Close

func (w Job) Close() error

func (*Job) Commit

func (job *Job) Commit() (string, error)

func (*Job) ID

func (job *Job) ID() string

func (Job) Prompt

func (w Job) Prompt(
	ctx context.Context,
	prompt encoding.TextMarshaler,
	opts ...func(*chatter.Options),
) (string, error)

func (Job) UsedInputTokens

func (w Job) UsedInputTokens() int

func (Job) UsedReplyTokens

func (w Job) UsedReplyTokens() int

type Option

type Option = opts.Option[Client]

type RoleProps

type RoleProps struct {
	BucketName string
}

Jump to

Keyboard shortcuts

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