Utilities

Estimated reading: 3 minutes

Helper components provide utility functions to help manage data and perform simple tasks in your flow.

Calculator

The Calculator component performs basic arithmetic operations on mathematical expressions. It supports addition, subtraction, multiplication, division, and exponentiation operations.

For an example of using this component in a flow, see the Python Interpreter component.

Calculator parameters

Name Type Description
expression String Input parameter. The arithmetic expression to evaluate, such as 4*4*(33/22)+12-20.
result Data Output parameter. The calculation result as a Data object containing the evaluated expression.

Current Date

The Current Date component returns the current date and time in a selected timezone. This component provides a flexible way to obtain timezone-specific date and time information within a Robility flow pipeline.

Current Date parameters

Name Type Description
timezone String Input parameter. The timezone for the current date and time.
current_date String Output parameter. The resulting current date and time in the selected timezone.

Legacy Helper components

The following components are legacy components. You can use these components in your flows, but they are no longer maintained and may be removed in a future release. It is recommended that you replace legacy components with the recommended alternatives as soon as possible.

a. Chat History: Replaced by the Message History component 
b. Message Store: Replaced by the Message History component

Create List

This component dynamically creates a record with a specified number of fields. It accepts the following parameters:

Name Type Description
n_fields Integer Input parameter. The number of fields to be added to the record.
text_key String Input parameter. The key used as text.
list List Output parameter. The dynamically created list with the specified number of fields.

ID Generator

This component generates a unique ID. It accepts the following parameters:

Name Type Description
unique_id String Input parameter. The generated unique ID.
id String Output parameter. The generated unique ID.

Output Parser

Replace the legacy Output Parser component with the Structured Output component and Parser component. The components you need depend on the data types and complexity of the parsing task.

The Output Parser component transforms the output of a language model into comma-separated values (CSV) format, such as [“item1”, “item2”, “item3”], using CommaSeparatedListOutputParser. The Structured Output component is a good alternative for this component because it also formats LLM responses with support for custom schemas and more complex parsing.

Parsing components only provide formatting instructions and parsing functionality. They don’t include prompts. You must connect parsers to Prompt Template components to create prompts that LLMs can use.

1. Open a flow that has a Chat InputLanguage Model, and Chat Output components. 
2. Add Output Parser and Prompt Template components to your flow. 
3. Define your LLM’s prompt in the Prompt Template component’s Template, including all instructions and pre-loaded context. Make sure to include a {format_instructions} variable where you will inject the formatting instructions from the Output Parser component. For example:

You are a helpful assistant that provides lists of information.

Variables in the template dynamically add fields to the Prompt Template component so that your flow can receive definitions for those values from other components, Robility flow global variables, or fixed input.

4. Connect the Output Parser component’s output to the Prompt Template Component’s format instructions input.

The Output Parser component accepts the following parameters:

Name Type Description
parser_type String Input parameter. Sets the parser type as "CSV".
format_instructions String Output parameter. Pass to a prompt template to include formatting instructions for LLM responses.
output_parser Parser Output parameter. The constructed output parser that can be used to parse LLM responses.
Share this Doc

Utilities

Or copy link

CONTENTS