Documentation
¶
Index ¶
- type Config
- type Embedder
- type ErrorCategory
- type FeedbackRating
- type FeedbackRequest
- type QdrantClient
- type QdrantCondition
- type QdrantFilter
- type QdrantPoint
- type QdrantRangeCondition
- type QdrantScoredPoint
- type RecordRequest
- type Remediation
- type Scope
- type ScoredRemediation
- type SearchRequest
- type Service
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
// CollectionPrefix is the prefix for remediation collections (default: remediations)
CollectionPrefix string
// VectorSize is the dimension of embedding vectors (default: 1536)
VectorSize uint64
// DefaultConfidence is the initial confidence for new remediations (default: 0.5)
DefaultConfidence float64
// FeedbackDelta is how much feedback changes confidence (default: 0.1)
FeedbackDelta float64
// MinConfidence is the minimum confidence threshold (default: 0.1)
MinConfidence float64
// MaxConfidence is the maximum confidence (default: 1.0)
MaxConfidence float64
}
Config configures the remediation service.
func DefaultServiceConfig ¶
func DefaultServiceConfig() *Config
DefaultServiceConfig returns sensible defaults.
type Embedder ¶
type Embedder interface {
// Embed generates an embedding vector for the given text.
Embed(ctx context.Context, text string) ([]float32, error)
// EmbedBatch generates embeddings for multiple texts.
EmbedBatch(ctx context.Context, texts []string) ([][]float32, error)
// Dimension returns the dimensionality of the embedding vectors.
Dimension() int
}
Embedder generates embeddings for text. This interface will be implemented by the memory/embeddings package. TODO: Move this to a shared package once internal/embeddings is ported.
type ErrorCategory ¶
type ErrorCategory string
ErrorCategory represents the category of error.
const ( // ErrorCompile represents compile-time errors. ErrorCompile ErrorCategory = "compile" // ErrorRuntime represents runtime errors. ErrorRuntime ErrorCategory = "runtime" // ErrorTest represents test failures. ErrorTest ErrorCategory = "test" // ErrorLint represents linter errors. ErrorLint ErrorCategory = "lint" // ErrorSecurity represents security vulnerabilities. ErrorSecurity ErrorCategory = "security" // ErrorPerformance represents performance issues. ErrorPerformance ErrorCategory = "performance" // ErrorOther represents other errors. ErrorOther ErrorCategory = "other" )
type FeedbackRating ¶
type FeedbackRating string
FeedbackRating represents a feedback rating.
const ( // RatingHelpful indicates the remediation was helpful. RatingHelpful FeedbackRating = "helpful" // RatingNotHelpful indicates the remediation was not helpful. RatingNotHelpful FeedbackRating = "not_helpful" // RatingOutdated indicates the remediation is outdated. RatingOutdated FeedbackRating = "outdated" )
type FeedbackRequest ¶
type FeedbackRequest struct {
RemediationID string
TenantID string
Rating FeedbackRating
SessionID string
Comment string
}
FeedbackRequest represents parameters for providing feedback on a remediation.
type QdrantClient ¶
type QdrantClient interface {
// Collection operations
CreateCollection(ctx context.Context, name string, vectorSize uint64) error
DeleteCollection(ctx context.Context, name string) error
CollectionExists(ctx context.Context, name string) (bool, error)
ListCollections(ctx context.Context) ([]string, error)
// Point operations
Upsert(ctx context.Context, collection string, points []*QdrantPoint) error
Search(ctx context.Context, collection string, vector []float32, limit uint64, filter *QdrantFilter) ([]*QdrantScoredPoint, error)
Get(ctx context.Context, collection string, ids []string) ([]*QdrantPoint, error)
Delete(ctx context.Context, collection string, ids []string) error
// Health
Health(ctx context.Context) error
// Close closes the client connection
Close() error
}
QdrantClient provides a unified interface to Qdrant vector database. This interface will be implemented by the vectorstore package. TODO: Move this to internal/vectorstore once that package is ported.
type QdrantCondition ¶
type QdrantCondition struct {
Field string
Match interface{}
Range *QdrantRangeCondition
}
QdrantCondition represents a single filter condition.
type QdrantFilter ¶
type QdrantFilter struct {
Must []QdrantCondition
Should []QdrantCondition
MustNot []QdrantCondition
}
QdrantFilter represents a filter for Qdrant queries.
type QdrantPoint ¶
QdrantPoint represents a vector point in Qdrant.
type QdrantRangeCondition ¶
QdrantRangeCondition represents a range filter.
type QdrantScoredPoint ¶
type QdrantScoredPoint struct {
QdrantPoint
Score float32
}
QdrantScoredPoint represents a search result with score.
type RecordRequest ¶
type RecordRequest struct {
Title string
Problem string
Symptoms []string
RootCause string
Solution string
CodeDiff string
AffectedFiles []string
Category ErrorCategory
Tags []string
Scope Scope
TenantID string
TeamID string
ProjectPath string
SessionID string
Confidence float64 // Initial confidence (default: 0.5)
}
RecordRequest represents parameters for recording a remediation.
type Remediation ¶
type Remediation struct {
// ID is the unique identifier for this remediation.
ID string `json:"id"`
// Title is a short title for the remediation.
Title string `json:"title"`
// Problem is a description of the error or issue.
Problem string `json:"problem"`
// Symptoms are observable symptoms of this error.
Symptoms []string `json:"symptoms"`
// RootCause is the underlying cause of the error.
RootCause string `json:"root_cause"`
// Solution is the fix that resolved the error.
Solution string `json:"solution"`
// CodeDiff is an optional code diff showing the fix.
CodeDiff string `json:"code_diff,omitempty"`
// AffectedFiles are files that were changed.
AffectedFiles []string `json:"affected_files,omitempty"`
// Category is the error category.
Category ErrorCategory `json:"category"`
// Confidence is the current confidence score (0.0 - 1.0).
Confidence float64 `json:"confidence"`
// UsageCount is how many times this remediation has been retrieved.
UsageCount int64 `json:"usage_count"`
// Tags are labels for categorization and filtering.
Tags []string `json:"tags"`
// Scope determines visibility (project, team, org).
Scope Scope `json:"scope"`
// TenantID is the organization this remediation belongs to.
TenantID string `json:"tenant_id"`
// TeamID is the team this remediation belongs to (for team scope).
TeamID string `json:"team_id,omitempty"`
// ProjectPath is the project this remediation belongs to (for project scope).
ProjectPath string `json:"project_path,omitempty"`
// SessionID is the session this remediation was extracted from.
SessionID string `json:"session_id,omitempty"`
// CreatedAt is when this remediation was created.
CreatedAt time.Time `json:"created_at"`
// UpdatedAt is when this remediation was last updated.
UpdatedAt time.Time `json:"updated_at"`
// Vector is the embedding vector for semantic search.
Vector []float32 `json:"-"`
}
Remediation represents a stored error fix pattern.
type ScoredRemediation ¶
type ScoredRemediation struct {
Remediation
Score float64 `json:"score"`
}
ScoredRemediation is a remediation with a similarity score.
type SearchRequest ¶
type SearchRequest struct {
// Query is the error message or description to search for.
Query string
// Vector is an optional pre-computed embedding vector.
Vector []float32
// Limit is the maximum number of results to return.
Limit int
// MinConfidence is the minimum confidence threshold.
MinConfidence float64
// Category filters by error category (optional).
Category ErrorCategory
// Scope filters by scope (optional, searches all if empty).
Scope Scope
// TenantID is required for multi-tenant isolation.
TenantID string
// TeamID filters to a specific team (optional).
TeamID string
// ProjectPath filters to a specific project (optional).
ProjectPath string
// Tags filters by tags (optional, any match).
Tags []string
// IncludeHierarchy includes parent scopes in search.
// If searching project scope, also searches team and org.
IncludeHierarchy bool
}
SearchRequest represents parameters for remediation search.
type Service ¶
type Service interface {
// Search finds remediations by semantic similarity to error message/pattern.
Search(ctx context.Context, req *SearchRequest) ([]*ScoredRemediation, error)
// Record creates a new remediation.
Record(ctx context.Context, req *RecordRequest) (*Remediation, error)
// Get retrieves a remediation by ID.
Get(ctx context.Context, tenantID, remediationID string) (*Remediation, error)
// Feedback records feedback on a remediation, adjusting confidence.
Feedback(ctx context.Context, req *FeedbackRequest) error
// Delete removes a remediation.
Delete(ctx context.Context, tenantID, remediationID string) error
// Close closes the service.
Close() error
}
Service provides remediation management operations.
func NewService ¶
NewService creates a new remediation service.
func NewServiceWithStoreProvider ¶ added in v0.3.0
func NewServiceWithStoreProvider(cfg *Config, stores vectorstore.StoreProvider, logger *zap.Logger) (Service, error)
NewServiceWithStoreProvider creates a remediation service using StoreProvider for database-per-scope isolation.
With StoreProvider, each scope level (org, team, project) gets its own chromem.DB instance at a unique filesystem path, providing physical isolation.
The collection naming within each store is simplified to just "remediations" since isolation is handled at the store/directory level.