cook

package
v0.5.0 Latest Latest
Warning

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

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

README

AI-gent Cook

This demo presents data collection, gen AI, offers, stories, workflows, dynamic short-term memory, planning with a DAG, story navigation, progress, and clockmoji.

Configuration

Providing an AI model is mandatory, edit the AI section in config.kdl and paste an API key for the prefered model.

Start

  1. Run ./aigent-cook

Credits

Documentation

Overview

Package cook is a recipe-choosing and cooking agent with a gen-ai character.

Index

Constants

This section is empty.

Variables

View Source
var APrefix = "cook"

APrefix is the args prefix, set from config.

View Source
var ConfigTpl []byte
View Source
var Pass2 = agentllm.Pass
View Source
var Pass2RPC = agentllm.PassRPC
View Source
var Pass3 = shared.Pass
View Source
var Pass3RPC = shared.PassRPC
View Source
var SAdd = am.SAdd
View Source
var WelcomeMessage = "Please wait while loading..."

Functions

func LogArgs

func LogArgs(args am.A) map[string]string

LogArgs is an args logger for A and secai.A.

func Pass

func Pass(args *A) am.A

Pass prepares am.A from A to be passed to further mutations (encoder).

func PassRPC added in v0.5.0

func PassRPC(args *A) am.A

PassRPC is a network-safe version of Pass. Use it when mutating aRPC workers.

Types

type A

type A struct {
	// base args
	*agentllm.A

	// agent's args
	TUI *tui.TUI
}

A is a struct for node arguments. It's a typesafe alternative to am.A.

func NewArgs added in v0.4.0

func NewArgs() A

func ParseArgs

func ParseArgs(args am.A) *A

ParseArgs extracts A from am.Event.ArgsAPrefix (decoder).

type A2 added in v0.5.0

type A2 = agentllm.A

type A2RPC added in v0.5.0

type A2RPC = agentllm.ARPC

type A3 added in v0.5.0

type A3 = shared.A

type A3RPC added in v0.5.0

type A3RPC = shared.ARPC

type ARPC added in v0.5.0

type ARPC struct {
	// base args of the framework
	*shared.A

	// agent's args
	Move *sallm.ResultOrienting `log:"move"`
}

ARPC is a subset of A that can be passed over RPC (eg no channels, conns, etc)

func NewArgsRPC added in v0.5.0

func NewArgsRPC() ARPC

type Agent

type Agent struct {
	// inherit from AgentLLM
	*agentllm.AgentLLM

	Config    *Config
	MemCutoff atomic.Uint64
	// contains filtered or unexported fields
}

func New

func New(ctx context.Context) *Agent

New returns a custom instance of Agent.

func NewCook

func NewCook(ctx context.Context, cfg *Config) (*Agent, error)

NewCook returns a preconfigured instance of Agent.

func (*Agent) Actions added in v0.5.0

func (a *Agent) Actions() []shared.ActionInfo

func (*Agent) AnyState

func (a *Agent) AnyState(e *am.Event)

func (*Agent) CharacterReadyState

func (a *Agent) CharacterReadyState(e *am.Event)

func (*Agent) CheckStoriesState

func (a *Agent) CheckStoriesState(e *am.Event)

func (*Agent) ConfigUpdateState added in v0.5.0

func (a *Agent) ConfigUpdateState(e *am.Event)

func (*Agent) DBAgent added in v0.5.0

func (a *Agent) DBAgent() *sql.DB

func (*Agent) DBStartingState

func (a *Agent) DBStartingState(e *am.Event)

func (*Agent) DisposedState

func (a *Agent) DisposedState(e *am.Event)

func (*Agent) ExceptionState

func (a *Agent) ExceptionState(e *am.Event)

func (*Agent) GenJokesEnd

func (a *Agent) GenJokesEnd(e *am.Event)

func (*Agent) GenJokesEnter

func (a *Agent) GenJokesEnter(e *am.Event) bool

func (*Agent) GenJokesState

func (a *Agent) GenJokesState(e *am.Event)

func (*Agent) GenStepCommentsEnd

