RapidCanvas Docs
  • Welcome
  • GETTING STARTED
    • Quick start guide
    • Introduction to RapidCanvas
    • RapidCanvas Concepts
    • Accessing the platform
  • BASIC
    • Projects
      • Projects Overview
        • Creating a project
        • Reviewing the Projects listing page
        • Duplicating a Project
        • Modifying the project settings
        • Deleting Project(s)
        • Configuring global variables at the project level
        • Working on a project
        • Generating the about content for the project
        • Generating AI snippets for each node on the Canvas
        • Marking & Unmarking a Project as Favorite
      • Canvas overview
        • Shortcut options on canvas
        • Queuing the Recipes
        • Bulk Deletion of Canvas Nodes
        • AI Guide
      • Recipes
        • AI-assisted recipe
        • Rapid model recipe
        • Template recipe
        • Code Recipe
        • RAG Recipes
      • Scheduler overview
        • Creating a scheduler
        • Running the scheduler manually
        • Managing schedulers in a project
        • Viewing the schedulers in a project
        • Viewing the run history of a specific scheduler
        • Publishing the updated data pipeline to selected jobs from canvas
        • Fetching the latest data pipeline to a specific scheduler
        • Comparing the canvas of the scheduler with current canvas of the project
      • Predictions
        • Manual Prediction
        • Prediction Scheduler
      • Segments and Scenarios
      • DataApps
        • Model DataApp
        • Project Canvas Datasets
        • Custom Uploaded Datasets
        • SQL Sources
        • Documents and PDFs
        • Prediction Service
        • Scheduler
        • Import DataApp
    • Connectors
      • Importing dataset(s) from the local system
      • Importing Text Files from the Local System
      • Connectors overview
      • Connect to external connectors
        • Importing data from Google Cloud Storage (GCS)
        • Importing data from Amazon S3
        • Importing data from Azure Blob
        • Importing data from Mongo DB
        • Importing data from Snowflake
        • Importing data from MySQL
        • Importing data from Amazon Redshift
        • Importing data from Fivetran connectors
    • Workspaces
      • User roles and permissions
    • Artifacts & Models
      • Adding Artifacts at the Project Level
      • Adding Models at the Project Level
      • Creating an artifact at the workspace level
      • Managing artifacts at the workspace level
      • Managing Models at the Workspace Level
      • Prediction services
    • Environments Overview
      • Creating an environment
      • Editing the environment details
      • Deleting an environment
      • Monitoring the resource utilization in an environment
  • ADVANCED
    • Starter Guide
      • Quick Start
    • Setup and Installation
      • Installing and setting up the SDK
    • Helper Functions
    • Notebook Guide
      • Introduction
      • Create a template
      • Code Snippets
      • DataApps
      • Prediction Service
      • How to
        • How to Authenticate
        • Create a new project
        • Create a Custom Environment
        • Add a dataset
        • Add a recipe to the dataset
        • Manage cloud connection
        • Code recipes
        • Display a template on the UI
        • Create Global Variables
        • Scheduler
        • Create new scenarios
        • Create Template
        • Use a template in a flow notebook
      • Reference Implementations
        • DataApps
        • Artifacts
        • Connectors
        • Feature Store
        • ML model
        • ML Pipeline
        • Multiple Files
      • Sample Projects
        • Model build and predict
    • Rapid Rag
  • Additional Reading
    • Release Notes
      • May 14, 2025
      • April 21, 2025
      • April 01, 2025
      • Mar 18, 2025
      • Feb 27, 2025
      • Jan 27, 2025
      • Dec 26, 2024
      • Nov 26, 2024
      • Oct 24, 2024
      • Sep 11, 2024
        • Aug 08, 2024
      • Aug 29, 2024
      • July 18, 2024
      • July 03, 2024
      • June 19, 2024
      • May 30, 2024
      • May 15, 2024
      • April 17, 2024
      • Mar 28, 2024
      • Mar 20, 2024
      • Feb 28, 2024
      • Feb 19, 2024
      • Jan 30, 2024
      • Jan 16, 2024
      • Dec 12, 2023
      • Nov 07, 2023
      • Oct 25, 2023
      • Oct 01, 2024
    • Glossary
Powered by GitBook
On this page
  • Adding a Code Recipe
  • To add and run a Code Recipe:
  • Managing Checkpoints
  • Code Assist in Code Recipe
  • Adding Python Libraries & Enabling Rapid RAG Libraries in a Code Recipe
  1. BASIC
  2. Projects
  3. Recipes

Code Recipe

PreviousTemplate recipeNextRAG Recipes

Last updated 11 days ago

Adding a Code Recipe

Use this procedure to use a Code Recipe on the canvas.

To add and run a Code Recipe:

  1. Click the plus icon on the canvas and select Code Recipe from the list. This opens the Code tab.

    The default code displayed in the interface will also load in Jupyter Notebook when you click the Edit in Notebook button.

  1. Write the Python code to create a dataset or recipe that you want to add to the canvas in the Code tab. Alternatively, click Edit in Notebook to modify the code using the Jupyter Notebook editor. After making changes in the notebook, click Save Back to Recipe to save your updates seamlessly.

You can save your code at key points throughout the development of a recipe, ensuring progress is preserved and changes are tracked effectively. To learn more, see Managing Checkpoints.

Note:

  • You can add datasets, artifacts, and models available on the canvas as inputs to the code recipe using the plus icon in the Inputs section on the left.

  • You can view all nodes on the canvas by expanding the Canvas nodes section. Click on individual nodes to inspect them and use the copy option to replicate node names for use in code.

