action

package
v0.0.0-...-a056647 Latest Latest
Warning

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

Go to latest
Published: Jan 29, 2025 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Action

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

Action is a type to hold the content needed for an upcoming action. Actions can be of type 'tool' or 'user', indicating if the action is meant to be executed by a tool or a user.

func MakeTool

func MakeTool(calls []Call) Action

func MakeUser

func MakeUser(content string) Action

func (Action) Tool

func (a Action) Tool() (content []Call, ok bool)

Tool reports if the action is of type tool. If true a slice of calls to the tool services is returned.

func (Action) User

func (a Action) User() (content string, ok bool)

User reports if the action is of type user. If true the content for the user action is returned.

type Actor

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

func NewActor

func NewActor(discovery tool.Discovery, transport Transporter, log *slog.Logger) *Actor

func (*Actor) Act

func (ac *Actor) Act(ctx context.Context, calls []Call) ([]percept.Percept, error)

Act executes all given tool calls concurrently and returns their results as a slice of perceptions.

type Call

type Call struct {
	ID string
	// The name of the tool.
	Name      string
	Arguments string
}

Call provides the content for a tool action.

type Transporter

type Transporter interface {
	Post(ctx context.Context, addr string, header map[string][]string, body io.Reader) ([]byte, error)
}

Jump to

Keyboard shortcuts

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