Using AI in CODED FLOWS

AI to Generate Bricks

When the standard library of Bricks doesn't cover a specific processing need for your workflow, CODED FLOWS empowers you to leverage Artificial Intelligence to generate custom Bricks simply by describing them.

Configuring AI Providers

To leverage the AI Brick generation feature, you need to configure your preferred Artificial Intelligence provider by adding your API key and selecting the corresponding model within the CODED FLOWS settings.

Access Settings

  1. Navigate to the main application settings. This is typically found via "Settings".
  2. Locate the field for entering your API Key.
  3. Select the desired AI model from the available options in a dropdown menu. The available models will depend on the API key you provided. CODED FLOWS will use this model to generate your custom Bricks.

Get API Key for OpenAI

  1. Go to the OpenAI developer platform: https://platform.openai.com/.
  2. Log in or sign up for an account.
  3. Navigate to the "API keys" section (usually found under your profile or in the sidebar).
  4. Click "Create new secret key."
  5. Give your key a name and click "Create secret key."
  6. Crucially, copy the key immediately. You will not be able to view it again after closing the modal. Store it securely.

Get API Key for Anthropic

  1. Go to the Anthropic console: https://console.anthropic.com/.
  2. Log in or sign up for an account.
  3. Click on your profile icon in the top right corner and select "API Keys."
  4. Click the "Create Key" button.
  5. Enter a name for your key and click "Create Key."
  6. Copy your key and store it in a safe place. You will not be able to view it again once you leave the page.

Get API Key for Mistral AI

  1. Go to the Mistral AI console: https://console.mistral.ai/.
  2. Log in or sign up for an account.
  3. Navigate to the "API Keys" section (usually in the sidebar under "API").
  4. Click "Create new key."
  5. Optionally, give your key a name and set an expiration date.
  6. Click "Create key."
  7. Copy the generated key immediately as it will not be shown again. Store it securely.

Get API Key for DeepSeek

  1. Go to the DeepSeek Open Platform: https://platform.deepseek.com/.
  2. Log in or sign up for an account. You might be able to use a Google account to log in.
  3. Click on "API keys" in the left-hand sidebar.
  4. Click "Create new key."
  5. Give it a name and click "Create API key."
  6. Copy your API key. It will only be visible at the time of creation. Store it securely.

Generating Bricks

Once you have entered your API key and selected your model in the CODED FLOWS settings, the AI Brick generation feature will be enabled and ready for use as described in the previous sections.

Step 1: Initiate the Prompt

  1. Navigate to your project's graph interface.
  2. Locate the Prompt a Brick button, typically positioned at the top of the sidebar containing the Brick library.
  3. Click this button.
  1. This action will open the AI Brick generation prompt modal.

Step 2: Define Your Brick

The prompt modal is where you describe the Brick you want the AI to create. Provide clear and detailed information for the best results:

  1. Brick Main Processing:

    • Describe the core functionality. What task should this Brick perform? Be specific about the process (e.g., "Read a CSV file, filter rows where column 'A' is greater than 10, and output the filtered data").
  2. Inputs:

    • Define each input the Brick requires. For every input, specify:
      • Description: A clear name or label (e.g., "Input File Path", "Threshold Value").
      • Type: The expected data type (e.g., string, integer, float, list, dataframe).
  3. Outputs:

    • Define each output the Brick will produce. For every output, specify:
      • Description: A clear name or label (e.g., "Filtered Data", "Row Count").
      • Type: The data type of the result (e.g., dataframe, integer).
  4. Options (Contextual Menu):

    • Describe any parameters that should be configurable when a user clicks the "Options" button on the Brick instance in the graph. Explain what each parameter controls (e.g., "Delimiter: Specify the character used to separate columns in the CSV, defaults to comma").
  5. Once you have filled in all the necessary details, click the Generate button.

Generation Time

Generating a Brick via AI may feel slower compared to typical AI chat responses. This is because CODED FLOWS must wait for the AI to generate the complete, structured underlying code before it can translate that code into a functional, visual Brick node for your graph. Patience during this step ensures a properly constructed Brick.

Step 3: Using Your AI-Generated Brick

  • Once the generation is complete, the new Brick will appear.
  • You can now drag, drop, and connect this AI-generated Brick within your workflow exactly like any standard Brick.

Step 4: Modifying and Iterating

  • AI-generated Bricks have an additional button, with the AI icon, compared to standard Bricks.
  • Clicking this button re-opens the prompt modal, pre-filled with the original prompts used to generate that specific Brick.
  • You can use this feature to:
    • Review the original requirements.
    • Modify the prompts to refine the Brick's behavior, inputs, outputs, or options.
    • Click Generate again to create a new Brick based on your updated description. This allows for iterative improvement.

Step 5: Debugging Errors

  • Should an error occur when running an AI-generated Brick, a distinct Debug button will appear on the Brick node itself within the graph.
  • Clicking this Debug button sends a request to the AI, asking it to analyze the error context and attempt to automatically correct the underlying Python script associated with the Brick.

Step 6: Organizing AI Bricks

  1. Default Location: All Bricks generated using this AI feature are automatically placed in a dedicated package named AI Generated Bricks. You can find this package listed in the sidebar along with other Brick packages.
  2. Virtual Packages: For better organization based on themes or functionality, you can create "virtual packages" via the main Packages menu in the application.
  3. Moving Bricks: To move an AI-generated Brick to a virtual package you've created:
    • Locate the specific AI-generated Brick in the sidebar list (under AI Generated Bricks).
    • Click the contextual menu button (often represented by three dots) next to the Brick's name.
    • Select the Move option from the menu.
    • Choose the desired destination virtual package from the subsequent list or dropdown.

This AI generation capability provides a powerful way to extend CODED FLOWS' functionality and tailor it precisely to your unique data processing needs.

Previous
Building UI Flows