Documentation
¶
Index ¶
- func GetAvailableModels(provider Provider) []string
- func GetDefaultModel(provider Provider) string
- func GetSupportedProviders() []string
- func ValidateProvider(provider string) error
- type AISummary
- type Analyzer
- type ClaudeClient
- type Client
- type Config
- type EnhancedFinding
- type GeminiClient
- type GrokClient
- type OpenAIClient
- type PerplexityClient
- type Provider
- type VerificationResult
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetAvailableModels ¶
GetAvailableModels returns a list of available models for a given provider
func GetDefaultModel ¶
GetDefaultModel returns the default model for a given provider
func GetSupportedProviders ¶
func GetSupportedProviders() []string
GetSupportedProviders returns a list of supported AI providers
func ValidateProvider ¶
ValidateProvider checks if the provider is supported
Types ¶
type AISummary ¶
type AISummary struct {
TotalAnalyzed int `json:"total_analyzed"`
SuccessfullyAnalyzed int `json:"successfully_analyzed"`
AnalysisErrors int `json:"analysis_errors"`
LikelyFalsePositives int `json:"likely_false_positives"`
LikelyTruePositives int `json:"likely_true_positives"`
HighConfidence int `json:"high_confidence"` // >= 0.8
MediumConfidence int `json:"medium_confidence"` // >= 0.6 && < 0.8
LowConfidence int `json:"low_confidence"` // < 0.6
}
AISummary provides statistics about AI analysis results
func GetSummary ¶
func GetSummary(enhancedFindings []EnhancedFinding) AISummary
GetSummary returns a summary of AI analysis results
type Analyzer ¶
type Analyzer struct {
// contains filtered or unexported fields
}
Analyzer handles AI-powered analysis of findings
func NewAnalyzer ¶
NewAnalyzer creates a new AI analyzer
func (*Analyzer) AnalyzeFindings ¶
func (a *Analyzer) AnalyzeFindings(ctx context.Context, findings []rules.Finding) ([]EnhancedFinding, error)
AnalyzeFindings analyzes multiple findings using AI
func (*Analyzer) AnalyzeSingleFinding ¶
func (a *Analyzer) AnalyzeSingleFinding(ctx context.Context, finding rules.Finding) (*EnhancedFinding, error)
AnalyzeSingleFinding analyzes a single finding using AI
type ClaudeClient ¶
type ClaudeClient struct {
// contains filtered or unexported fields
}
ClaudeClient implements the Client interface for Anthropic Claude API
func NewClaudeClient ¶
func NewClaudeClient(config Config) (*ClaudeClient, error)
NewClaudeClient creates a new Claude client
func (*ClaudeClient) GetProvider ¶
func (c *ClaudeClient) GetProvider() Provider
GetProvider returns the provider name
func (*ClaudeClient) VerifyFinding ¶
func (c *ClaudeClient) VerifyFinding(ctx context.Context, finding rules.Finding) (*VerificationResult, error)
VerifyFinding analyzes a finding using Claude
type Client ¶
type Client interface {
// VerifyFinding analyzes a security finding and determines if it's likely a false positive
VerifyFinding(ctx context.Context, finding rules.Finding) (*VerificationResult, error)
// GetProvider returns the provider name
GetProvider() Provider
// Close cleans up any resources
Close() error
}
Client interface for AI providers
type Config ¶
type Config struct {
Provider Provider `yaml:"provider"`
APIKey string `yaml:"api_key"`
BaseURL string `yaml:"base_url,omitempty"` // Custom endpoint for self-hosted models
Model string `yaml:"model,omitempty"` // Specific model to use
// Request configuration
MaxTokens int `yaml:"max_tokens,omitempty"`
Temperature float64 `yaml:"temperature,omitempty"`
Timeout int `yaml:"timeout,omitempty"` // seconds
}
Config holds configuration for AI clients
type EnhancedFinding ¶
type EnhancedFinding struct {
rules.Finding
AIVerification *VerificationResult `json:"ai_verification,omitempty"`
AIError string `json:"ai_error,omitempty"`
}
EnhancedFinding represents a finding enhanced with AI verification
type GeminiClient ¶
type GeminiClient struct {
// contains filtered or unexported fields
}
GeminiClient implements the Client interface for Google Gemini API
func NewGeminiClient ¶
func NewGeminiClient(config Config) (*GeminiClient, error)
NewGeminiClient creates a new Gemini client
func (*GeminiClient) GetProvider ¶
func (c *GeminiClient) GetProvider() Provider
GetProvider returns the provider name
func (*GeminiClient) VerifyFinding ¶
func (c *GeminiClient) VerifyFinding(ctx context.Context, finding rules.Finding) (*VerificationResult, error)
VerifyFinding analyzes a finding using Gemini
type GrokClient ¶
type GrokClient struct {
// contains filtered or unexported fields
}
GrokClient implements the Client interface for xAI Grok API
func NewGrokClient ¶
func NewGrokClient(config Config) (*GrokClient, error)
NewGrokClient creates a new Grok client
func (*GrokClient) GetProvider ¶
func (c *GrokClient) GetProvider() Provider
GetProvider returns the provider name
func (*GrokClient) VerifyFinding ¶
func (c *GrokClient) VerifyFinding(ctx context.Context, finding rules.Finding) (*VerificationResult, error)
VerifyFinding analyzes a finding using Grok
type OpenAIClient ¶
type OpenAIClient struct {
// contains filtered or unexported fields
}
OpenAIClient implements the Client interface for OpenAI API
func NewOpenAIClient ¶
func NewOpenAIClient(config Config) (*OpenAIClient, error)
NewOpenAIClient creates a new OpenAI client
func (*OpenAIClient) GetProvider ¶
func (c *OpenAIClient) GetProvider() Provider
GetProvider returns the provider name
func (*OpenAIClient) VerifyFinding ¶
func (c *OpenAIClient) VerifyFinding(ctx context.Context, finding rules.Finding) (*VerificationResult, error)
VerifyFinding analyzes a finding using OpenAI
type PerplexityClient ¶
type PerplexityClient struct {
// contains filtered or unexported fields
}
PerplexityClient implements the Client interface for Perplexity AI API
func NewPerplexityClient ¶
func NewPerplexityClient(config Config) (*PerplexityClient, error)
NewPerplexityClient creates a new Perplexity client
func (*PerplexityClient) GetProvider ¶
func (c *PerplexityClient) GetProvider() Provider
GetProvider returns the provider name
func (*PerplexityClient) VerifyFinding ¶
func (c *PerplexityClient) VerifyFinding(ctx context.Context, finding rules.Finding) (*VerificationResult, error)
VerifyFinding analyzes a finding using Perplexity
type VerificationResult ¶
type VerificationResult struct {
IsLikelyFalsePositive bool `json:"is_likely_false_positive"`
Confidence float64 `json:"confidence"` // 0.0 to 1.0
Reasoning string `json:"reasoning"`
Severity string `json:"suggested_severity,omitempty"`
}
VerificationResult represents the AI's assessment of a finding