Skip to content

author_recipe

Scope: builder · Signature: author_recipe(knowledgebase_id: str, action: {create|edit_sql|update|get|preview|materialize|refresh}, recipe_id: str | None = None, params: dict[str, Any] | None = None, idempotency_key: str | None = None) -> Any

Use to shape a training table: a recipe is your own SELECT over the knowledge base.

action="create": params name, sql (DuckDB SELECT over the KB tables — describe_catalog lists them), description, target_column (the label, the one column allowed to look past the prediction moment), prediction_moment (a date "2026-01-01" or words "the 1st of each month"; a snapshot with no time column: "the snapshot (cross-sectional)", never today's date) and/or as_of_column (an output column holding each row's own moment). "edit_sql": sql. "update": name, target_column, prediction_moment, as_of_column. "get". "preview": offset, limit (≤100), sample. "materialize": dataset_name, roles_from_dataset_id (the approved dataset whose column roles it keeps) → a dataset. "refresh": re-run it. Timing is checked against the prediction moment — state one: SQL reading rows dated after it is refused, each leak named with its fix, and SQL the check cannot analyse is refused too; possible leaks come back as warnings. Features are SQL columns, not Python. All but "create" need recipe_id. Returns its idempotency_key.

Powered by: the recipe compiler and its point-in-time check (backend/app/services/knowledgebase/point_in_time.py).