truncate_prompt
A tool to truncate a list of strings to ensure the combined prompt fits within the context window.
Arguments
Name
Type
Description
Required
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
Type
Description
prompt
A truncated prompt that fits within the specified token limit.
Example
Last updated