feat: use default params if not provided (#6701)

This commit is contained in:
darkskygit
2024-04-25 10:59:46 +00:00
parent 3297486e31
commit a0c219e036
3 changed files with 30 additions and 10 deletions

View File

@@ -105,9 +105,14 @@ test('should be able to render prompt', async t => {
'should have param keys'
);
t.deepEqual(testPrompt?.params, msg.params, 'should have params');
t.throws(() => testPrompt?.finish({ src_language: 'abc' }), {
instanceOf: Error,
});
// will use first option if a params not provided
t.deepEqual(testPrompt?.finish({ src_language: 'abc' }), [
{
content: 'translate eng to chs: ',
params: { dest_language: 'chs', src_language: 'eng' },
role: 'system',
},
]);
});
test('should be able to render listed prompt', async t => {