Documentation
¶
Overview ¶
Package cook is a recipe-choosing and cooking agent with a gen-ai character.
Index ¶
- Constants
- Variables
- func LogArgs(args am.A) map[string]string
- func Pass(args *A) am.A
- func PassRpc(args *A) am.A
- type A
- type AA
- type AARpc
- type ARpc
- type Agent
- func (a *Agent) AnyState(e *am.Event)
- func (a *Agent) CharacterReadyEnd(e *am.Event)
- func (a *Agent) CharacterReadyEnter(e *am.Event) bool
- func (a *Agent) CharacterReadyState(e *am.Event)
- func (a *Agent) CheckStoriesState(e *am.Event)
- func (a *Agent) DBStartingState(e *am.Event)
- func (a *Agent) DisposedState(e *am.Event)
- func (a *Agent) ExceptionState(e *am.Event)
- func (a *Agent) GenCharacterEnd(e *am.Event)
- func (a *Agent) GenCharacterState(e *am.Event)
- func (a *Agent) GenJokesEnd(e *am.Event)
- func (a *Agent) GenJokesEnter(e *am.Event) bool
- func (a *Agent) GenJokesState(e *am.Event)
- func (a *Agent) GenResourcesEnd(e *am.Event)
- func (a *Agent) GenResourcesEnter(e *am.Event) bool
- func (a *Agent) GenResourcesState(e *am.Event)
- func (a *Agent) GenStepCommentsEnd(e *am.Event)
- func (a *Agent) GenStepCommentsState(e *am.Event)
- func (a *Agent) GenStepsEnd(e *am.Event)
- func (a *Agent) GenStepsState(e *am.Event)
- func (a *Agent) HeartbeatState(e *am.Event)
- func (a *Agent) IngredientsReadyEnd(e *am.Event)
- func (a *Agent) Init(agent secai.AgentAPI) error
- func (a *Agent) InputPendingState(e *am.Event)
- func (a *Agent) InterruptedState(e *am.Event)
- func (a *Agent) JokesReadyEnd(e *am.Event)
- func (a *Agent) LoopEnter(e *am.Event) bool
- func (a *Agent) LoopState(e *am.Event)
- func (a *Agent) MockEnter(e *am.Event) bool
- func (a *Agent) MockState(e *am.Event)
- func (a *Agent) MsgState(e *am.Event)
- func (a *Agent) OrientingMoveEnter(e *am.Event) bool
- func (a *Agent) OrientingMoveState(e *am.Event)
- func (a *Agent) OrientingState(e *am.Event)
- func (a *Agent) OutputPhrase(key string, args ...any) error
- func (a *Agent) Phrase(key string, args ...any) string
- func (a *Agent) PromptEnter(e *am.Event) bool
- func (a *Agent) PromptState(e *am.Event)
- func (a *Agent) Queries() *db.Queries
- func (a *Agent) ReadyEnter(e *am.Event) bool
- func (a *Agent) ReadyState(e *am.Event)
- func (a *Agent) ResourcesReadyEnd(e *am.Event)
- func (a *Agent) RestoreCharacterState(e *am.Event)
- func (a *Agent) RestoreJokesState(e *am.Event)
- func (a *Agent) RestoreResourcesState(e *am.Event)
- func (a *Agent) StartState(e *am.Event)
- func (a *Agent) StepCommentsReadyEnd(e *am.Event)
- func (a *Agent) StepCompletedState(e *am.Event)
- func (a *Agent) StepsReadyEnd(e *am.Event)
- func (a *Agent) StepsReadyState(e *am.Event)
- func (a *Agent) StoryActivate(e *am.Event, story string) am.Result
- func (a *Agent) StoryChangedState(e *am.Event)
- func (a *Agent) StoryCookingStartedEnd(e *am.Event)
- func (a *Agent) StoryCookingStartedEnter(e *am.Event) bool
- func (a *Agent) StoryCookingStartedState(e *am.Event)
- func (a *Agent) StoryDeactivate(e *am.Event, story string) am.Result
- func (a *Agent) StoryIngredientsPickingEnd(e *am.Event)
- func (a *Agent) StoryIngredientsPickingState(e *am.Event)
- func (a *Agent) StoryJokeEnter(e *am.Event) bool
- func (a *Agent) StoryJokeState(e *am.Event)
- func (a *Agent) StoryMealReadyState(e *am.Event)
- func (a *Agent) StoryMemoryWipeState(e *am.Event)
- func (a *Agent) StoryRecipePickingEnd(e *am.Event)
- func (a *Agent) StoryRecipePickingEnter(e *am.Event) bool
- func (a *Agent) StoryRecipePickingState(e *am.Event)
- func (a *Agent) StoryStartAgainState(e *am.Event)
- func (a *Agent) StoryWakingUpEnd(e *am.Event)
- func (a *Agent) StoryWakingUpState(e *am.Event)
- func (a *Agent) UIModeEnd(e *am.Event)
- func (a *Agent) UIModeState(e *am.Event)
- func (a *Agent) UIReadyEnter(e *am.Event) bool
- func (a *Agent) UISessConnState(e *am.Event)
- func (a *Agent) UISessDisconnState(e *am.Event)
- func (a *Agent) UISrvListeningState(e *am.Event)
- type Config
- type Mock
- type S
- type StepsByReqFinal
- type StepsByReqFinalList
- type StoryUI
Constants ¶
View Source
const APrefix = "cook"
Variables ¶
View Source
var PassAA = shared.Pass
View Source
var SAdd = am.SAdd
View Source
var WelcomeMessage = "Please wait while loading..."
Functions ¶
Types ¶
type A ¶
type A struct {
// base args of the framework
*shared.A
// agent's args
Move *schema.ResultOrienting `log:"move"`
}
A is a struct for node arguments. It's a typesafe alternative to am.A.
type ARpc ¶
type ARpc struct {
// base args of the framework
*shared.A
// agent's args
Move *schema.ResultOrienting `log:"move"`
}
ARpc is a subset of am.A, that can be passed over RPC (eg no channels, instances, etc)
type Agent ¶
type Agent struct {
// inherit from LLM Agent
*llmagent.Agent
Config Config
StoriesList []string
Stories map[string]*StoryUI
TUIs []shared.UI
Msgs []*shared.Msg
MemCutoff atomic.Uint64
// contains filtered or unexported fields
}
func (*Agent) CharacterReadyEnd ¶
func (*Agent) CharacterReadyState ¶
func (*Agent) CheckStoriesState ¶
func (*Agent) DBStartingState ¶
func (*Agent) DisposedState ¶
func (*Agent) ExceptionState ¶
func (*Agent) GenCharacterEnd ¶
func (*Agent) GenCharacterState ¶
func (*Agent) GenJokesEnd ¶
func (*Agent) GenJokesState ¶
func (*Agent) GenResourcesEnd ¶
func (*Agent) GenResourcesState ¶
func (*Agent) GenStepCommentsEnd ¶
func (*Agent) GenStepCommentsState ¶
func (*Agent) GenStepsEnd ¶
func (*Agent) GenStepsState ¶
func (*Agent) HeartbeatState ¶
func (*Agent) IngredientsReadyEnd ¶
func (*Agent) InputPendingState ¶
InputPendingState is a test mocking handler.
func (*Agent) InterruptedState ¶
func (*Agent) JokesReadyEnd ¶
func (*Agent) OrientingMoveState ¶
func (*Agent) OrientingState ¶
func (*Agent) OutputPhrase ¶
OutputPhrase is sugar for Phrase followed by Output FromAssistant.
func (*Agent) Phrase ¶
Phrase returns a random phrase from resources under [key], or an empty string. TODO move to base agent
func (*Agent) PromptState ¶
func (*Agent) ReadyState ¶
ReadyState is a test mocking handler.
func (*Agent) ResourcesReadyEnd ¶
func (*Agent) RestoreCharacterState ¶
func (*Agent) RestoreJokesState ¶
func (*Agent) RestoreResourcesState ¶
func (*Agent) StartState ¶
func (*Agent) StepCommentsReadyEnd ¶
func (*Agent) StepCompletedState ¶
func (*Agent) StepsReadyEnd ¶
func (*Agent) StepsReadyState ¶
func (*Agent) StoryActivate ¶
TODO move to base agent
func (*Agent) StoryChangedState ¶
func (*Agent) StoryCookingStartedEnd ¶
func (*Agent) StoryCookingStartedState ¶
func (*Agent) StoryDeactivate ¶
TODO move to base agent
func (*Agent) StoryIngredientsPickingEnd ¶
func (*Agent) StoryIngredientsPickingState ¶
func (*Agent) StoryJokeState ¶
func (*Agent) StoryMealReadyState ¶
func (*Agent) StoryMemoryWipeState ¶
func (*Agent) StoryRecipePickingEnd ¶
func (*Agent) StoryRecipePickingState ¶
func (*Agent) StoryStartAgainState ¶
func (*Agent) StoryWakingUpEnd ¶
func (*Agent) StoryWakingUpState ¶
func (*Agent) UIModeState ¶
func (*Agent) UISessConnState ¶
func (*Agent) UISessDisconnState ¶
func (*Agent) UISrvListeningState ¶
type Config ¶
type Config struct {
MinIngredients int `arg:"env:COOK_MIN_INGREDIENTS" help:"Number of ingredients to collect." default:"3"`
GenJokesAmount int `arg:"env:COOK_GEN_JOKES_AMOUNT" help:"Number of jokes to generate." default:"3"`
SessionTimeout time.Duration `arg:"env:COOK_SESSION_TIMEOUT" help:"Session timeout." default:"1h"`
// Number of recipes to generate.
GenRecipes int `arg:"env:COOK_GEN_RECIPES" help:"Number of recipes to generate." default:"3"`
MinPromptLen int `arg:"env:COOK_MIN_PROMPT_LEN" help:"Minimum prompt length." default:"2"`
// Lower number = higher frequency of step comments. 2=50%, 3=33%.
StepCommentFreq int `arg:"env:COOK_STEP_COMMENT_FREQ" help:"Step comment frequency." default:"2"`
HeartbeatFreq time.Duration `arg:"env:COOK_HEARTBEAT_FREQ" help:"Heartbeat frequency." default:"1h"`
// Certainty above which the orienting move should be accepted.
OrientingMoveThreshold float64 `arg:"env:COOK_ORIENTING_MOVE_THRESHOLD" help:"Certainty above which the orienting move should be accepted." default:"0.5"`
OpenAIAPIKey string `arg:"env:OPENAI_API_KEY" help:"OpenAI API key."`
DeepseekAPIKey string `arg:"env:DEEPSEEK_API_KEY" help:"DeepSeek API key."`
TUIPort int `arg:"env:SECAI_TUI_PORT" help:"SSH port for the TUI." default:"7854"`
TUIHost string `arg:"env:SECAI_TUI_HOST" help:"SSH host for the TUI." default:"localhost"`
Mock bool `arg:"env:SECAI_MOCK" help:"Enable scenario mocking."`
ReqLimit int `arg:"env:SECAI_REQ_LIMIT" help:"Max LLM requests per session." default:"1000"`
}
type StepsByReqFinal ¶
type StepsByReqFinalList ¶
type StepsByReqFinalList []StepsByReqFinal
func (StepsByReqFinalList) Len ¶
func (s StepsByReqFinalList) Len() int
func (StepsByReqFinalList) Less ¶
func (s StepsByReqFinalList) Less(n1, n2 int) bool
func (StepsByReqFinalList) Swap ¶
func (s StepsByReqFinalList) Swap(i, j int)
Click to show internal directories.
Click to hide internal directories.