Documentation
¶
Index ¶
- type AnthropicClient
- type CerebrasChoice
- type CerebrasClient
- type CerebrasJsonSchema
- type CerebrasMessage
- type CerebrasRequest
- type CerebrasResponse
- type CerebrasResponseFormat
- type CerebrasUsage
- type Client
- func CreateAIClient(cfg *config.Config) (Client[IssueResponse], error)
- func NewAnthropicClient[R any](config *Config) (Client[R], error)
- func NewCerebrasClient[R any](config *Config) (Client[R], error)
- func NewGeminiClient[R any](config *Config) (Client[R], error)
- func NewOllamaClient[R any](config *Config) (Client[R], error)
- func NewOpenAIClient[R any](config *Config) (Client[R], error)
- type Config
- type GeminiClient
- type IssueResponse
- type OllamaClient
- type OpenAIClient
- type Provider
- type ProviderDefaults
- type Request
- type SemanticIssue
- type Usage
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AnthropicClient ¶
type AnthropicClient[R any] struct { // contains filtered or unexported fields }
AnthropicClient implements the Client interface for Anthropic API
func (*AnthropicClient[R]) Name ¶
func (c *AnthropicClient[R]) Name() string
Name returns the provider name
func (*AnthropicClient[R]) Validate ¶
func (c *AnthropicClient[R]) Validate() error
Validate checks if the client configuration is valid
type CerebrasChoice ¶
type CerebrasChoice struct {
Message struct {
Role string `json:"role"`
Content string `json:"content"`
} `json:"message"`
}
CerebrasChoice represents a choice in the API response
type CerebrasClient ¶
type CerebrasClient[R any] struct { // contains filtered or unexported fields }
CerebrasClient implements the Client interface for Cerebras API
func (*CerebrasClient[R]) Name ¶
func (c *CerebrasClient[R]) Name() string
Name returns the provider name
func (*CerebrasClient[R]) Validate ¶
func (c *CerebrasClient[R]) Validate() error
Validate checks if the client configuration is valid
type CerebrasJsonSchema ¶
type CerebrasMessage ¶
CerebrasMessage represents a message in the chat completion request
type CerebrasRequest ¶
type CerebrasRequest struct {
Model string `json:"model"`
Messages []CerebrasMessage `json:"messages"`
Temperature *float64 `json:"temperature,omitempty"`
MaxTokens *int `json:"max_completion_tokens,omitempty"`
ResponseFormat *CerebrasResponseFormat `json:"response_format,omitempty"`
}
CerebrasRequest represents the request payload for Cerebras API
type CerebrasResponse ¶
type CerebrasResponse struct {
ID string `json:"id"`
Choices []CerebrasChoice `json:"choices"`
Usage CerebrasUsage `json:"usage"`
Created int64 `json:"created"`
Model string `json:"model"`
}
CerebrasResponse represents the response from Cerebras API
type CerebrasResponseFormat ¶
type CerebrasResponseFormat struct {
Type string `json:"type"`
JsonSchema CerebrasJsonSchema `json:"json_schema"`
}
type CerebrasUsage ¶
type CerebrasUsage struct {
PromptTokens int `json:"prompt_tokens"`
CompletionTokens int `json:"completion_tokens"`
TotalTokens int `json:"total_tokens"`
}
CerebrasUsage represents token usage in the API response
type Client ¶
type Client[R any] interface { // Complete sends a completion request to the AI provider Complete(ctx context.Context, req *Request) (*R, Usage, error) // Name returns the name of the provider Name() string // Validate checks if the client configuration is valid Validate() error }
Client defines the generic interface for AI providers
func CreateAIClient ¶
func CreateAIClient(cfg *config.Config) (Client[IssueResponse], error)
func NewAnthropicClient ¶
NewAnthropicClient creates a new Anthropic client
func NewCerebrasClient ¶
NewCerebrasClient creates a new Cerebras client
func NewGeminiClient ¶
NewGeminiClient creates a new Gemini client
func NewOllamaClient ¶
NewOllamaClient creates a new Ollama client
type Config ¶
type Config struct {
Provider Provider
Model string
APIKey string
BaseURL string
Temperature float64
MaxTokens int
}
Config holds common configuration for AI providers
type GeminiClient ¶
type GeminiClient[R any] struct { // contains filtered or unexported fields }
GeminiClient implements the Client interface for Google Gemini API
func (*GeminiClient[R]) Name ¶
func (c *GeminiClient[R]) Name() string
Name returns the provider name
func (*GeminiClient[R]) Validate ¶
func (c *GeminiClient[R]) Validate() error
Validate checks if the client configuration is valid
type IssueResponse ¶
type IssueResponse struct {
Issues []SemanticIssue
}
IssueResponse represents the response from an AI provider for semantic issues
type OllamaClient ¶
type OllamaClient[R any] struct { // contains filtered or unexported fields }
func (*OllamaClient[R]) Name ¶
func (c *OllamaClient[R]) Name() string
Name returns the provider name
func (*OllamaClient[R]) Validate ¶
func (c *OllamaClient[R]) Validate() error
Validate checks if the client configuration is valid
type OpenAIClient ¶
type OpenAIClient[R any] struct { // contains filtered or unexported fields }
OpenAIClient implements the Client interface for OpenAI API
func (*OpenAIClient[R]) Name ¶
func (c *OpenAIClient[R]) Name() string
Name returns the provider name
func (*OpenAIClient[R]) Validate ¶
func (c *OpenAIClient[R]) Validate() error
Validate checks if the client configuration is valid
type Provider ¶
type Provider string
func GetAllProviders ¶
func GetAllProviders() []Provider
func ToProvider ¶
type ProviderDefaults ¶
func GetProviderDefaults ¶
func GetProviderDefaults(provider Provider) ProviderDefaults
type SemanticIssue ¶
type SemanticIssue struct {
Reasoning string `json:"reasoning" jsonschema_description:"Reasoning why the found issue has it's severity level"`
Level string `json:"level" jsonschema_description:"Severity level of the issue"`
Message string `json:"message" jsonschema_description:"Description of the issue"`
Suggestion string `json:"suggestion" jsonschema_description:"Suggestion for fixing the issue (optional)"`
File string `json:"file" jsonschema_description:"The file that the issue is in"`
}
SemanticIssue represents a single issue found during semantic analysis