Code recipes
Code recipes for Notebook users allows adding functional code logic within a recipe in the machine learning flow without having to create a separate custom template. This simplifies the ability to create new custom templates within a recipe. With the AI capabilities integrated into the platform, users can invoke AI and retrieve the code based on the query passed. The generated code is used to create custom code recipes on the Notebook in different stages of model building. Users can set the ask.ai
flag in the code to True
to use the AI capabilities for code generation and set the same parameter to False
to manually write the code for creating custom code recipes.
Fetching code from the AI
Use this code block to fetch the code logic you want to use in the flow from the AI based on the query passed as an input.
Firstly, you have to create a recipe for a dataset inside the project.
Secondly, use the following code block to send your query to the AI and get the code.
The following table describes about each parameter in the generate_code
block:
user_input
The input that is given to the AI to generate the code.
ask_ai
Set this flag either to False or True. Setting this to True will allow you to use the AI capabilities and fetch the code from the AI for the query passed and changing this to False will allow you to manually write the code within the recipe.
with_signature
By default, it is set to True.
outputs
The output generated by the template.
Output from the AI
The following is the code block generated by the AI for the given user input.
Creating a code recipe manually
Use this procedure to write the code within a recipe for executing logic in the flow manually. In the generate_code
block, you have to set the ask.ai
flag to False to manually the code within a recipe.
For more information to use code recipes in your projects, refer the following sample projects:
Sample projects