runner

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Feb 17, 2024 License: Apache-2.0 Imports: 8 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	EventTypeCallStart    = EventType("callStart")
	EventTypeCallContinue = EventType("callContinue")
	EventTypeCallSubCalls = EventType("callSubCalls")
	EventTypeCallProgress = EventType("callProgress")
	EventTypeChat         = EventType("callChat")
	EventTypeCallFinish   = EventType("callFinish")
)

Functions

This section is empty.

Types

type CacheOptions

type CacheOptions cache.Options

type Event

type Event struct {
	Time               time.Time              `json:"time,omitempty"`
	CallContext        *engine.Context        `json:"callContext,omitempty"`
	ToolSubCalls       map[string]engine.Call `json:"toolSubCalls,omitempty"`
	ToolResults        int                    `json:"toolResults,omitempty"`
	Type               EventType              `json:"type,omitempty"`
	ChatCompletionID   string                 `json:"chatCompletionId,omitempty"`
	ChatRequest        any                    `json:"chatRequest,omitempty"`
	ChatResponse       any                    `json:"chatResponse,omitempty"`
	ChatResponseCached bool                   `json:"chatResponseCached,omitempty"`
	Content            string                 `json:"content,omitempty"`
}

type EventType

type EventType string

type Monitor

type Monitor interface {
	Event(event Event)
	Stop(output string, err error)
}

type MonitorFactory

type MonitorFactory interface {
	Start(ctx context.Context, prg *types.Program, env []string, input string) (Monitor, error)
}

type OpenAIOptions

type OpenAIOptions openai.Options

type Options

type Options struct {
	CacheOptions
	OpenAIOptions
	MonitorFactory MonitorFactory `usage:"-"`
}

type Runner

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

func New

func New(opts ...Options) (*Runner, error)

func (*Runner) Run

func (r *Runner) Run(ctx context.Context, prg types.Program, env []string, input string) (output string, err error)

Jump to

Keyboard shortcuts

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