Portal
SandboxAPI v1Not signed inExternal user: —

Recipe transform

Problem: Preview vegan substitutions for a recipe. TypeScriptPython const preview = await client.transforms.preview({ recipeId: "...", goal: "VEGAN", }); for…

Problem: Preview vegan substitutions for a recipe.

const preview = await client.transforms.preview({
  recipeId: "...",
  goal: "VEGAN",
});
for (const swap of preview.transformed_ingredients) {
  console.log(swap.from_name, "→", swap.to_name, swap.confidence);
}

const execution = await client.transforms.execute({
  recipeId: "...",
  goal: "VEGAN",
});
const provenance = await client.transforms.explain({
  executionId: execution.execution_id,
});
console.log(provenance.explanations);
# Transforms resource ships in a future Python SDK release.
# Use reasoning until then:
result = client.reason(
    recipe_id="...",
    goal="TRANSFORMATION",
    dietary_preferences=["VEGAN"],
)
for step in result.transformation_plan:
    print(step.from_name, "→", step.to_name)

See TypeScript transforms resource.