agents

package
v0.3.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	Catchdir   = ".nuwa-terminal"
	ScriptsDir = "scripts"
)

Variables

This section is empty.

Functions

func CreateTroubleshootingAgentPrompt

func CreateTroubleshootingAgentPrompt(tools []tools.Tool) prompts.PromptTemplate

func ParseScript

func ParseScript(response string) (filename, content string, err error)

func SaveScript

func SaveScript(filename, content string) (string, error)

Types

type ScriptCodeParser

type ScriptCodeParser struct {
}

func (*ScriptCodeParser) Call

func (e *ScriptCodeParser) Call(ctx context.Context, input string) (string, error)

func (*ScriptCodeParser) Description

func (e *ScriptCodeParser) Description() string

Description returns a string describing the ScriptCodeParser tool.

func (*ScriptCodeParser) Name

func (e *ScriptCodeParser) Name() string

Name returns the name of the tool.

func (*ScriptCodeParser) ParseScriptAndSave

func (e *ScriptCodeParser) ParseScriptAndSave(input string) (string, error)

type ScriptExecutor

type ScriptExecutor struct {
}

func (*ScriptExecutor) Call

func (e *ScriptExecutor) Call(ctx context.Context, input string) (string, error)

func (*ScriptExecutor) Description

func (e *ScriptExecutor) Description() string

Description returns a string describing the ScriptExecutor tool.

func (*ScriptExecutor) Name

func (e *ScriptExecutor) Name() string

Name returns the name of the tool.

type TroubleshootingAgent

type TroubleshootingAgent struct {
	// Chain is the chain used to call with the values. The chain should have an
	// input called "agent_scratchpad" for the agent to put its thoughts in.
	Chain chains.Chain
	// Tools is a list of the tools the agent can use.
	Tools []tools.Tool
	// Output key is the key where the final output is placed.
	OutputKey string
	// CallbacksHandler is the handler for callbacks.
	CallbacksHandler callbacks.Handler
}

ToubleshootingAgent will implement langchaingo agent interface and will be used to troubleshoot the linux system problems form system logs or runtime logs.

func NewTroubleshootingAgent

func NewTroubleshootingAgent(llm llms.Model, tools []tools.Tool, outputkey string, callback callbacks.Handler) *TroubleshootingAgent

func (*TroubleshootingAgent) GetInputKeys

func (tbs *TroubleshootingAgent) GetInputKeys() []string

func (*TroubleshootingAgent) GetOutputKeys

func (tbs *TroubleshootingAgent) GetOutputKeys() []string

func (*TroubleshootingAgent) GetTools

func (tbs *TroubleshootingAgent) GetTools() []tools.Tool

func (*TroubleshootingAgent) Plan

func (tbs *TroubleshootingAgent) Plan(
	ctx context.Context,
	intermediateSteps []schema.AgentStep,
	inputs map[string]string,
) ([]schema.AgentAction, *schema.AgentFinish, error)

Plan decides what action to take or returns the final result of the input.

Jump to

Keyboard shortcuts

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