agents

package
v0.0.17 Latest Latest
Warning

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

Go to latest
Published: Jun 10, 2026 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Overview

nolint:lll

nolint:lll

Index

Constants

View Source
const LocationDeterminationSystemPrompt = `` /* 933-byte string literal not displayed */
View Source
const LocationDeterminationUserPrompt = `` /* 734-byte string literal not displayed */
View Source
const VerificationSystemPrompt = `` /* 1592-byte string literal not displayed */
View Source
const VerificationUserPrompt = `` /* 1249-byte string literal not displayed */

Variables

View Source
var EmbeddedAgentRules embed.FS

Functions

func LoadLocalRules added in v0.0.10

func LoadLocalRules() ([]api.AiPrompt, error)

LoadLocalRules returns one api.AiPrompt per embedded *.md file in this package. The filename (without extension) is converted to a rule ID by replacing the first dash with a slash: "datadog-go-sqli.md" -> "datadog/go-sqli". When the language token in the filename maps to a known glob, the rule is scoped to that language; otherwise it falls back to "**/*".

Types

type AgentOption

type AgentOption struct {
	DetectionModel    model.Model
	ValidationModel   model.Model
	OpenAiBaseUrl     string
	RequestTimeoutSec int
	IsAIGateway       bool
	AIGuardEnabled    bool
	OrgID             int64
	// Temporary to avoid larger refactor: this should be handled with log levels, not booleans
	DebugEnabled bool
}

type DetectionAgent

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

func NewDetectionAgent

func NewDetectionAgent(ctx context.Context, agentOption *AgentOption) (*DetectionAgent, error)

func (*DetectionAgent) Detect

func (agent *DetectionAgent) Detect(ctx context.Context, scanData *model.ScanData) (*DetectionResult, error)

func (*DetectionAgent) DetermineViolationLocation added in v0.0.7

func (agent *DetectionAgent) DetermineViolationLocation(ctx context.Context, scanData *model.ScanData,
	violation model.LLMResultViolation, verification *VerificationResult) (*LocationDeterminationResult, error)

func (*DetectionAgent) VerifyViolation

func (agent *DetectionAgent) VerifyViolation(ctx context.Context, scanData *model.ScanData,
	violation model.LLMResultViolation) (*VerificationResult, error)

type DetectionResult

type DetectionResult struct {
	Violations   []model.Violation
	Path         string
	InputTokens  int32
	OutputTokens int32
}

type LocationDeterminationResult added in v0.0.7

type LocationDeterminationResult struct {
	LocationDeterminationResultData
	InputTokens  int32
	OutputTokens int32
}

type LocationDeterminationResultData added in v0.0.7

type LocationDeterminationResultData struct {
	StartLine   uint `json:"startLine"`
	StartColumn uint `json:"startColumn"`
	EndLine     uint `json:"endLine"`
	EndColumn   uint `json:"endColumn"`
}

type VerificationResult

type VerificationResult struct {
	VerificationResultData
	InputTokens  int32 `json:"input_tokens"`
	OutputTokens int32 `json:"output_tokens"`
}

type VerificationResultData

type VerificationResultData struct {
	Confirmed  bool   `json:"confirmed"`
	Confidence string `json:"confidence"`
	Reason     string `json:"reason"`
}

type VerificationResultInternal

type VerificationResultInternal struct {
	Confirmed    bool
	Confidence   string // "high", "low"
	Reason       string
	InputTokens  int32
	OutputTokens int32
}

Jump to

Keyboard shortcuts

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