suggestions

package
v0.19.0-alpha.4 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	CacheTTL  time.Duration
	Templates []Template
}

Config holds configuration for the SuggestionEngine.

func DefaultConfig

func DefaultConfig() Config

DefaultConfig returns a SuggestionEngine config with sensible defaults.

type Handler

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

Handler provides HTTP handlers for the suggestions API.

func NewHandler

func NewHandler(engine *SuggestionEngine) *Handler

NewHandler creates a new suggestions API handler.

func (*Handler) HandleGetSuggestions

func (h *Handler) HandleGetSuggestions(w http.ResponseWriter, r *http.Request)

HandleGetSuggestions handles GET /api/conversations/{id}/suggestions. Returns cached suggestions or template-based fallback.

func (*Handler) HandleGetSuggestionsWithMessages

func (h *Handler) HandleGetSuggestionsWithMessages(w http.ResponseWriter, r *http.Request)

HandleGetSuggestionsWithMessages handles POST /api/conversations/{id}/suggestions. Generates fresh suggestions from the provided messages.

func (*Handler) HandleInvalidateCache

func (h *Handler) HandleInvalidateCache(w http.ResponseWriter, r *http.Request)

HandleInvalidateCache handles DELETE /api/conversations/{id}/suggestions/cache.

func (*Handler) RegisterRoutes

func (h *Handler) RegisterRoutes(mux *http.ServeMux)

RegisterRoutes registers the suggestions API routes on a ServeMux.

type LLMProvider

type LLMProvider interface {
	GenerateSuggestions(ctx context.Context, systemPrompt, userPrompt string) ([]Suggestion, error)
}

LLMProvider abstracts the AI generation backend for suggestions.

type Message

type Message struct {
	ID        string    `json:"id"`
	Body      string    `json:"body"`
	Role      string    `json:"role"` // "counselor", "texter", "system"
	Timestamp time.Time `json:"timestamp"`
}

Message represents a single conversation message for generating suggestions.

type Suggestion

type Suggestion struct {
	Text       string  `json:"text"`
	Category   string  `json:"category"` // "empathy", "question", "resource", "safety", "reframe"
	Confidence float64 `json:"confidence"`
	Reasoning  string  `json:"reasoning,omitempty"`
}

Suggestion represents a response suggestion for a counselor.

type