tools

package
v0.0.0-...-5c79d48 Latest Latest
Warning

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

Go to latest
Published: Feb 15, 2024 License: AGPL-3.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const AuditQueryGenerationToolName = "Audit Query Generation"

Variables

This section is empty.

Functions

This section is empty.

Types

type AccessPoint

type AccessPoint interface {
	ListResources(ctx context.Context, req proto.ListResourcesRequest) (*types.ListResourcesResponse, error)
}

AccessPoint allows reading resources from proxy cache.

type AccessRequestClient

type AccessRequestClient interface {
	CreateAccessRequestV2(ctx context.Context, req types.AccessRequest) (types.AccessRequest, error)
	GetAccessRequests(ctx context.Context, filter types.AccessRequestFilter) ([]types.AccessRequest, error)
}

AccessRequestClient abstracts away the access request client for testing purposes.

type AccessRequestCreateTool

type AccessRequestCreateTool struct{}

func (*AccessRequestCreateTool) Description

func (*AccessRequestCreateTool) Description() string

func (*AccessRequestCreateTool) Name

func (*AccessRequestCreateTool) ParseInput

func (*AccessRequestCreateTool) Run

func (*AccessRequestCreateTool) Run(ctx context.Context, toolCtx *ToolContext, input string) (string, error)

type AccessRequestListRequestableResourcesTool

type AccessRequestListRequestableResourcesTool struct{}

func (*AccessRequestListRequestableResourcesTool) Description

func (*AccessRequestListRequestableResourcesTool) Name

func (*AccessRequestListRequestableResourcesTool) Run

type AccessRequestListRequestableRolesTool

type AccessRequestListRequestableRolesTool struct{}

func (*AccessRequestListRequestableRolesTool) Description

func (*AccessRequestListRequestableRolesTool) Name

func (*AccessRequestListRequestableRolesTool) Run

type AccessRequestsListTool

type AccessRequestsListTool struct{}

func (*AccessRequestsListTool) Description

func (*AccessRequestsListTool) Description() string

func (*AccessRequestsListTool) Name

func (*AccessRequestsListTool) Run

func (*AccessRequestsListTool) Run(ctx context.Context, toolCtx *ToolContext, input string) (string, error)

type AuditQueryGenerationTool

type AuditQueryGenerationTool struct {
	LLM *openai.Client
}

func (*AuditQueryGenerationTool) ChooseEventTable

func (t *AuditQueryGenerationTool) ChooseEventTable(ctx context.Context, input string, tc *tokens.TokenCount) (string, error)

ChooseEventTable lists all supported events and uses the LLM as a zero shot classifier to find which event type can be used to answer the suer query.

func (*AuditQueryGenerationTool) Description

func (t *AuditQueryGenerationTool) Description() string

func (*AuditQueryGenerationTool) GenerateQuery

func (t *AuditQueryGenerationTool) GenerateQuery(ctx context.Context, eventType, input string, tc *tokens.TokenCount) (*output.StreamingMessage, error)

GenerateQuery takes an event type, fetches its schema, and calls the LLM to generate SQL and answer the user query.

func (*AuditQueryGenerationTool) Name

func (t *AuditQueryGenerationTool) Name() string

func (*AuditQueryGenerationTool) Run

type CommandExecutionTool

type CommandExecutionTool struct{}

func (*CommandExecutionTool) Description

func (c *CommandExecutionTool) Description() string

func (*CommandExecutionTool) Name

func (c *CommandExecutionTool) Name() string

func (*CommandExecutionTool) ParseInput

ParseInput is called in a special case if the planned tool is CommandExecutionTool. This is because CommandExecutionTool is handled differently from most other tools and forcibly terminates the thought loop.

func (*CommandExecutionTool) Run

type CommandGenerationTool

type CommandGenerationTool struct{}

func (*CommandGenerationTool) Description

func (c *CommandGenerationTool) Description() string

func (*CommandGenerationTool) Name

func (c *CommandGenerationTool) Name() string

func (*CommandGenerationTool) ParseInput

ParseInput is called in a special case if the planned tool is CommandExecutionTool. This is because CommandExecutionTool is handled differently from most other tools and forcibly terminates the thought loop.

func (*CommandGenerationTool) Run

type CommandGenerationToolInput

type CommandGenerationToolInput struct {
	// Command is a unix command to execute.
	Command string `json:"command"`
}

type EmbeddingRetrievalTool

type EmbeddingRetrievalTool struct{}

func (*EmbeddingRetrievalTool) Description

func (e *EmbeddingRetrievalTool) Description() string

func (*EmbeddingRetrievalTool) Name

func (e *EmbeddingRetrievalTool) Name() string

func (*EmbeddingRetrievalTool) Run

func (e *EmbeddingRetrievalTool) Run(ctx context.Context, toolCtx *ToolContext, input string) (string, error)

type EmbeddingRetrievalToolInput

type EmbeddingRetrievalToolInput struct {
	Question string `json:"question"`
}

type NodeWatcher

type NodeWatcher interface {
	// GetNodes returns a list of nodes that match the given filter.
	GetNodes(ctx context.Context, fn func(n services.Node) bool) []types.Server

	// NodeCount returns the number of nodes in the cluster.
	NodeCount() int
}

NodeWatcher abstracts away services.NodeWatcher for testing purposes.

type Tool

type Tool interface {
	Name() string
	Description() string
	Run(ctx context.Context, toolCtx *ToolContext, input string) (string, error)
}

Tool is an interface that allows the agent to interact with the outside world. It is used to implement things such as vector document retrieval and command execution.

type ToolContext

type ToolContext struct {
	assist.AssistEmbeddingServiceClient
	AccessRequestClient
	AccessPoint
	services.AccessChecker
	NodeWatcher NodeWatcher
	User        string
	ClusterName string
}

*ToolContext contains various "data" which is commonly needed by various tools.

Jump to

Keyboard shortcuts

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