Documentation
¶
Overview ¶
Package ai provides the AI service layer for content drafting, summarisation, and semantic search. Every method returns nil when AI is unconfigured.
Index ¶
- func PRDescriptionPrompt(diff, specContext, stackPosition string) string
- func PRStackPrompt(solution, architectureNotes string, repos []string) string
- func SectionDraftPrompt(sectionSlug string, existingContext map[string]string) string
- func TriageSummarisePrompt(sourceContent string) string
- type ReviewResult
- type Service
- func (s *Service) Draft(ctx context.Context, prompt string, contextParts ...string) (string, error)
- func (s *Service) Embed(ctx context.Context, text string) ([]float32, error)
- func (s *Service) IsAvailable() bool
- func (s *Service) Summarise(ctx context.Context, text string, maxLength int) (string, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func PRDescriptionPrompt ¶
PRDescriptionPrompt generates a prompt for drafting a PR description.
func PRStackPrompt ¶
PRStackPrompt generates a prompt for proposing a PR stack plan.
func SectionDraftPrompt ¶
SectionDraftPrompt generates a prompt for drafting a spec section.
func TriageSummarisePrompt ¶
TriageSummarisePrompt generates a prompt for summarising a triage source.
Types ¶
type ReviewResult ¶
type ReviewResult struct {
Action string // "accept", "edit", "skip"
Content string // the final content (after edit if applicable)
}
ReviewResult represents the outcome of the accept/edit/skip flow.
func PresentDraft ¶
func PresentDraft(sectionName, draft, editor string) (*ReviewResult, error)
PresentDraft presents an AI draft to the user for accept/edit/skip. This is the standard interaction model for all AI-generated content.
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service wraps an AIAdapter with null-safe semantics. Every method returns empty/nil when the adapter is nil or unconfigured.
func NewService ¶
NewService creates an AI service. If adapter is nil or disabled, all methods return nil — callers always handle the nil case.
func (*Service) Draft ¶
Draft sends a prompt with context and returns the completion. Returns ("", nil) when AI is unavailable.
func (*Service) Embed ¶
Embed returns a vector embedding for the given text. Returns (nil, nil) when AI is unavailable.
func (*Service) IsAvailable ¶
IsAvailable returns true if the AI service is configured and enabled.