codebot

package
v0.0.0-...-b160be8 Latest Latest
Warning

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

Go to latest
Published: Feb 23, 2025 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterTool

func RegisterTool(tool Tool)

Types

type ASTEdit

type ASTEdit struct {
	Node     string `json:"node"`
	Action   string `json:"action"`
	Filename string `json:"filename"`
}

func (*ASTEdit) BuildFunctionDefinition

func (t *ASTEdit) BuildFunctionDefinition() *llm.FunctionDefinition

func (*ASTEdit) Run

func (t *ASTEdit) Run(ctx context.Context, c *Chat, args map[string]any) (*ASTEditResults, error)

type ASTEditResults

type ASTEditResults struct {
	Success bool `json:"success"`
}

type Chat

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

func NewChat

func NewChat(ctx context.Context, llmClient llm.Client, baseDir string, contextFiles map[string]*FileInfo, toolbox *Toolbox, ui ui.UI) (*Chat, error)

func (*Chat) Close

func (c *Chat) Close() error

func (*Chat) SendMessage

func (c *Chat) SendMessage(ctx context.Context, userParts ...string) error

type CreateFile

type CreateFile struct {
	Contents string `json:"contents"`
	Filename string `json:"filename"`
}

func (*CreateFile) BuildFunctionDefinition

func (t *CreateFile) BuildFunctionDefinition() *llm.FunctionDefinition

func (*CreateFile) Run

func (t *CreateFile) Run(ctx context.Context, c *Chat, args map[string]any) (any, error)

type CreateFileResults

type CreateFileResults struct {
	Success bool `json:"success"`
}

type EditFile

type EditFile struct {
	ExistingText string `json:"existing_text"`
	NewText      string `json:"new_text"`
	Filename     string `json:"filename"`
}

func (*EditFile) BuildFunctionDefinition

func (t *EditFile) BuildFunctionDefinition() *llm.FunctionDefinition

func (*EditFile) Run

func (t *EditFile) Run(ctx context.Context, c *Chat, args map[string]any) (any, error)

type EditFileResults

type EditFileResults struct {
	Success bool `json:"success"`
}

type File

type File struct {
	Filename string `json:"filename"`
}

type FileInfo

type FileInfo struct {
	Path    string
	Content string
}

type FindInWorkspace

type FindInWorkspace struct {
	FindText string `json:"find_text"`
}

func (*FindInWorkspace) BuildFunctionDefinition

func (t *FindInWorkspace) BuildFunctionDefinition() *llm.FunctionDefinition

func (*FindInWorkspace) Run

func (t *FindInWorkspace) Run(ctx context.Context, c *Chat, args map[string]any) (any, error)

type FindInWorkspaceResult

type FindInWorkspaceResult struct {
	Matches []*Match `json:"matches"`
	Result  string   `json:"result"`
}

type FunctionResult

type FunctionResult struct {
	Response any
	Error    error
}

type ListFilesInWorkspace

type ListFilesInWorkspace struct {
	FindFileName string `json:"find_file_name"`
}

func (*ListFilesInWorkspace) BuildFunctionDefinition

func (t *ListFilesInWorkspace) BuildFunctionDefinition() *llm.FunctionDefinition

func (*ListFilesInWorkspace) Run

func (t *ListFilesInWorkspace) Run(ctx context.Context, c *Chat, args map[string]any) (any, error)

type ListFilesInWorkspaceResponse

type ListFilesInWorkspaceResponse struct {
	Matches []*File `json:"matches"`
	Result  string  `json:"result"`
}

type Match

type Match struct {
	Filename     string `json:"filename"`
	MatchingLine string `json:"matching_line"`
	Context      string `json:"context"`
}

type ReadFile

type ReadFile struct {
	Filename string `json:"filename"`
}

func (*ReadFile) BuildFunctionDefinition

func (t *ReadFile) BuildFunctionDefinition() *llm.FunctionDefinition

func (*ReadFile) Run

func (t *ReadFile) Run(ctx context.Context, c *Chat, args map[string]any) (any, error)

type ReadFileResponse

type ReadFileResponse struct {
	Contents string `json:"contents"`
}

type RunShellCommand

type RunShellCommand struct {
	Command string `json:"shell_command"`
}

func (*RunShellCommand) BuildFunctionDefinition

func (t *RunShellCommand) BuildFunctionDefinition() *llm.FunctionDefinition

func (*RunShellCommand) Run

func (t *RunShellCommand) Run(ctx context.Context, c *Chat, llmArgs map[string]any) (any, error)

type RunShellCommandResults

type RunShellCommandResults struct {
	Stdout   string `json:"stdout"`
	Stderr   string `json:"stderr"`
	ExitCode int    `json:"exit_code"`
}

type RunTerminalCommand

type RunTerminalCommand struct {
	Command string `json:"command"`
	Args    string `json:"args"`
}

func (*RunTerminalCommand) BuildFunctionDefinition

func (t *RunTerminalCommand) BuildFunctionDefinition() *llm.FunctionDefinition

func (*RunTerminalCommand) Run

func (t *RunTerminalCommand) Run(ctx context.Context, c *Chat, args map[string]any) (any, error)

type RunTerminalCommandResults

type RunTerminalCommandResults struct {
	Success bool   `json:"success"`
	Output  string `json:"output"`
	Error   string `json:"error"`
}

type Tool

type Tool interface {
	BuildFunctionDefinition() *llm.FunctionDefinition

	Run(ctx context.Context, c *Chat, args map[string]any) (any, error)
}

func GetAllTools

func GetAllTools() []Tool

type Toolbox

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

func NewToolbox

func NewToolbox(tools []Tool) *Toolbox

func (*Toolbox) CallFunction

func (t *Toolbox) CallFunction(ctx context.Context, c *Chat, functionCall llm.FunctionCall) (*FunctionResult, error)

func (*Toolbox) GetFunctionDefinitions

func (t *Toolbox) GetFunctionDefinitions() []*llm.FunctionDefinition

type VerifyCode

type VerifyCode struct {
	Filename string `json:"filename"`
}

func (*VerifyCode) BuildFunctionDefinition

func (t *VerifyCode) BuildFunctionDefinition() *llm.FunctionDefinition

func (*VerifyCode) Run

func (t *VerifyCode) Run(ctx context.Context, c *Chat, args map[string]any) (any, error)

type VerifyCodeResponse

type VerifyCodeResponse struct {
	Success bool `json:"success"`
	Errors  []string
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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