Skip to content

Commit

Permalink
Merge pull request #84 from microsoft/joh/brainy-jay
Browse files Browse the repository at this point in the history
  • Loading branch information
jrieken authored Sep 12, 2024
2 parents 43ec582 + 66c5716 commit c607486
Showing 1 changed file with 40 additions and 0 deletions.
40 changes: 40 additions & 0 deletions src/base/test/renderer.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1129,6 +1129,46 @@ LOW MED 00 01 02 03 04 05 06 07 08 09
);
})

test.skip('none-grow, greedy-grow, grow elements, nested', async () => {

class StringEchoBudget extends PromptElement<IProps, number> {
prepare(sizing: PromptSizing): Promise<number> {
return Promise.resolve(sizing.tokenBudget);
}
render(budget: number) {
return (
<>
{this.props.useBudget ? `consume=${this.props.useBudget}, ` : ''}
{this.props.name}={budget}
</>
);
}
}

await flexTest(<>
<UserMessage>
<StringEchoBudget name='1' useBudget={5} />
<StringEchoBudget name='2' useBudget={10} />
<StringEchoBudget name='3' useBudget={5} />
<StringEchoBudget name='grow4' flexGrow={2} useBudget={1} />
<StringEchoBudget name='grow5' flexGrow={3} useBudget={79} />
</UserMessage>
</>,
[
{
content: [
'consume=5, 1=33',
'consume=10, 2=33',
'consume=5, 3=33',
'consume=1, grow4=1',
'consume=79, grow5=80'
].join('\n'),
role: ChatRole.User,
}
]
);
})

test('counts budget used in nested elements', async () => {
class Nested extends PromptElement {
render() {
Expand Down

0 comments on commit c607486

Please sign in to comment.