invoke

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2024 License: Apache-2.0 Imports: 26 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateThreadForAgent

func CreateThreadForAgent(ctx context.Context, c kclient.WithWatch, agent *v1.Agent, threadName, userUID, agentRefName string) (*v1.Thread, error)

Types

type ErrToolResult

type ErrToolResult struct {
	Message string
}

func (ErrToolResult) Error

func (e ErrToolResult) Error() string

type Invoker

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

func NewInvoker

func NewInvoker(c kclient.WithWatch, gptClient *gptscript.GPTScript, serverURL, workspaceProviderType string, tokenService *jwt.TokenService, events *events.Emitter) *Invoker

func (*Invoker) Agent

func (i *Invoker) Agent(ctx context.Context, c kclient.WithWatch, agent *v1.Agent, input string, opt Options) (_ *Response, err error)

func (*Invoker) IsSynchronousPending

func (i *Invoker) IsSynchronousPending(runName string) bool

func (*Invoker) Resume

func (i *Invoker) Resume(ctx context.Context, c kclient.WithWatch, thread *v1.Thread, run *v1.Run) error

func (*Invoker) Step

func (i *Invoker) Step(ctx context.Context, c kclient.WithWatch, step *v1.WorkflowStep, opt StepOptions) (*Response, error)

func (*Invoker) SystemTask

func (i *Invoker) SystemTask(ctx context.Context, thread *v1.Thread, tool, input any, opts ...SystemTaskOptions) (*Response, error)

func (*Invoker) Workflow

func (i *Invoker) Workflow(ctx context.Context, c kclient.WithWatch, wf *v1.Workflow, input string, opt WorkflowOptions) (*Response, error)

type Options

type Options struct {
	Synchronous           bool
	ThreadName            string
	WorkflowStepName      string
	WorkflowStepID        string
	PreviousRunName       string
	ForceNoResume         bool
	CreateThread          bool
	ThreadCredentialScope *bool
	UserUID               string
	AgentRefName          string
}

type Response

type Response struct {
	Run    *v1.Run
	Thread *v1.Thread
	Events <-chan types.Progress
	// contains filtered or unexported fields
}

func (*Response) Close

func (r *Response) Close()

func (*Response) Result

func (r *Response) Result(ctx context.Context) (TaskResult, error)

type StepOptions

type StepOptions struct {
	PreviousRunName string
	Continue        *string
}

type SystemTaskOptions

type SystemTaskOptions struct {
	CredentialContextIDs []string
}

type TaskResult

type TaskResult struct {
	// Task output
	Output string
}

type WorkflowOptions

type WorkflowOptions struct {
	ThreadName string
	StepID     string
	Events     bool
}

Jump to

Keyboard shortcuts

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