truncate_prompt

A tool to truncate a list of strings to ensure the combined prompt fits within the context window.

Arguments

NameTypeDescriptionRequired

contents

array

A list of objects each containing content and a priority for truncation.

contents.content

prompt

The content to be included in the prompt. If this is an array, the elements will be joined with double newlines.

contents.priority

number

The priority for truncation. Lower values mean higher priority for retention.

Returns

TypeDescription

prompt

A truncated prompt that fits within the specified token limit.

Example

- name: truncate_prompt
  arguments:
    contents:
      - content: '{{controller_content}}'
        priority: 3
      - content: '{{directive_content}}'
        priority: 1
      - content: '{{view_content}}'
        priority: 2
  returns: <truncated-prompt>

Last updated