Help us shape the future of Go! Take the 2026 Go Developer Survey

engine

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Feb 29, 2024 License: Apache-2.0 Imports: 18 Imported by: 2

Documentation

Index

Constants

View Source
const DaemonURLSuffix = ".daemon.gpt.local"

Variables

This section is empty.

Functions

func CloseDaemons

func CloseDaemons()

Types

type Call

type Call struct {
	ToolName string `json:"toolName,omitempty"`
	Input    string `json:"input,omitempty"`
}

type CallResult

type CallResult struct {
	ID     string `json:"id,omitempty"`
	Result string `json:"result,omitempty"`
}

type Context

type Context struct {
	ID      string
	Ctx     context.Context
	Parent  *Context
	Program *types.Program
	Tool    types.Tool
}

func NewContext

func NewContext(ctx context.Context, prg *types.Program) Context

func (*Context) MarshalJSON

func (c *Context) MarshalJSON() ([]byte, error)

func (*Context) ParentID

func (c *Context) ParentID() string

func (*Context) SubCall

func (c *Context) SubCall(ctx context.Context, toolName, callID string) (Context, error)

func (*Context) UnmarshalJSON

func (c *Context) UnmarshalJSON([]byte) error

type Engine

type Engine struct {
	Model    Model
	Env      []string
	Progress chan<- types.CompletionStatus
}

func (*Engine) Continue

func (e *Engine) Continue(ctx context.Context, state *State, results ...CallResult) (*Return, error)

func (*Engine) Start

func (e *Engine) Start(ctx Context, input string) (*Return, error)

type ErrToolNotFound

type ErrToolNotFound struct {
	ToolName string
}

func (*ErrToolNotFound) Error

func (e *ErrToolNotFound) Error() string

type Model added in v0.1.4

type Model interface {
	Call(ctx context.Context, messageRequest types.CompletionRequest, status chan<- types.CompletionStatus) (*types.CompletionMessage, error)
}

type Return

type Return struct {
	State  *State
	Calls  map[string]Call
	Result *string
}

type State

type State struct {
	Completion types.CompletionRequest             `json:"completion,omitempty"`
	Pending    map[string]types.CompletionToolCall `json:"pending,omitempty"`
	Results    map[string]CallResult               `json:"results,omitempty"`
}

Jump to

Keyboard shortcuts

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