This step allows you to:
Add a CALC step to your custom command. Click to edit the step and get a list of available functions, organized into four groups: parameters, extraction, numbers, texts and lists.
To set a parameter value, type in value, choose parameter name and format. For example, a function to capture the current page's URL into a parameter would look like this:
Use this function to make a copy of a parameter, such as gpt, or a list.
ChatML declaration
# Set parameter
- type: calc
func: set
param: saved.url
format: auto
value: '{{url}}'
# Clone parameter
- type: calc
func: clone
from: gpt
to: cloned.gpt
Use extraction functions to extract code blocks and data from text parameters, e.g. GPT responses.
Select the source parameter for extraction and a parameter where the extracted data will be stored.
For example, use Extract functions to extract all prices from a web page and store them in the {{prices}} parameter:
ChatML declaration
- type: calc
func: extract-data
to: prices
param: page
data: price
index: all
Use this function to increment a numerical parameter value. This can be useful if you need to count events within loops or generate unique values, such as User IDs.
ChatML declaration
- type: calc
func: increment
param: userID
delta: '1'
The text functions within the CALC step enables you to:
ChatML declaration
# Change text case
- type: calc
func: change-case
to: text
param: text
case: upper
# Take the first line
- type: calc
func: first-line
to: first.line
param: text
# Take the last line
- type: calc
func: last-line
to: last.line
param: text
# Split by delimiter
- type: calc
func: split
to: splitted.text
param: text
delimiter: ', '
# Replace text
- type: calc
func: replace
to: text
param: text
regex: /(\d{1,2}):(\d{2})/gmi
template: $1 hours $2 minutes
# Match text
- type: calc
func: match
to: search.result
param: text
regex: /(\d{1,2}):(\d{2})/gmi
template: $1 hours $2 minutes
HARPA AI allows you to perform a variety of operations on lists, including:
ChatML declaration
# Add list item
- type: calc
func: list-add
index: last
list: list
item: param
# Filter list items
- type: calc
func: list-filter
list: list
item: param
match: '{ "name": John }'
matched: retain
# Update list items
- type: calc
func: list-update
list: list
match: '{ "status": in progress }'
prop: '{ "status": null }'
# Merge two lists
- type: calc
func: list-merge
to: merged.list
listA: a
listB: b
by: id
All rights reserved © HARPA AI TECHNOLOGIES LLC, 2021 — 2024
Designed and engineered in Finland 🇫🇮