recipe

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: May 15, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package recipe also provides declarative provider configuration. This file implements YAML-based provider definitions compatible with eyrie.

Package recipe implements a YAML-based guided workflow system. Recipes are declarative multi-step tasks with parameters, extensions, and activities.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultProviderConfigDirs

func DefaultProviderConfigDirs() []string

DefaultProviderConfigDirs returns standard directories for provider configs.

Types

type Author

type Author struct {
	Contact string `yaml:"contact"`
}

Author identifies the recipe creator.

type Extension

type Extension struct {
	Type string `yaml:"type"`
	Name string `yaml:"name"`
}

Extension declares a tool/extension needed by the recipe.

type ModelDef

type ModelDef struct {
	ID          string  `yaml:"id"`
	DisplayName string  `yaml:"display_name"`
	MaxTokens   int     `yaml:"max_tokens"`
	InputPrice  float64 `yaml:"input_price"`
	OutputPrice float64 `yaml:"output_price"`
}

ModelDef defines a model available from a provider.

type Parameter

type Parameter struct {
	Key         string `yaml:"key"`
	InputType   string `yaml:"input_type"`
	Requirement string `yaml:"requirement"`
	Description string `yaml:"description"`
	Default     string `yaml:"default"`
	Value       string `yaml:"value"`
}

Parameter is a configurable input to a recipe.

type ProviderConfig

type ProviderConfig struct {
	Name        string            `yaml:"name"`
	DisplayName string            `yaml:"display_name"`
	BaseURL     string            `yaml:"base_url"`
	AuthType    string            `yaml:"auth_type"` // "api_key", "oauth", "none"
	AuthHeader  string            `yaml:"auth_header"`
	AuthPrefix  string            `yaml:"auth_prefix"`
	EnvKey      string            `yaml:"env_key"`
	Models      []ModelDef        `yaml:"models"`
	Format      string            `yaml:"format"` // "openai", "anthropic", "google"
	Headers     map[string]string `yaml:"headers"`
}

ProviderConfig defines an LLM provider declaratively via YAML.

func LoadProviderConfigs

func LoadProviderConfigs(dir string) ([]ProviderConfig, error)

LoadProviderConfigs reads all YAML provider definitions from a directory.

func (*ProviderConfig) Validate

func (pc *ProviderConfig) Validate() error

Validate checks a provider config for completeness.

type Recipe

type Recipe struct {
	Version      string      `yaml:"version"`
	Title        string      `yaml:"title"`
	Description  string      `yaml:"description"`
	Author       Author      `yaml:"author"`
	Instructions string      `yaml:"instructions"`
	Parameters   []Parameter `yaml:"parameters"`
	Extensions   []Extension `yaml:"extensions"`
	Activities   []string    `yaml:"activities"`
	Prompt       string      `yaml:"prompt"`
	SubRecipes   []string    `yaml:"sub_recipes"`
}

Recipe is the top-level YAML recipe definition.

func LoadRecipe

func LoadRecipe(path string) (*Recipe, error)

LoadRecipe reads and parses a YAML recipe file.

func LoadRecipesFromDir

func LoadRecipesFromDir(dir string) ([]*Recipe, error)

LoadRecipesFromDir loads all .yaml/.yml recipes from a directory.

func (*Recipe) RenderPrompt

func (r *Recipe) RenderPrompt(params map[string]string) (string, error)

RenderPrompt applies parameter values to the recipe prompt template.

func (*Recipe) Validate

func (r *Recipe) Validate() error

Validate checks a recipe for completeness.

type Runner

type Runner struct {
	RecipeDirs []string
	Timeout    time.Duration
}

Runner executes recipes.

func NewRunner

func NewRunner() *Runner

NewRunner creates a recipe runner with default directories.

func (*Runner) Execute

func (rn *Runner) Execute(_ context.Context, r *Recipe, params map[string]string) (string, error)

Execute runs a recipe with the given parameters, returning the rendered prompt.

func (*Runner) List

func (rn *Runner) List() []*Recipe

List returns all available recipes.

Jump to

Keyboard shortcuts

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