func (a *Agent) GenStepCommentsEnd(e *am.Event)

func (*Agent) GenStepCommentsState

func (a *Agent) GenStepCommentsState(e *am.Event)

func (*Agent) GenStepsEnd

func (a *Agent) GenStepsEnd(e *am.Event)

func (*Agent) GenStepsEnter added in v0.5.0

func (a *Agent) GenStepsEnter(e *am.Event) bool

func (*Agent) GenStepsState

func (a *Agent) GenStepsState(e *am.Event)

func (*Agent) HeartbeatState

func (a *Agent) HeartbeatState(e *am.Event)

func (*Agent) HistoryStates added in v0.4.0

func (a *Agent) HistoryStates() S

HistoryStates returns a list of states to track in the history.

func (*Agent) IngredientsReadyEnd

func (a *Agent) IngredientsReadyEnd(e *am.Event)

func (*Agent) Init

func (a *Agent) Init(cfg *Config) error

func (*Agent) InputPendingState

func (a *Agent) InputPendingState(e *am.Event)

InputPendingState is a test mocking handler.

func (*Agent) InterruptedState

func (a *Agent) InterruptedState(e *am.Event)

func (*Agent) JokesReadyEnd

func (a *Agent) JokesReadyEnd(e *am.Event)

func (*Agent) LLMResources added in v0.5.0

func (a *Agent) LLMResources() sallm.ParamsGenResources

func (*Agent) LoopEnter

func (a *Agent) LoopEnter(e *am.Event) bool

func (*Agent) LoopState

func (a *Agent) LoopState(e *am.Event)

func (*Agent) MachMem added in v0.5.0

func (a *Agent) MachMem() *am.Machine

func (*Agent) MachSchema added in v0.5.0

func (a *Agent) MachSchema() (am.Schema, am.S)

func (*Agent) MockEnter

func (a *Agent) MockEnter(e *am.Event) bool

func (*Agent) MockState

func (a *Agent) MockState(e *am.Event)

func (*Agent) Msgs

func (a *Agent) Msgs() []*shared.Msg

func (*Agent) OrientingMoves added in v0.5.0

func (a *Agent) OrientingMoves() map[string]string

func (*Agent) PromptEnter

func (a *Agent) PromptEnter(e *am.Event) bool

func (*Agent) PromptState

func (a *Agent) PromptState(e *am.Event)

func (*Agent) Queries

func (a *Agent) Queries() *sqlc.Queries

func (*Agent) ReadyEnter

func (a *Agent) ReadyEnter(e *am.Event) bool

func (*Agent) ReadyState

func (a *Agent) ReadyState(e *am.Event)

ReadyState is a test mocking handler.

func (*Agent) RestoreJokesState

func (a *Agent) RestoreJokesState(e *am.Event)

func (*Agent) SSHConnState added in v0.5.0

func (a *Agent) SSHConnState(e *am.Event)

func (*Agent) SSHDisconnState added in v0.5.0

func (a *Agent) SSHDisconnState(e *am.Event)

func (*Agent) SSHReadyState added in v0.5.0

func (a *Agent) SSHReadyState(e *am.Event)

func (*Agent) Splash added in v0.5.0

func (a *Agent) Splash() string

func (*Agent) StartEnd added in v0.5.0

func (a *Agent) StartEnd(e *am.Event)

func (*Agent) StartState

func (a *Agent) StartState(e *am.Event)

func (*Agent) StepCommentsReadyEnd

func (a *Agent) StepCommentsReadyEnd(e *am.Event)

func (*Agent) StepCompletedState

func (a *Agent) StepCompletedState(e *am.Event)

func (*Agent) StepsReadyEnd

func (a *Agent) StepsReadyEnd(e *am.Event)

func (*Agent) StepsReadyState

func (a *Agent) StepsReadyState(e *am.Event)

func (*Agent) Stories

func (a *Agent) Stories() []shared.StoryInfo

func (*Agent) Story added in v0.5.0

func (a *Agent) Story(state string) *shared.Story

func (*Agent) StoryActionEnter added in v0.5.0

func (a *Agent) StoryActionEnter(e *am.Event) bool

