prediction

package
v0.80.3 Latest Latest
Warning

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

Go to latest
Published: Feb 1, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package prediction provides predictive interaction capabilities for AI agents.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ActionType

type ActionType string

ActionType defines specific actions that can be predicted.

const (
	ActionViewWeekSchedule ActionType = "view_week_schedule"
	ActionViewTomorrow     ActionType = "view_tomorrow"
	ActionCreateSchedule   ActionType = "create_schedule"
	ActionSetReminder      ActionType = "set_reminder"
	ActionSearchRelated    ActionType = "search_related"
	ActionViewWeeklyReport ActionType = "view_weekly_report"
	ActionMonthlyReview    ActionType = "monthly_review"
	ActionQuickNote        ActionType = "quick_note"
)

type ContextEvent

type ContextEvent struct {
	Timestamp time.Time `json:"timestamp"`
	Type      string    `json:"type"`
	TargetID  string    `json:"target_id"`
}

ContextEvent represents a recent user action for context-based prediction.

type Engine

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

Engine provides prediction capabilities based on user habits and context.

func NewEngine

func NewEngine(habitAnalyzer habit.HabitAnalyzer, memSvc memory.MemoryService) *Engine

NewEngine creates a new prediction engine.

func (*Engine) Predict

func (e *Engine) Predict(ctx context.Context, userID int32, recentEvents []ContextEvent) ([]Prediction, error)

Predict generates predictions for a user based on time, context, and patterns.

func (*Engine) SetMaxPredictions

func (e *Engine) SetMaxPredictions(n int)

SetMaxPredictions sets the maximum number of predictions to return.

type Prediction

type Prediction struct {
	Payload    any            `json:"payload,omitempty"`
	Type       PredictionType `json:"type"`
	Label      string         `json:"label"`
	Action     ActionType     `json:"action"`
	Reason     string         `json:"reason,omitempty"`
	Confidence float64        `json:"confidence"`
}

Prediction represents a predicted user action.

type PredictionType

type PredictionType string

PredictionType defines the type of prediction.

const (
	PredictionTypeAction   PredictionType = "action"
	PredictionTypeQuery    PredictionType = "query"
	PredictionTypeReminder PredictionType = "reminder"
)

type TriggerType

type TriggerType string

TriggerType defines what triggered the prediction.

const (
	TriggerTime    TriggerType = "time"
	TriggerContext TriggerType = "context"
	TriggerPattern TriggerType = "pattern"
)

Jump to

Keyboard shortcuts

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