ai

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: May 29, 2026 License: MIT Imports: 7 Imported by: 0

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

Constants

This section is empty.

Variables

This section is empty.

Functions

func PRDescriptionPrompt

func PRDescriptionPrompt(diff, specContext, stackPosition string) string

PRDescriptionPrompt generates a prompt for drafting a PR description.

func PRStackPrompt

func PRStackPrompt(solution, architectureNotes string, repos []string) string

PRStackPrompt generates a prompt for proposing a PR stack plan.

func SectionDraftPrompt

func SectionDraftPrompt(sectionSlug string, existingContext map[string]string) string

SectionDraftPrompt generates a prompt for drafting a spec section.

func TriageSummarisePrompt

func TriageSummarisePrompt(sourceContent string) string

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

func NewService(ai adapter.AIAdapter, enabled bool) *Service

NewService creates an AI service. If adapter is nil or disabled, all methods return nil — callers always handle the nil case.

func (*Service) Draft

func (s *Service) Draft(ctx context.Context, prompt string, contextParts ...string) (string, error)

Draft sends a prompt with context and returns the completion. Returns ("", nil) when AI is unavailable.

func (*Service) Embed

func (s *Service) Embed(ctx context.Context, text string) ([]float32, error)

Embed returns a vector embedding for the given text. Returns (nil, nil) when AI is unavailable.

func (*Service) IsAvailable

func (s *Service) IsAvailable() bool

IsAvailable returns true if the AI service is configured and enabled.

func (*Service) Summarise

func (s *Service) Summarise(ctx context.Context, text string, maxLength int) (string, error)

Summarise summarises text to a target length. Returns ("", nil) when AI is unavailable.

Jump to

Keyboard shortcuts

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