Documentation ¶
Index ¶
- Constants
- type AccessPoint
- type AccessRequestClient
- type AccessRequestCreateTool
- func (*AccessRequestCreateTool) Description() string
- func (*AccessRequestCreateTool) Name() string
- func (*AccessRequestCreateTool) ParseInput(input string) (*modeloutput.AccessRequest, error)
- func (*AccessRequestCreateTool) Run(ctx context.Context, toolCtx *ToolContext, input string) (string, error)
- type AccessRequestListRequestableResourcesTool
- type AccessRequestListRequestableRolesTool
- type AccessRequestsListTool
- type AuditQueryGenerationTool
- func (t *AuditQueryGenerationTool) ChooseEventTable(ctx context.Context, input string, tc *tokens.TokenCount) (string, error)
- func (t *AuditQueryGenerationTool) Description() string
- func (t *AuditQueryGenerationTool) GenerateQuery(ctx context.Context, eventType, input string, tc *tokens.TokenCount) (*output.StreamingMessage, error)
- func (t *AuditQueryGenerationTool) Name() string
- func (t *AuditQueryGenerationTool) Run(_ context.Context, _ *ToolContext, _ string) (string, error)
- type CommandExecutionTool
- type CommandGenerationTool
- type CommandGenerationToolInput
- type EmbeddingRetrievalTool
- type EmbeddingRetrievalToolInput
- type NodeWatcher
- type Tool
- type ToolContext
Constants ¶
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) Name() string
func (*AccessRequestCreateTool) ParseInput ¶
func (*AccessRequestCreateTool) ParseInput(input string) (*modeloutput.AccessRequest, error)
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) Description() string
func (*AccessRequestListRequestableResourcesTool) Name ¶
func (*AccessRequestListRequestableResourcesTool) Name() string
func (*AccessRequestListRequestableResourcesTool) Run ¶
func (a *AccessRequestListRequestableResourcesTool) Run(ctx context.Context, toolCtx *ToolContext, input string) (string, error)
type AccessRequestListRequestableRolesTool ¶
type AccessRequestListRequestableRolesTool struct{}
func (*AccessRequestListRequestableRolesTool) Description ¶
func (*AccessRequestListRequestableRolesTool) Description() string
func (*AccessRequestListRequestableRolesTool) Name ¶
func (*AccessRequestListRequestableRolesTool) Name() string
func (*AccessRequestListRequestableRolesTool) Run ¶
func (a *AccessRequestListRequestableRolesTool) Run(ctx context.Context, toolCtx *ToolContext, input string) (string, error)
type AccessRequestsListTool ¶
type AccessRequestsListTool struct{}
func (*AccessRequestsListTool) Description ¶
func (*AccessRequestsListTool) Description() string
func (*AccessRequestsListTool) Name ¶
func (*AccessRequestsListTool) Name() string
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 ¶
func (t *AuditQueryGenerationTool) Run(_ context.Context, _ *ToolContext, _ string) (string, error)
type CommandExecutionTool ¶
type CommandExecutionTool struct{}
func (*CommandExecutionTool) Description ¶
func (c *CommandExecutionTool) Description() string
func (*CommandExecutionTool) Name ¶
func (c *CommandExecutionTool) Name() string
func (*CommandExecutionTool) ParseInput ¶
func (*CommandExecutionTool) ParseInput(input string) (*modeloutput.CompletionCommand, error)
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 ¶
func (c *CommandExecutionTool) Run(_ context.Context, _ *ToolContext, _ string) (string, error)
type CommandGenerationTool ¶
type CommandGenerationTool struct{}
func (*CommandGenerationTool) Description ¶
func (c *CommandGenerationTool) Description() string
func (*CommandGenerationTool) Name ¶
func (c *CommandGenerationTool) Name() string
func (*CommandGenerationTool) ParseInput ¶
func (*CommandGenerationTool) ParseInput(input string) (*CommandGenerationToolInput, error)
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 ¶
func (c *CommandGenerationTool) Run(_ context.Context, toolCtx *ToolContext, _ string) (string, error)
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.