schema

package
v0.5.1 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var LLMResources = sa.ParamsGenResources{
	Phrases: map[string]string{
		"NoCookingNoJokes":      "No jokes without cooking.",
		"IngredientsPicking":    "Tell me what cooking ingredients do you have at hand, we need at least %d to continue.",
		"IngredientsPickingEnd": "OK, I have the ingredients I need.",
		"RecipePicking":         "Ok, let me check my books for what we could make...",
		"ResumeNeeded":          "You have to Resume for me to do anything.",
		"WokenUp":               "OK I'm ready to start",
		"CookingStarted":        "You chose %s as the recipe which we will cook, got it. I will plan all the cooking steps nicely for us. Just press those buttons on the right, once I'm done.",
		"CharacterReady": sp(`
			Welcome to Cook - your AI-powered cooking assistant! It will help you pick a meal from the ingredients you have, and then you can cook it together (wink wink).
	`),
		ss.StoryMealReady: "We made it, the meal is ready! You can enjoy it now. I hope you had fun cooking with us.",
		"ReqLimitReached": "You have reached the limit of %d requests per session. Please come back later.",
	},
}
View Source
var MatchIngredients = regexp.MustCompile("^Ingredient")
View Source
var MatchSteps = regexp.MustCompile(`^Step`)
View Source
var StoryCookingStarted = &shared.Story{
	StoryInfo: shared.StoryInfo{
		State: ss.StoryCookingStarted,
		Title: "Cooking Started",
		Desc:  "The main story, the bot translates the recipe into actionable steps, then comments while the user completes them.",
	},
	Agent: shared.StoryActor{
		Trigger: amhelp.Cond{
			Is: am.S{ss.Ready, ss.RecipeReady},
		},
	},
	Memory: shared.StoryActor{
		Trigger: amhelp.Cond{
			Not: am.S{states.MemMealReady},
		},
	},
}
View Source
var StoryIngredientsPicking = &shared.Story{
	StoryInfo: shared.StoryInfo{
		State: ss.StoryIngredientsPicking,
		Title: "Ingredients Picking",
		Desc:  "The bot asks the user what ingredients they have at hand.",
	},
	Agent: shared.StoryActor{
		Trigger: amhelp.Cond{
			Is:  am.S{ss.Ready},
			Not: am.S{ss.IngredientsReady, ss.StoryWakingUp},
		},
	},
}
View Source
var StoryJoke = &shared.Story{
	StoryInfo: shared.StoryInfo{
		State: ss.StoryJoke,
		Title: "Joke",
		Desc:  "In this story the bot tells a joke when asked to, based on the character.",
	},

	CanActivate: func(s *shared.Story) bool {
		mem := s.Memory.Mach
		stepStates := mem.StateNamesMatch(MatchSteps)
		stepsNow := mem.Time(stepStates).Sum(nil) + s.Epoch
		freq := 1.5

		return s.Tick == 0 || float64(stepsNow)*freq >= float64(s.Tick)
	},
}
View Source
var StoryMealReady = &shared.Story{
	StoryInfo: shared.StoryInfo{
		State: ss.StoryMealReady,
		Title: "Meal Ready",
		Desc:  "This story is the end of the flow, the recipe should have been materialized by now.",
	},
	Memory: shared.StoryActor{
		Trigger: amhelp.Cond{
			Is: am.S{states.MemMealReady},
		},
	},
}
View Source
var StoryMemoryWipe = &shared.Story{
	StoryInfo: shared.StoryInfo{
		State: ss.StoryMemoryWipe,
		Title: "Memory Wipe",
		Desc:  "The bot will clean both short term and long term memory.",
	},
}
View Source
var StoryRecipePicking = &shared.Story{
	StoryInfo: shared.StoryInfo{
		State: ss.StoryRecipePicking,
		Title: "Recipe Picking",
		Desc:  "The bot offers some recipes, based on the ingredients.",
	},
	Agent: shared.StoryActor{
		Trigger: amhelp.Cond{
			Is:  am.S{ss.Ready, ss.IngredientsReady},
			Not: am.S{ss.RecipeReady},
		},
	},
}
View Source
var StoryStartAgain = &shared.Story{
	StoryInfo: shared.StoryInfo{
		State: ss.StoryStartAgain,
		Title: "Start Again",
		Desc:  "The session will re-start, keeping the bot's memory.",
	},
}
View Source
var StoryWakingUp = &shared.Story{
	StoryInfo: shared.StoryInfo{
		State: ss.StoryWakingUp,
		Title: "Waking Up",
		Desc:  "The waking up story is the bot starting on either cold or warm boot.",
	},
	Agent: shared.StoryActor{
		Trigger: amhelp.Cond{
			Not: am.S{ss.Ready},
		},
	},
}

Functions

This section is empty.

Types

type Ingredient

type Ingredient struct {
	Name   string
	Amount int
	Unit   string
}

type ParamsCookingStarted

type ParamsCookingStarted struct {
	Recipe         Recipe
	ExtractedSteps []string
}

type ParamsGenJokes

type ParamsGenJokes struct {
	// The number of jokes to generate.
	Amount int
}

type ParamsGenStepComments

type ParamsGenStepComments struct {
	Steps  []string
	Recipe Recipe
}

type ParamsGenSteps

type ParamsGenSteps struct {
	Recipe Recipe
}

type ParamsIngredientsPicking

type ParamsIngredientsPicking struct {
	// The minimum number of ingredients needed.
	MinIngredients int
	// Text to extract ingredients from.
	Prompt string
	// List of ingredients extracted from prompts till now.
	Ingredients []Ingredient
}

type ParamsRecipePicking

type ParamsRecipePicking struct {
	// List of available ingredients.
	Ingredients []Ingredient
	// The number of recipes needed.
	Amount int
}

type PromptGenJokes

type PromptGenJokes = secai.Prompt[ParamsGenJokes, ResultGenJokes]

func NewPromptGenJokes

func NewPromptGenJokes(agent shared.AgentBaseAPI) *PromptGenJokes

type PromptGenSteps

type PromptGenSteps = secai.Prompt[ParamsGenSteps, ResultGenSteps]

func NewPromptGenSteps

func NewPromptGenSteps(agent shared.AgentBaseAPI) *PromptGenSteps

type Recipe

type Recipe struct {
	Name  string
	Desc  string
	Steps string
}

type ResultCookingStarted

type ResultCookingStarted struct {
	// Max 2 sentences, min 3 words.
	Answer string
}

type ResultGenJokes

type ResultGenJokes struct {
	// List of jokes, max 2 sentences each.
	Jokes []string
	IDs   []int64
}

type ResultGenStepComments

type ResultGenStepComments struct {
	// Comments for each step.
	Comments []string
}

type ResultGenSteps

type ResultGenSteps struct {
	Schema am.Schema
}

type ResultIngredientsPicking

type ResultIngredientsPicking struct {
	Ingredients []Ingredient
	// A message to be shown to the user if the results are not valid.
	RedoMsg string
}

type ResultRecipePicking

type ResultRecipePicking struct {
	// List of proposed recipes
	Recipes []Recipe
	// Extra recipe with unavailable ingredients.
	ExtraRecipe Recipe
	// Message to the user, summarizing the recipes. Max 3 sentences.
	Summary string
}

Jump to

Keyboard shortcuts

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