Skip to content

Commit

Permalink
add over / under validation tests
Browse files Browse the repository at this point in the history
  • Loading branch information
atierian committed Aug 30, 2024
1 parent 4de6c72 commit 7919c94
Showing 1 changed file with 25 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -236,8 +236,14 @@ test('generation route all scalar types', () => {

describe('generation route invalid inference configuration', () => {
const maxTokens = 'inferenceConfiguration: { maxTokens: 0 }';
const temperature = 'inferenceConfiguration: { temperature: 1.1 }';
const topP = 'inferenceConfiguration: { topP: -2 }';
const temperature = {
over: 'inferenceConfiguration: { temperature: 1.1 }',
under: 'inferenceConfiguration: { temperature: -0.1 }',
};
const topP = {
over: 'inferenceConfiguration: { topP: 1.1 }',
under: 'inferenceConfiguration: { topP: -0.1 }',
};

const generationRoute = (invalidInferenceConfig: string): string => {
return `
Expand All @@ -258,15 +264,27 @@ describe('generation route invalid inference configuration', () => {
);
});

test('temperature invalid', () => {
expect(() => transform(generationRoute(temperature))).toThrow(
test('temperature over', () => {
expect(() => transform(generationRoute(temperature.over))).toThrow(
'@generation directive temperature valid range: Minimum value of 0. Maximum value of 1. Provided: 1.1',
);
});

test('topP invalid', () => {
expect(() => transform(generationRoute(topP))).toThrow(
'@generation directive topP valid range: Minimum value of 0. Maximum value of 1. Provided: -2',
test('topP over', () => {
expect(() => transform(generationRoute(topP.over))).toThrow(
'@generation directive topP valid range: Minimum value of 0. Maximum value of 1. Provided: 1.1',
);
});

test('temperature under', () => {
expect(() => transform(generationRoute(temperature.under))).toThrow(
'@generation directive temperature valid range: Minimum value of 0. Maximum value of 1. Provided: -0.1',
);
});

test('topP under', () => {
expect(() => transform(generationRoute(topP.under))).toThrow(
'@generation directive topP valid range: Minimum value of 0. Maximum value of 1. Provided: -0.1',
);
});
});
Expand Down

0 comments on commit 7919c94

Please sign in to comment.