Expandable can be used like so, providing a callback
which returns a string or a promise to a string:
<Expandable value={async sizing => {
let data = 'hi';
while (true) {
const more = getMoreUsefulData();
if (await sizing.countTokens(data + more) > sizing.tokenBudget) { break }
data += more;
}
}
return data;
}} />
After the prompt is rendered, the renderer sums up the tokens used by
all messages. If there is unused budget, then any <Expandable />
elements' values are called again with their PromptSizing is increased
by the token excess.
If there are multiple <Expandable /> elements, then they're re-called
in the order in which they were initially rendered. Because they're
designed to fill up any remaining space, it usually makes sense to have
at most one <Expandable /> element per prompt.
Expandable can be used like so, providing a callback which returns a string or a promise to a string:
After the prompt is rendered, the renderer sums up the tokens used by all messages. If there is unused budget, then any
<Expandable />
elements' values are called again with theirPromptSizing
is increased by the token excess.If there are multiple
<Expandable />
elements, then they're re-called in the order in which they were initially rendered. Because they're designed to fill up any remaining space, it usually makes sense to have at most one<Expandable />
element per prompt.