explainer

package
v0.12.2 Latest Latest
Warning

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

Go to latest
Published: Mar 4, 2026 License: GPL-3.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Analyzer

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

Analyzer provides the actual analysis logic

func NewAnalyzer

func NewAnalyzer() *Analyzer

func (*Analyzer) BuildPrompt

func (a *Analyzer) BuildPrompt(templatePath, quirkyPath string) (string, error)

BuildPrompt constructs the full prompt with the game situation

func (*Analyzer) EvaluateLeave

func (a *Analyzer) EvaluateLeave(leave string) (float64, error)

EvaluateLeave evaluates the value of a leave

func (*Analyzer) GetFuturePlayMetadata

func (a *Analyzer) GetFuturePlayMetadata(playString string) (*FuturePlayMetadata, error)

GetFuturePlayMetadata analyzes a potential future play by parsing winningStats

func (*Analyzer) GetPlayMetadata

func (a *Analyzer) GetPlayMetadata(playString string) (*PlayMetadata, error)

GetPlayMetadata analyzes a play and returns metadata

func (*Analyzer) SetConfig

func (a *Analyzer) SetConfig(cfg *config.Config)

SetConfig sets the configuration for the analyzer

func (*Analyzer) SetGameContext

func (a *Analyzer) SetGameContext(gameState, simResults, simDetails, winningPlay, winningStats string)

SetGameContext sets the current game context for analysis

type Config

type Config struct {
	Provider         string // "gemini", "openai", or "deepseek"
	APIKey           string
	Model            string
	BaseURL          string // optional: override base URL (e.g. for LM Studio at http://127.0.0.1:1234/v1)
	UseQuirky        bool
	MainPromptPath   string
	QuirkyPromptPath string
}

Config holds configuration for the explainer service

func DefaultConfig

func DefaultConfig(macondoConfig *macondo.Config) *Config

DefaultConfig returns a default configuration from macondo config

type EvaluateLeaveTool

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

EvaluateLeaveTool evaluates the value of a leave

func NewEvaluateLeaveTool

func NewEvaluateLeaveTool(analyzer *Analyzer) *EvaluateLeaveTool

func (*EvaluateLeaveTool) Description

func (t *EvaluateLeaveTool) Description() string

func (*EvaluateLeaveTool) Execute

func (t *EvaluateLeaveTool) Execute(ctx context.Context, args string) (string, error)

func (*EvaluateLeaveTool) Name

func (t *EvaluateLeaveTool) Name() string

func (*EvaluateLeaveTool) Parameters

func (t *EvaluateLeaveTool) Parameters() map[string]interfaces.ParameterSpec

func (*EvaluateLeaveTool) Run

func (t *EvaluateLeaveTool) Run(ctx context.Context, args string) (string, error)

type ExplainResult

type ExplainResult struct {
	Explanation  string
	InputTokens  int
	OutputTokens int
}

ExplainResult contains the explanation from the AI

type FuturePlayMetadata

type FuturePlayMetadata struct {
	Play               string   `json:"play"`
	Score              int      `json:"score"`
	IsBingo            bool     `json:"is_bingo"`
	NeededDraw         []string `json:"needed_draw"`         // tiles needed from bag
	RequiresOtherPlay  string   `json:"requires_opp_play"`   // opponent play needed first
	ProbabilityPercent float64  `json:"probability_percent"` // likelihood of this play
}

FuturePlayMetadata represents metadata about a potential future play

type GetOurFuturePlayMetadataTool

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

GetOurFuturePlayMetadataTool analyzes metadata for a potential future play

func NewGetOurFuturePlayMetadataTool

func NewGetOurFuturePlayMetadataTool(analyzer *Analyzer) *GetOurFuturePlayMetadataTool

func (*GetOurFuturePlayMetadataTool) Description

func (t *GetOurFuturePlayMetadataTool) Description() string

func (*GetOurFuturePlayMetadataTool) Execute

func (*GetOurFuturePlayMetadataTool) Name

func (*GetOurFuturePlayMetadataTool) Parameters

func (*GetOurFuturePlayMetadataTool) Run

type GetOurPlayMetadataTool

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

GetOurPlayMetadataTool analyzes metadata for a current play

func NewGetOurPlayMetadataTool

func NewGetOurPlayMetadataTool(analyzer *Analyzer) *GetOurPlayMetadataTool

func (*GetOurPlayMetadataTool) Description

func (t *GetOurPlayMetadataTool) Description() string

func (*GetOurPlayMetadataTool) Execute

func (t *GetOurPlayMetadataTool) Execute(ctx context.Context, args string) (string, error)

func (*GetOurPlayMetadataTool) Name

func (t *GetOurPlayMetadataTool) Name() string

func (*GetOurPlayMetadataTool) Parameters

func (*GetOurPlayMetadataTool) Run

type PlayMetadata

type PlayMetadata struct {
	Play           string `json:"play"`
	Score          int    `json:"score"`
	TilesUsed      int    `json:"tiles_used"`
	IsBingo        bool   `json:"is_bingo"`
	VowelsInLeave  int    `json:"vowels_in_leave"`
	ConsonantsLeft int    `json:"consonants_in_leave"`
	LeaveBalance   string `json:"leave_balance"` // "balanced", "vowel-heavy", "consonant-heavy"
}

PlayMetadata represents metadata about a Scrabble play

type Service

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

Service provides the main explainer service

func NewService

func NewService(macondoConfig *macondo.Config) *Service

NewService creates a new explainer service

func (*Service) Explain

func (s *Service) Explain(ctx context.Context, gameState, simResults, simDetails, winningPlay, winningStats string) (*ExplainResult, error)

Explain generates an explanation for the given game situation

func (*Service) SetGame

func (s *Service) SetGame(tp *bot.BotTurnPlayer)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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