Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/agentTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ export class AgentTest {
const filename = preview
? `${apiName}-preview-${new Date().toISOString()}.xml`
: `${apiName}.aiEvaluationDefinition-meta.xml`;
const definitionPath = join(outputDir, sanitizeFilename(filename));
const definitionPath = join(outputDir, sanitizeFilename(filename));

const xml = buildMetadataXml(convertToMetadata(agentTestSpec));
await mkdir(outputDir, { recursive: true });
Expand Down Expand Up @@ -359,15 +359,15 @@ const convertToMetadata = (spec: TestSpec): AiEvaluationDefinition => ({
})),
{
expectedValue: tc.expectedTopic as string,
name: 'topic_assertion',
name: 'topic_sequence_match',
},
{
expectedValue: `[${(tc.expectedActions ?? []).map((v) => `'${v}'`).join(',')}]`,
name: 'actions_assertion',
name: 'action_sequence_match',
},
{
expectedValue: tc.expectedOutcome as string,
name: 'output_validation',
name: 'bot_response_rating',
},
...ensureArray(tc.metrics).map((m) => ({ name: m })),
],
Expand Down
44 changes: 22 additions & 22 deletions test/agentTest.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -284,11 +284,11 @@ testCases:
</parameter>
</expectation>
<expectation>
<name>topic_assertion</name>
<name>topic_sequence_match</name>
<expectedValue>Weather</expectedValue>
</expectation>
<expectation>
<name>actions_assertion</name>
<name>action_sequence_match</name>
<expectedValue>["GetLocation","GetWeather"]</expectedValue>
</expectation>
<expectation>
Expand All @@ -298,7 +298,7 @@ testCases:
<name>coherence</name>
</expectation>
<expectation>
<name>output_validation</name>
<name>bot_response_rating</name>
<expectedValue>Sunny with a high of 75F</expectedValue>
</expectation>
</testCase>
Expand Down Expand Up @@ -500,7 +500,7 @@ testCases:
</contextVariable>
</inputs>
<expectation>
<name>topic_assertion</name>
<name>topic_sequence_match</name>
<expectedValue>Weather</expectedValue>
</expectation>
<expectation>
Expand All @@ -523,7 +523,7 @@ testCases:
</parameter>
</expectation>
<expectation>
<name>actions_assertion</name>
<name>action_sequence_match</name>
<expectedValue>[&apos;GetLocation&apos;,&apos;GetWeather&apos;, 'myWeather', "myWeatherResponse"]</expectedValue>
</expectation>
<expectation>
Expand All @@ -536,7 +536,7 @@ testCases:
<name>output_latency_milliseconds</name>
</expectation>
<expectation>
<name>output_validation</name>
<name>bot_response_rating</name>
<expectedValue>Sunny with a high of 75F</expectedValue>
</expectation>
</testCase>
Expand Down Expand Up @@ -611,7 +611,7 @@ testCases:
<utterance>What's the weather like?</utterance>
</inputs>
<expectation>
<name>topic_assertion</name>
<name>topic_sequence_match</name>
<expectedValue>Weather</expectedValue>
</expectation>
</testCase>
Expand Down Expand Up @@ -658,7 +658,7 @@ testCases:
</contextVariables>
</inputs>
<expectation>
<name>actions_assertion</name>
<name>action_sequence_match</name>
<expectedValue>["GetWeather"]</expectedValue>
</expectation>
</testCase>
Expand All @@ -671,7 +671,7 @@ testCases:
<utterance>Will it rain tomorrow?</utterance>
</inputs>
<expectation>
<name>actions_assertion</name>
<name>action_sequence_match</name>
<expectedValue>["GetForecast"]</expectedValue>
</expectation>
</testCase>
Expand Down Expand Up @@ -699,7 +699,7 @@ testCases:
<utterance>Test</utterance>
</inputs>
<expectation>
<name>actions_assertion</name>
<name>action_sequence_match</name>
<expectedValue>invalid json</expectedValue>
</expectation>
</testCase>
Expand Down Expand Up @@ -741,7 +741,7 @@ testCases:
</conversationHistory>
</inputs>
<expectation>
<name>topic_assertion</name>
<name>topic_sequence_match</name>
<expectedValue>Music</expectedValue>
</expectation>
</testCase>
Expand Down Expand Up @@ -812,11 +812,11 @@ testCases:
pollStatus: sinon.stub().resolves({
response: { success: true, details: { componentFailures: [] } },
}),
};
};
const mockComponentSet = {
deploy: sinon.stub().resolves(mockDeploy),
};
sinon
sinon;
sinon.stub(ComponentSetBuilder, 'build').resolves(mockComponentSet as never);
await AgentTest.create(connection, 'PlainName', 'test.yaml', {
outputDir: 'tmp\\test',
Expand Down Expand Up @@ -891,15 +891,15 @@ testCases:
<testCase>
<expectation>
<expectedValue>GeneralCRM</expectedValue>
<name>topic_assertion</name>
<name>topic_sequence_match</name>
</expectation>
<expectation>
<expectedValue>[&apos;IdentifyRecordByName&apos;,&apos;QueryRecords&apos;]</expectedValue>
<name>actions_assertion</name>
<name>action_sequence_match</name>
</expectation>
<expectation>
<expectedValue>contacts available name available with Acme are listed</expectedValue>
<name>output_validation</name>
<name>bot_response_rating</name>
</expectation>
<inputs>
<utterance>List contact names associated with Acme account</utterance>
Expand All @@ -913,15 +913,15 @@ testCases:
<testCase>
<expectation>
<expectedValue>GeneralCRM</expectedValue>
<name>topic_assertion</name>
<name>topic_sequence_match</name>
</expectation>
<expectation>
<expectedValue>[&apos;IdentifyRecordByName&apos;,&apos;QueryRecords&apos;]</expectedValue>
<name>actions_assertion</name>
<name>action_sequence_match</name>
</expectation>
<expectation>
<expectedValue>contacts available emails available with Acme are listed</expectedValue>
<name>output_validation</name>
<name>bot_response_rating</name>
</expectation>
<expectation>
<name>completeness</name>
Expand Down Expand Up @@ -979,15 +979,15 @@ testCases:
<testCase>
<expectation>
<expectedValue>Music</expectedValue>
<name>topic_assertion</name>
<name>topic_sequence_match</name>
</expectation>
<expectation>
<expectedValue>[&apos;GetMusicPreferences&apos;,&apos;SummarizeData&apos;]</expectedValue>
<name>actions_assertion</name>
<name>action_sequence_match</name>
</expectation>
<expectation>
<expectedValue>Here&apos;s a summary of your listening preferences based on your history</expectedValue>
<name>output_validation</name>
<name>bot_response_rating</name>
</expectation>
<expectation>
<name>completeness</name>
Expand Down
Loading