cook

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Oct 23, 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.

Start

  1. Edit config.kdl, in the AI section paste an API key for the prefered provider.
  2. Run ./aigent-cook
  3. Check the newly open browser window or go to http://localhost:12854

Demo

To see the mock scenario from the demo video, uncomment Mock true in config.kdl, then restart.

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 ArgsRPC = []am.ArgsApi{AStepCompleted{}}
View Source
var ConfigTpl []byte
View Source
var EnvCookDev = "COOK_DEV"

EnvCookDev enabled dev mode (local config and data dir).

View Source
var Pass = am.Pass
View Source
var SAdd = am.SAdd
View Source
var WelcomeMessage = "Please wait while loading..."

Functions

This section is empty.

Types

type AStepCompleted added in v0.6.0

type AStepCompleted struct {
	Args
	ID string `log:"id"`
}

func (AStepCompleted) ArgsState added in v0.6.0

func (AStepCompleted) ArgsState() string

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

TODO move to LLM

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) DisposingState added in v0.6.0

func (a *Agent) DisposingState(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)

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)

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)

TODO move to secai?

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) UIMsgEnter added in v0.6.0

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

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

func (*Agent) UIRenderClockState added in v0.5.0

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

type Args added in v0.6.0

type Args struct {
	am.ArgsBase
}

func (Args) ArgsPrefix added in v0.6.0

func (Args) ArgsPrefix() string

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 Web added in v0.6.0

type Web struct {
	*web.Handlers
}

func NewWeb added in v0.6.0

func NewWeb(a *Agent) *Web

Directories

Path Synopsis
db
scripts
gen_sql_schema command
web
cmd command

Jump to

Keyboard shortcuts

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