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

engine

package
v0.0.3 Latest Latest
Warning

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

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

Documentation

Index

Constants

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

Variables

View Source
var DefaultToolSchema = types.JSONSchema{
	Property: types.Property{
		Type: "object",
	},
	Properties: map[string]types.Property{
		openai.DefaultPromptParameter: {
			Description: "Prompt to send to the tool or assistant. This may be instructions or question.",
			Type:        "string",
		},
	},
	Required: []string{openai.DefaultPromptParameter},
}
View Source
var InternalSystemPrompt = `` /* 324-byte string literal not displayed */

InternalSystemPrompt is added to all threads. Changing this is very dangerous as it has a terrible global effect and changes the behavior of all scripts.

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 {
	Client   *openai.Client
	Env      []string
	Progress chan<- openai.Status
}

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 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