Tool Builder

Do more with Tool Builder

As you become more proficient with the Tool Builder in Relevance AI, you can tap into advanced features to create more sophisticated and robust AI tools. These features offer greater control and flexibility in how your tools operate.

Using default values to create constants

In the Relevance Tool Builder, default values allow you to pre-set inputs for your tools, offering a way to establish constants, streamline testing, and improve overall tool efficiency.

What are default values?

Default values are predetermined inputs that you can set for any parameter in your tool. When a tool runs, these values will be automatically filled in unless explicitly overridden.

Key uses of default values

  1. Establishing constants: Create values that remain consistent across multiple tool runs. This is useful for API keys, base URLs, or any standard parameters your tool frequently uses.
  2. Providing example inputs: Set up realistic sample data for testing purposes. This helps in quickly demonstrating how the tool works without manual input each time.
  3. Setting up frequently used values: Streamline tool usage by pre-filling common inputs. This reduces the chance of user error in repetitive tasks.

Set default values

In the Tool Builder interface, locate the input field you want to set a default for. Enter or select the desired default value, then click set “Set value as default”.

Advanced settings for LLM step

Each step in your tool can be fine-tuned using advanced settings. To access these, click on the gear icon associated with any step in your tool's build interface.

To demo this, let’s break down the most important settings for the LLM Step:

Key settings:

Set a fallback model: This serves as a backup in case the primary model fails, ensuring your tool's reliability.

System prompt: While the main prompt in the LLM step defines the specific task or query, the system prompt sets the overall context and behavior of the model. Use the system prompt to define the AI's role, set constraints, or provide high-level instructions that apply to all interactions within this step.

LLM Validators: Validators are powerful tools to ensure the output from your LLM steps meets specific criteria.

Here are the key validator options:

  • Is Valid JSON:
    • This validator checks if the LLM's output is properly formatted JSON. This is useful when you expect structured data from the LLM and want to ensure it can be parsed correctly.
  • Matches JSONSchema:
    • This goes a step further than the valid JSON check by verifying if the JSON structure matches a predefined schema. It’s ideal for ensuring the LLM output contains all required fields and data types.
  • Matches a Regex:
    • This allows you to input a regular expression (regex) pattern. The validator checks if the LLM output matches this pattern. It’s useful for ensuring specific formats (e.g., email addresses, phone numbers) or for identifying particular phrases or structures in the output.

Using these validators can significantly improve the reliability and consistency of your AI tools. They act as a quality control mechanism, ensuring that the output from each step meets your specified criteria before proceeding to the next step or returning results.

Steps: advanced options and controls

In the Tool Builder, each step in your workflow can be fine-tuned using advanced options. These options provide greater control over how your tool operates and processes data. To access these features, look for the three-dotted line icon in the top right corner of any step.

Re-run steps up to here

This feature allows you to re-execute all steps up to a specified point in your tool's workflow.

Select "Re-run steps up to here" from the options menu of the desired step.

The tool will reprocess all steps from the beginning up to and including the selected step.

Use cases:

  1. Testing changes: after modifying an earlier step, quickly see how it affects subsequent steps.
  2. Debugging: identify where issues might be occurring in your workflow.
  3. Impact analysis: figure out how changes in one step influence the rest of your tool.

Add conditions to run

Conditional logic allows you to create dynamic workflows where steps are executed based on specific criteria.

Select "Add conditions to run" from the step options. Define your condition using available variables and operators, and specify the action to be taken if the condition is met.

For example, you might set a condition like "If sentiment_score > 0.5, then run this step." This could be used in a customer feedback tool to trigger different actions based on the sentiment of the input.

By implementing conditions, you can create more sophisticated and responsive tools that adapt to different scenarios automatically.

Enable for each loops

For each loops allow a step or series of steps to be repeated for every item in a list or array.

Choose "Enable for each loops" from the step options, then select the list to iterate over. This can be:

  • A predefined list you provide.
  • A variable containing a list (e.g., results from a previous step).

To picture this in action, imagine you have a Google search step that generates a list of URLs. You could then use a for each loop to process each URL individually in subsequent steps, perhaps to extract content or analyze each webpage.

Key steps

Insert data to knowledge

The "Insert data to knowledge" step allows you to dynamically add new information to your knowledge tables.

This is particularly valuable when you need to update your databases with freshly generated or processed information.

For instance, imagine you've just analyzed a batch of customer feedback. Using this step, you can automatically insert the summarized insights into a dedicated "Customer Trends" table.

Code Steps

Javascript Step

The JavaScript step lets you extend your AI tool's capabilities through custom code. You can write and execute JavaScript to perform complex operations or manipulate data.

For example, you could use JavaScript to map or filter an array of data, generating new structures or extracting specific information. It's particularly useful for creating or modifying JSON objects, allowing you to format data precisely as needed for subsequent steps or for output.

This flexibility means you can tackle unique data processing challenges, implement custom algorithms, or even integrate with external libraries to enhance your tool's functionality.

Python Step

The Python step lets you perform advanced data manipulation and analysis. By incorporating Python scripts, you can tap into a vast ecosystem of libraries and tools, making your AI tools incredibly versatile.

For instance, you might use the popular pandas library to clean and transform complex datasets before feeding them into a Language Model (LLM).

Python's ecosystem means you can tackle tasks ranging from statistical analysis to machine learning, all within your AI tool.

API Step

The API step serves as a bridge between your AI tool and the vast world of external services and databases, enabling you to make API calls, and opening up many possibilities for data retrieval and system interactions.

You can fetch real-time data from various sources, keeping your tool's information current and relevant. Additionally, you can trigger actions in other systems, allowing your AI tool to not just process information but also initiate changes in connected platforms.

For example, you might integrate with a Customer Relationship Management (CRM) system to pull up-to-date customer data, which can then be used to generate highly personalized content or responses.

This level of integration means your AI tools can work seamlessly with your existing tech stack.

Learn Relevance

Become an expert builder
0:00