func (*Agent) StoryActionState added in v0.5.0

func (a *Agent) StoryActionState(e *am.Event)

func (*Agent) StoryChangedState

func (a *Agent) StoryChangedState(e *am.Event)

func (*Agent) StoryCookingStartedEnd

func (a *Agent) StoryCookingStartedEnd(e *am.Event)

func (*Agent) StoryCookingStartedEnter

func (a *Agent) StoryCookingStartedEnter(e *am.Event) bool

func (*Agent) StoryCookingStartedState

func (a *Agent) StoryCookingStartedState(e *am.Event)

func (*Agent) StoryIngredientsPickingEnd

func (a *Agent) StoryIngredientsPickingEnd(e *am.Event)

func (*Agent) StoryIngredientsPickingState

func (a *Agent) StoryIngredientsPickingState(e *am.Event)

func (*Agent) StoryJokeEnter

func (a *Agent) StoryJokeEnter(e *am.Event) bool

func (*Agent) StoryJokeState

func (a *Agent) StoryJokeState(e *am.Event)

func (*Agent) StoryMealReadyState

func (a *Agent) StoryMealReadyState(e *am.Event)

func (*Agent) StoryMemoryWipeState

func (a *Agent) StoryMemoryWipeState(e *am.Event)

func (*Agent) StoryRecipePickingEnd

func (a *Agent) StoryRecipePickingEnd(e *am.Event)

func (*Agent) StoryRecipePickingEnter

func (a *Agent) StoryRecipePickingEnter(e *am.Event) bool

func (*Agent) StoryRecipePickingState

func (a *Agent) StoryRecipePickingState(e *am.Event)

func (*Agent) StoryStartAgainState

func (a *Agent) StoryStartAgainState(e *am.Event)

func (*Agent) StoryWakingUpEnd

func (a *Agent) StoryWakingUpEnd(e *am.Event)

func (*Agent) StoryWakingUpState

func (a *Agent) StoryWakingUpState(e *am.Event)

func (*Agent) UIModeEnd

func (a *Agent) UIModeEnd(e *am.Event)

func (*Agent) UIModeEnter added in v0.5.0

func (a *Agent) UIModeEnter(e *am.Event) bool

func (*Agent) UIModeState

func (a *Agent) UIModeState(e *am.Event)

func (*Agent) UIMsgState added in v0.5.0

func (a *Agent) UIMsgState(e *am.Event)

func (*Agent) UIReadyEnter

func (a *Agent) UIReadyEnter(e *am.Event) bool

TODO bind

func (*Agent) UIRenderClockState added in v0.5.0

func (a *Agent) UIRenderClockState(e *am.Event)

type Config

type Config struct {
	shared.Config

	Cook ConfigCook
}

func ConfigDefault added in v0.4.0

func ConfigDefault() Config

type ConfigCook added in v0.4.0

type ConfigCook struct {
	// Number of ingredients to collect.
	MinIngredients int
	GenJokesAmount int
	// TODO move to secai
	SessionTimeout time.Duration `kdl:",duration"`
	// Number of recipes to generate.
	GenRecipes int
	// TODO remove?
	MinPromptLen int
	// Step comment frequency. Lower number = higher frequency of step comments. 2=50%, 3=33%.
	StepCommentFreq int
	// Heartbeat frequency.
	HeartbeatFreq time.Duration `kdl:",duration"`
	// Certainty above which the orienting move should be accepted.
	OrientingMoveThreshold float64
}

type Mock

type Mock struct {
	// Local mock switch, complementary to the config switch.
	Active bool

	FlowPromptIngredients string
	FlowPromptRecipe      string
	FlowPromptCooking     string

	Recipe                    string
	GenStepsRes               string
	GenStepCommentsRes        string
	StoryCookingStartedInput  string
	StoryCookingStartedInput3 string
}

Mock will run a sample scenario

type S

type S = am.S

type StepsByReqFinal

type StepsByReqFinal struct {
	Name   string
	Schema am.Schema
}

Directories

Path Synopsis
db
scripts
gen_sql_schema command

Jump to

Keyboard shortcuts

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