AgentMark provides a set of built-in filters that you can use to manipulate and transform data within your prompts. Filters are functions that take an input value and return a transformed output.

Basic Usage

Use filters by calling them on values in your prompts:

---
name: greeting
metadata:
  model:
    name: gpt-4
test_settings:
  props:
    userName: "alice"
    items: ["apple", "banana", "cherry"]
---

<System>
Your name is {capitalize(props.userName)}!
Your items are: {join(props.items, ", ")}
</System>
<User>
What is your name, and what items do you have?
</User>

Built-in Filters

AgentMark includes several built-in filters:

Text Manipulation

  • capitalize(str): Capitalizes first character of string
  • lower(str): Converts string to lowercase
  • upper(str): Converts string to uppercase
  • truncate(str, length): Truncates string to specified length
  • replace(str, search, replace): Replaces text in string

Array Operations

  • join(array, separator): Joins array elements with separator

Number Formatting

  • abs(num): Returns absolute value
  • round(num, decimals): Rounds number to decimal places

Data Transformation

  • dump(obj): Converts object to JSON string
  • urlencode(str): URL encodes a string

Have Questions?

We’re here to help! Choose the best way to reach us: