summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--docs/docs/walkthroughs/create-a-recipe.md12
1 files changed, 10 insertions, 2 deletions
diff --git a/docs/docs/walkthroughs/create-a-recipe.md b/docs/docs/walkthroughs/create-a-recipe.md
index 74800531..a2805782 100644
--- a/docs/docs/walkthroughs/create-a-recipe.md
+++ b/docs/docs/walkthroughs/create-a-recipe.md
@@ -1,6 +1,14 @@
# Create a recipe
-*TODO: Describe step-by-step how to create a recipe*
+_TODO: Describe step-by-step how to create a recipe_
+
+> Creating a recipe is the same as creating a step, except that you may choose to break it up into intermediate steps. Start by creating a subclass of Step. You should first consider what will be the parameters of your recipe. These are defined as attributes in the step, as with `input_file_path: str` below. Next, write the `run` method. This method takes the ContinueSDK as a parameter, giving you all the tools you need to write your recipe/steps (if it's missing something, let us know, we'll add it!). You can write any code inside the run method; this is what will happen when your recipe is run, line for line. As you're writing the run method, you want to consider how to break it up into sub-steps; each step will be displayed as a cell in the GUI, so this makes a difference to the end user. To break something off into a sub-step, simply make a new subclass of Step just like this one, with parameters and a run method, and call it inside of the parent step using `await sdk.run_step(MySubStep(<parameters>))`. To understand all of the other things you can do inside of a step with the `ContinueSDK`, see its documentation page.
+
+> Finally, every Step is displayed with a description of what it has done. If you'd like to override the default description of your steps, which is just the class name, then implement the `describe` method. You can:
+
+- Return a static string
+- Store state in a class attribute (prepend with a double underscore, which signifies (through Pydantic) that this is not a parameter for the Step, just internal state) during the run method, and then grab this in the describe method.
+- Use state in conjunction with the `models` parameter of the describe method to autogenerate a description with a language model. For example, if you'd used an attribute called `__code_written` to store a string representing some code that was written, you could implement describe as `return (await models.gpt35()).complete(f"{self.__code_written}\n\nSummarize the changes made in the above code.")`.
## 1. Create a step
@@ -65,4 +73,4 @@ class CreatePipelineRecipe(Step):
SetupPipelineStep() >>
ValidatePipelineStep()
)
-``` \ No newline at end of file
+```