Documentation
¶
Index ¶
- Variables
- func DefaultTemplatesDir() string
- type Config
- type PromptError
- type PromptTemplate
- type PromptTemplateManager
- func (m *PromptTemplateManager) AddTemplate(template PromptTemplate) error
- func (m *PromptTemplateManager) BuildPrompt(template PromptTemplate, content string, variables map[string]string) string
- func (m *PromptTemplateManager) GetTemplate(name string) (PromptTemplate, bool)
- func (m *PromptTemplateManager) GetTemplateForIntent(intent string) PromptTemplate
- func (m *PromptTemplateManager) ListTemplates() []PromptTemplate
- func (m *PromptTemplateManager) RemoveTemplate(name string) error
- type Provider
- type Summarizer
- func (s *Summarizer) GetModel() string
- func (s *Summarizer) GetProvider() Provider
- func (s *Summarizer) IsAvailable() bool
- func (s *Summarizer) ListModels() ([]string, error)
- func (s *Summarizer) StreamSummary(req SummaryRequest, callback func(string)) (*SummaryResponse, error)
- func (s *Summarizer) Summarize(req SummaryRequest) (*SummaryResponse, error)
- type SummaryRequest
- type SummaryResponse
Constants ¶
This section is empty.
Variables ¶
var ( ErrTemplateNameRequired = &PromptError{Msg: "template name is required"} ErrPromptRequired = &PromptError{Msg: "user prompt is required"} ErrCannotRemoveBuiltin = &PromptError{Msg: "cannot remove built-in template"} )
Custom error types
Functions ¶
func DefaultTemplatesDir ¶
func DefaultTemplatesDir() string
DefaultTemplatesDir returns the default templates directory
Types ¶
type Config ¶
type Config struct {
Provider Provider
Model string
BaseURL string
Timeout time.Duration
MaxRetries int
}
Config holds summarizer configuration
type PromptError ¶
type PromptError struct {
Msg string
}
PromptError represents a prompt template error
func (*PromptError) Error ¶
func (e *PromptError) Error() string
type PromptTemplate ¶
type PromptTemplate struct {
Name string `json:"name"`
Description string `json:"description"`
SystemPrompt string `json:"system_prompt"`
UserPrompt string `json:"user_prompt"`
Intent string `json:"intent"` // debug, review, test, build, general
Variables map[string]string `json:"variables"` // Custom variables for template
MaxTokens int `json:"max_tokens"`
Temperature float64 `json:"temperature"`
}
PromptTemplate represents a custom prompt template for LLM summarization
func CreateCustomTemplate ¶
func CreateCustomTemplate(name, description, systemPrompt, userPrompt, intent string) PromptTemplate
CreateCustomTemplate creates a new custom template from scratch
type PromptTemplateManager ¶
type PromptTemplateManager struct {
// contains filtered or unexported fields
}
PromptTemplateManager manages custom prompt templates
func NewPromptTemplateManager ¶
func NewPromptTemplateManager(templatesDir string) *PromptTemplateManager
NewPromptTemplateManager creates a new template manager
func (*PromptTemplateManager) AddTemplate ¶
func (m *PromptTemplateManager) AddTemplate(template PromptTemplate) error
AddTemplate adds or updates a custom template
func (*PromptTemplateManager) BuildPrompt ¶
func (m *PromptTemplateManager) BuildPrompt(template PromptTemplate, content string, variables map[string]string) string
BuildPrompt creates a complete prompt from a template
func (*PromptTemplateManager) GetTemplate ¶
func (m *PromptTemplateManager) GetTemplate(name string) (PromptTemplate, bool)
GetTemplate retrieves a template by name
func (*PromptTemplateManager) GetTemplateForIntent ¶
func (m *PromptTemplateManager) GetTemplateForIntent(intent string) PromptTemplate
GetTemplateForIntent retrieves a template matching an intent
func (*PromptTemplateManager) ListTemplates ¶
func (m *PromptTemplateManager) ListTemplates() []PromptTemplate
ListTemplates returns all available template names
func (*PromptTemplateManager) RemoveTemplate ¶
func (m *PromptTemplateManager) RemoveTemplate(name string) error
RemoveTemplate removes a custom template
type Summarizer ¶
type Summarizer struct {
// contains filtered or unexported fields
}
Summarizer provides LLM-powered summarization capabilities. Supports multiple backends: Ollama, LM Studio, and other OpenAI-compatible APIs.
func NewSummarizer ¶
func NewSummarizer(cfg Config) *Summarizer
NewSummarizer creates a new LLM summarizer
func NewSummarizerFromEnv ¶
func NewSummarizerFromEnv() *Summarizer
NewSummarizerFromEnv creates a summarizer from environment variables
func (*Summarizer) GetModel ¶
func (s *Summarizer) GetModel() string
GetModel returns the current model name
func (*Summarizer) GetProvider ¶
func (s *Summarizer) GetProvider() Provider
GetProvider returns the current provider
func (*Summarizer) IsAvailable ¶
func (s *Summarizer) IsAvailable() bool
IsAvailable returns true if an LLM provider is available
func (*Summarizer) ListModels ¶
func (s *Summarizer) ListModels() ([]string, error)
ListModels returns available models for the provider
func (*Summarizer) StreamSummary ¶
func (s *Summarizer) StreamSummary(req SummaryRequest, callback func(string)) (*SummaryResponse, error)
StreamSummary generates a summary with streaming output
func (*Summarizer) Summarize ¶
func (s *Summarizer) Summarize(req SummaryRequest) (*SummaryResponse, error)
Summarize generates a summary of the content
type SummaryRequest ¶
type SummaryRequest struct {
Content string
MaxTokens int
Intent string // "debug", "review", "search", etc.
}
SummaryRequest represents a summarization request