Smart Function

Estimated reading: 2 minutes 145 views

In Robility flow this component was renamed from Lambda Filter to Smart Function.

The Smart Function component uses an LLM to generate a Lambda function to filter or transform structured data based on natural language instructions. You must connect this component to a Language Model component, which is used to generate a function based on the natural language instructions you provide in the Instructions parameter. The LLM runs the function against the data input and then outputs the results as Data.

The following example uses the API Request endpoint to pass JSON data from the https://jsonplaceholder.typicode.com/users endpoint to the Smart Function component. Then, the Smart Function component passes the data, and the instruction extract emails to the attached Language Model component. From there, the LLM generates a filter function that extracts email addresses from the JSON data, returning the filtered data as chat output.

Smart Function parameters

Some Smart Function component input parameters are hidden by default in the visual editor. You can toggle parameters through the Controls in the component’s header menu.

Name Display Name Info
data Data Input parameter. The structured data to filter or transform using a Lambda function.
llm Language Model Input parameter. Connect LanguageModel output from a Language Model component.
filter_instruction Instructions Input parameter. Natural language instructions for how to filter or transform the data. The LLM uses these instructions to create a Lambda function.
sample_size Sample Size Input parameter. For large datasets, the number of characters to sample from the dataset head and tail. Only applied if the dataset meets or exceeds max_size. Default: 1000.
max_size Max Size Input parameter. The number of characters for the dataset to be considered large, which triggers sampling by the sample_size value. Default: 30000.
Share this Doc

Smart Function

Or copy link

CONTENTS