Documentation
¶
Overview ¶
Package cook is a recipe-choosing and cooking agent with a gen-ai character.
Index ¶
- 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) HistoryStates() S
- func (a *Agent) IngredientsReadyEnd(e *am.Event)
- func (a *Agent) Init(cfg *Config) 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() *sqlc.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 ConfigCook
- type MemHandlers
- type Mock
- type S
- type StepsByReqFinal
- type StoryUI
Constants ¶
This section is empty.
Variables ¶
var APrefix = "cook"
APrefix is the args prefix, set from config.
var PassAA = shared.Pass
PassAA is shared.Pass.
var SAdd = am.SAdd
var WelcomeMessage = "Please wait while loading..."
Functions ¶
Types ¶
type A ¶
type A struct {
// base args of the framework
*shared.A
// agent's args
Move *sa.ResultOrienting `log:"move"`
TUI *tui.Tui
}
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 *sa.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.4.0
func NewArgsRpc() ARpc
type Agent ¶
type Agent struct {
// inherit from LLM AgentLLM
*agentllm.AgentLLM
Config *Config
StoriesList []string
Stories map[string]*StoryUI
UIs []*tui.Tui
Msgs []*shared.Msg
MemCutoff atomic.Uint64
UINum int
// 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) HistoryStates ¶ added in v0.4.0
HistoryStates returns a list of states to track in the history.
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 {
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 MemHandlers ¶ added in v0.4.0
type MemHandlers struct {
// contains filtered or unexported fields
}
func (*MemHandlers) AnyState ¶ added in v0.4.0
func (m *MemHandlers) AnyState(_ *am.Event)
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