In the following example, you can see the code to fetch a dataset by making an API call:

  1. Click Conditions to add conditions within the recipe, where each condition is defined using a Key, an Operator, and a Value. The Key is predefined in the Project Settings, while you can specify the Value of your choice. The code executes only when the defined condition is met.

  2. Click Save Code to save the code. This enables the Test option. Use this option to test if the code is working as expected. You can use the Stop button to halt the recipe execution at any point during its test run.

    Once the test is successful, the output will be displayed on another tab.

Info: You can also view logs while testing the recipe by clicking Log for Test. This provides access to detailed records and allows you to either download the logs as a text file or open them in a new browser tab for a more detailed view.

Keyboard Shortcuts

  • Ctrl+T (or Cmd+T on Mac) → Test a recipe

  • Ctrl+R (or Cmd+R on Mac) → Run a recipe

  • Ctrl+S (or Cmd+S on Mac) → Save code changes

  1. Click Run to execute the code and create a dataset. If needed, you can stop the recipe at any time by clicking the Stop button.

    After running the code successfully, the generated dataset gets added to the canvas.

Managing Checkpoints

Checkpoints allow you to save your code at key stages, preserving progress and offering flexibility during development. You can tweak your code, create new checkpoint versions, and switch between them effortlessly. Once you're satisfied with a version, save it to the Current tab and run the recipe.

This feature is exclusively available in the Code Recipe under the Code tab. You can create up to five checkpoints and seamlessly navigate between them as needed.

Creating and Saving a Checkpoint

Open the Code Recipe:

  1. Click the plus icon on the canvas and select API Connector from the list. This opens the Code tab.

Write and Save Code:

  1. Write your code in the Code tab and click Save Code CheckPoint to save it as a checkpoint. Once saved, the checkpoint is displayed as a new tab.

    To delete a checkpoint, use the Delete Checkpoint option available on the checkpoint tab.

Run Checkpoint Code:

  1. To execute the code saved in a checkpoint, first click Save Code to Current on the respective checkpoint tab.

Switching Between Checkpoints

Open the API Connector:

  1. Click the plus icon on the canvas and select Code Recipe from the list. This opens the Code tab.

Switch Checkpoints:

  1. On the Current tab, click the Save Code CheckPoint drop-down to view all created checkpoints. Select the checkpoint you want to switch to.

    • To edit a checkpoint, use the Edit option corresponding to it in the drop-down menu.

    • To delete a checkpoint, use the Delete option next to it in the drop-down menu.

Note:

  • A maximum of five checkpoints can be created at any given time.

  • Switching between checkpoints allows you to experiment with different versions of your code without losing progress.

  • Finalized code must always be saved to the Current tab to run the recipe successfully.

Code Assist in Code Recipe

The Code Assist feature in the Code Recipe allows users to interact with an AI-powered assistant to generate and understand code without leaving the platform.

Users can:

  • Provide a code snippet to receive an explanation.

  • Enter a prompt to generate new code.

This eliminates the need to switch to external tools like AskAI chat, as users can now use the Ask Code Assistant directly within the platform.

Model Selection

Users can choose from different AI models to generate responses:

  • GPT-4o

  • GPT-4 Turbo

  • GPT-3.5 Mini

Users can switch between these models based on their requirements.

Copying & Clearing Responses

  • The generated code must be manually copied and pasted into the Code Recipe.

  • Users can clear conversation history to start fresh. The history clears automatically when the session expires.

Using Code Assist

  1. Click the plus icon on the canvas and select Code Recipe from the list. This opens the Code tab.

  2. Click Code Assist to open the Code Assist side sheet.

  3. Copy the code snippet from the Current tab and use Ctrl+I (Windows) or Cmd+I (Mac) to paste it into the prompt window.

  4. Enter your query to either:

    • Get an explanation of the code snippet.

    • Provide a prompt to generate a new code snippet.

Note: You can switch between GPT-4o, GPT-4 Turbo, or GPT-3.5 Turbo for optimal responses.

  1. Click Generate to obtain the AI-generated response.

  2. Manually copy the generated code and paste it into the Current tab at the appropriate place.

  3. Click Save Code to apply the changes.

Additional Options

  • Click Clear History to restart the conversation.

  • Click Close to exit the side sheet.

Adding Python Libraries & Enabling Rapid RAG Libraries in a Code Recipe

You can define custom Python libraries directly within a Code Recipe using the Requirements option. This allows for isolated dependency management, ensuring conflict-free execution by keeping each recipe's environment independent.

Libraries specified at the recipe level will override those defined at the environment level, ensuring that the correct versions are used to run your recipe successfully.

If you're working with RAG (Retrieval-Augmented Generation) recipes, you can also enable the Rapid RAG checkbox. This applies a curated set of custom libraries specifically developed to support and enhance the execution of RAG-based workflows.

To configure custom Python libraries and enable Rapid RAG support in a Code Recipe:

  1. Click the plus (+) icon on the canvas and select Code Recipe from the list.

  2. In the recipe panel, click Requirements to open the Requirements window. You will see two tabs:

    • Recipe Requirements (default)

    • Environment Requirements

  3. Under the Recipe Requirements tab, enter the required Python libraries to be used specifically for this recipe.

  4. To enable RAG-specific libraries, select the Rapid RAG checkbox under the RapidCanvas Libraries section.

  5. Click Save to apply your settings.

If no custom libraries are defined under Recipe Requirements, the recipe will automatically fall back to the Environment Requirements configured at the environment level.

Note: The libraries in the recipe requirements tab take precedence over the environment-level libraries during execution.