tuning

package
v0.15.1 Latest Latest
Warning

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

Go to latest
Published: Feb 9, 2026 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package tuning provides AI tuning capabilities for the platform.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildSystemPrompt

func BuildSystemPrompt(prefix, instructions, suffix string) string

BuildSystemPrompt builds a system prompt for a persona.

func DefaultHints

func DefaultHints() map[string]string

DefaultHints returns default hints for common tools.

Types

type HintManager

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

HintManager manages tool hints.

func NewHintManager

func NewHintManager() *HintManager

NewHintManager creates a new hint manager.

func (*HintManager) All

func (m *HintManager) All() map[string]string

All returns all hints.

func (*HintManager) GetHint

func (m *HintManager) GetHint(toolName string) (string, bool)

GetHint gets a hint for a tool.

func (*HintManager) SetHint

func (m *HintManager) SetHint(toolName, hint string)

SetHint sets a hint for a tool.

func (*HintManager) SetHints

func (m *HintManager) SetHints(hints map[string]string)

SetHints sets multiple hints at once.

type PromptConfig

type PromptConfig struct {
	PromptsDir string
}

PromptConfig configures prompt management.

type PromptManager

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

PromptManager manages prompt resources.

func NewPromptManager

func NewPromptManager(cfg PromptConfig) *PromptManager

NewPromptManager creates a new prompt manager.

func (*PromptManager) All

func (m *PromptManager) All() map[string]string

All returns all prompts.

func (*PromptManager) Get

func (m *PromptManager) Get(name string) (string, bool)

Get retrieves a prompt by name.

func (*PromptManager) LoadPrompts

func (m *PromptManager) LoadPrompts() error

LoadPrompts loads prompts from the configured directory.

func (*PromptManager) Set

func (m *PromptManager) Set(name, content string)

Set sets a prompt.

type QueryMetadata

type QueryMetadata struct {
	QualityScore    *float64
	IsDeprecated    bool
	DeprecationNote string
	ContainsPII     bool
	RowCount        *int64
}

QueryMetadata provides context for rule evaluation.

type RuleEngine

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

RuleEngine evaluates rules against actions.

func NewRuleEngine

func NewRuleEngine(rules *Rules) *RuleEngine

NewRuleEngine creates a new rule engine.

func (*RuleEngine) CheckQueryExecution

func (e *RuleEngine) CheckQueryExecution(metadata QueryMetadata) []Violation

CheckQueryExecution checks rules for query execution.

func (*RuleEngine) GetCustomRule

func (e *RuleEngine) GetCustomRule(name string) (any, bool)

GetCustomRule retrieves a custom rule value.

func (*RuleEngine) GetMaxQueryLimit

func (e *RuleEngine) GetMaxQueryLimit() int

GetMaxQueryLimit returns the maximum query limit.

func (*RuleEngine) ShouldRequireDataHubCheck

func (e *RuleEngine) ShouldRequireDataHubCheck() bool

ShouldRequireDataHubCheck returns whether DataHub check is required.

type Rules

type Rules struct {
	// RequireDataHubCheck requires checking DataHub before writing queries.
	RequireDataHubCheck bool `yaml:"require_datahub_check"`

	// WarnOnDeprecated warns when accessing deprecated entities.
	WarnOnDeprecated bool `yaml:"warn_on_deprecated"`

	// QualityThreshold is the minimum quality score for data access.
	QualityThreshold float64 `yaml:"quality_threshold"`

	// MaxQueryLimit is the maximum number of rows a query can return.
	MaxQueryLimit int `yaml:"max_query_limit"`

	// RequirePIIAcknowledgment requires acknowledgment when accessing PII data.
	RequirePIIAcknowledgment bool `yaml:"require_pii_acknowledgment"`

	// Custom rules
	Custom map[string]any `yaml:"custom,omitempty"`
}

Rules defines operational rules for the platform.

func DefaultRules

func DefaultRules() *Rules

DefaultRules returns sensible default rules.

type Severity

type Severity string

Severity indicates the severity of a violation.

const (
	SeverityInfo    Severity = "info"
	SeverityWarning Severity = "warning"
	SeverityError   Severity = "error"
)

Severity levels for operational rules.

type Violation

type Violation struct {
	Rule       string
	Severity   Severity
	Message    string
	Suggestion string
}

Violation represents a rule violation.

Jump to

Keyboard shortcuts

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