chunk_prompt
A tool to segment a list of strings into chunks 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 segmentation.
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 segmentation. Lower values mean higher priority for retention.
greedy
boolean
Whether to use the greedy segmentation algorithm.
Returns
Type
Description
prompt array
A list of segmented prompts that each fit within the specified token limit.
Example
Last updated