bedrockbatch

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Feb 19, 2025 License: MIT Imports: 18 Imported by: 0 modules, 1 package

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

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

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 []fmt.Stringer,
	opts ...chatter.Opt,
) (chatter.Reply, 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