llm-testrunner-components 1.2.0 → 1.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/index.cjs.js +8 -6
- package/dist/cjs/index.cjs.js.map +1 -1
- package/dist/cjs/llm-testrunner.cjs.js +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/collection/components/llm-test-runner/header/llm-test-runner-header.js +2 -2
- package/dist/collection/components/llm-test-runner/header/llm-test-runner-header.js.map +1 -1
- package/dist/collection/components/llm-test-runner/llm-test-runner.js +22 -1
- package/dist/collection/components/llm-test-runner/llm-test-runner.js.map +1 -1
- package/dist/collection/lib/evaluation/evaluators/semantic/SemanticEvaluator.js +4 -3
- package/dist/collection/lib/evaluation/evaluators/semantic/SemanticEvaluator.js.map +1 -1
- package/dist/components/index.js +1 -1
- package/dist/components/llm-test-runner.js +1 -1
- package/dist/components/{p-Bb89MYYu.js → p-JPMPoOC8.js} +2 -2
- package/dist/components/p-JPMPoOC8.js.map +1 -0
- package/dist/esm/index.js +8 -6
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/llm-testrunner.js +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/llm-testrunner/index.esm.js +1 -1
- package/dist/llm-testrunner/index.esm.js.map +1 -1
- package/dist/llm-testrunner/llm-testrunner.esm.js +1 -1
- package/dist/types/components/llm-test-runner/header/llm-test-runner-header.d.ts +1 -0
- package/dist/types/components/llm-test-runner/llm-test-runner.d.ts +1 -0
- package/dist/types/components.d.ts +9 -0
- package/package.json +1 -1
- package/dist/components/p-Bb89MYYu.js.map +0 -1
package/dist/esm/index.js
CHANGED
|
@@ -29616,6 +29616,7 @@ class SemanticEvaluator {
|
|
|
29616
29616
|
}
|
|
29617
29617
|
}
|
|
29618
29618
|
async performEvaluation(request) {
|
|
29619
|
+
const threshold = request.evaluationParameters?.threshold ?? DEFAULT_SEMANTIC_PASS_SCORE;
|
|
29619
29620
|
try {
|
|
29620
29621
|
await this.initialize();
|
|
29621
29622
|
// Split expectedOutcome by newlines to create keywords array
|
|
@@ -29625,7 +29626,7 @@ class SemanticEvaluator {
|
|
|
29625
29626
|
.map(k => k.trim())
|
|
29626
29627
|
.filter(k => k.length > 0)
|
|
29627
29628
|
: [];
|
|
29628
|
-
const keywordMatches = await evaluateKeywordsSemantically(SemanticEvaluator.extractor, request.actualResponse, expectedKeywords,
|
|
29629
|
+
const keywordMatches = await evaluateKeywordsSemantically(SemanticEvaluator.extractor, request.actualResponse, expectedKeywords, threshold);
|
|
29629
29630
|
const totalItems = keywordMatches.length;
|
|
29630
29631
|
// calculate the overall score by averaging the score of the keyword matches
|
|
29631
29632
|
const keywordScore = keywordMatches.reduce((acc, curr) => acc + curr.evaluationApproachResult.score, 0);
|
|
@@ -29633,7 +29634,7 @@ class SemanticEvaluator {
|
|
|
29633
29634
|
const passed = keywordMatches.every(match => match.found);
|
|
29634
29635
|
const evaluationParameters = {
|
|
29635
29636
|
approach: EvaluationApproach.SEMANTIC,
|
|
29636
|
-
threshold
|
|
29637
|
+
threshold,
|
|
29637
29638
|
};
|
|
29638
29639
|
return {
|
|
29639
29640
|
testCaseId: request.testCaseId,
|
|
@@ -29655,7 +29656,7 @@ class SemanticEvaluator {
|
|
|
29655
29656
|
keywordMatches: [],
|
|
29656
29657
|
evaluationParameters: {
|
|
29657
29658
|
approach: EvaluationApproach.SEMANTIC,
|
|
29658
|
-
threshold
|
|
29659
|
+
threshold,
|
|
29659
29660
|
},
|
|
29660
29661
|
evaluationApproachResult: {
|
|
29661
29662
|
score: 0,
|
|
@@ -30060,7 +30061,7 @@ const Button = (props, children) => {
|
|
|
30060
30061
|
return (h("button", { type: type, class: classes, disabled: disabled || loading, onClick: onClick, "aria-busy": loading, "aria-label": ariaLabel }, icon && h("span", { class: "icon" }, icon), children));
|
|
30061
30062
|
};
|
|
30062
30063
|
|
|
30063
|
-
const LLMTestRunnerHeader = ({ isExportingTestSuite, isExportingTestResults, isRunningAll, useSave = false, isSaving = false, onImport, onExportSuite, onExportResults, onRunAll, onSave, }) => {
|
|
30064
|
+
const LLMTestRunnerHeader = ({ isExportingTestSuite, isExportingTestResults, isRunningAll, useSave = false, isSaving = false, usePromptEditor = false, onImport, onExportSuite, onExportResults, onRunAll, onSave, }) => {
|
|
30064
30065
|
let fileInputRef;
|
|
30065
30066
|
const handleFileSelect = () => {
|
|
30066
30067
|
fileInputRef?.click();
|
|
@@ -30073,7 +30074,7 @@ const LLMTestRunnerHeader = ({ isExportingTestSuite, isExportingTestResults, isR
|
|
|
30073
30074
|
onImport(file);
|
|
30074
30075
|
}
|
|
30075
30076
|
};
|
|
30076
|
-
return (h("header", { class: "test-runner-header" }, h("div", { class: "test-runner-header__left" }, h("input", { class: "test-runner-header--hidden", type: "file", ref: el => (fileInputRef = el), onChange: handleFileChange, accept: ".json,application/json" }), h(Button, { variant: "secondary", size: "md", onClick: handleFileSelect, icon: "\u2191" }, "Import Test Suite"), h(Button, { variant: "secondary", size: "md", onClick: onExportSuite, disabled: isExportingTestSuite, loading: isExportingTestSuite, icon: isExportingTestSuite ? '⏳' : '↓' }, isExportingTestSuite ? 'Exporting...' : 'Export Test Suite')), h("div", { class: "test-runner-header__right" }, h(Button, { variant: "secondary", size: "md", icon: "\u2699\uFE0F" }, "Prompt Editor"), h(Button, { variant: "secondary", size: "md", onClick: onExportResults, disabled: isExportingTestResults, loading: isExportingTestResults, icon: isExportingTestResults ? '⏳' : '↓' }, isExportingTestResults ? 'Exporting...' : 'Export Test Results'), useSave && (h(Button, { variant: "secondary", size: "md", onClick: onSave, disabled: isSaving, loading: isSaving, icon: isSaving ? '⏳' : '💾' }, isSaving ? 'Saving...' : 'Save')), h(Button, { "aria-label": "Run All", variant: "primary", size: "md", onClick: onRunAll, disabled: isRunningAll, loading: isRunningAll }, isRunningAll ? 'Running...' : 'Run All'))));
|
|
30077
|
+
return (h("header", { class: "test-runner-header" }, h("div", { class: "test-runner-header__left" }, h("input", { class: "test-runner-header--hidden", type: "file", ref: el => (fileInputRef = el), onChange: handleFileChange, accept: ".json,application/json" }), h(Button, { variant: "secondary", size: "md", onClick: handleFileSelect, icon: "\u2191" }, "Import Test Suite"), h(Button, { variant: "secondary", size: "md", onClick: onExportSuite, disabled: isExportingTestSuite, loading: isExportingTestSuite, icon: isExportingTestSuite ? '⏳' : '↓' }, isExportingTestSuite ? 'Exporting...' : 'Export Test Suite')), h("div", { class: "test-runner-header__right" }, usePromptEditor && (h(Button, { variant: "secondary", size: "md", icon: "\u2699\uFE0F" }, "Prompt Editor")), h(Button, { variant: "secondary", size: "md", onClick: onExportResults, disabled: isExportingTestResults, loading: isExportingTestResults, icon: isExportingTestResults ? '⏳' : '↓' }, isExportingTestResults ? 'Exporting...' : 'Export Test Results'), useSave && (h(Button, { variant: "secondary", size: "md", onClick: onSave, disabled: isSaving, loading: isSaving, icon: isSaving ? '⏳' : '💾' }, isSaving ? 'Saving...' : 'Save')), h(Button, { "aria-label": "Run All", variant: "primary", size: "md", onClick: onRunAll, disabled: isRunningAll, loading: isRunningAll }, isRunningAll ? 'Running...' : 'Run All'))));
|
|
30077
30078
|
};
|
|
30078
30079
|
|
|
30079
30080
|
const ResponseOutput = ({ output, isRunning, }) => {
|
|
@@ -30254,6 +30255,7 @@ const LLMTestRunner = class {
|
|
|
30254
30255
|
save;
|
|
30255
30256
|
delayMs = 500;
|
|
30256
30257
|
useSave = false;
|
|
30258
|
+
usePromptEditor = false;
|
|
30257
30259
|
initialTestCases;
|
|
30258
30260
|
defaultExpectedOutcomeSchema;
|
|
30259
30261
|
testCases = [
|
|
@@ -30479,7 +30481,7 @@ const LLMTestRunner = class {
|
|
|
30479
30481
|
}
|
|
30480
30482
|
}
|
|
30481
30483
|
render() {
|
|
30482
|
-
return (h("div", { key: '
|
|
30484
|
+
return (h("div", { key: '323b5e140740bb72d4767c0763c382a6b125caa2', class: "test-runner-container" }, h(LLMTestRunnerHeader, { key: 'e1e2efdf6cfe5f406de7e26e745b5775f307d294', isExportingTestSuite: this.isExportingTestSuite, isExportingTestResults: this.isExportingTestResults, isRunningAll: this.isRunningAll, useSave: this.useSave, isSaving: this.isSaving, usePromptEditor: this.usePromptEditor, onImport: file => this.handleImport(file), onExportSuite: () => this.handleExportTestSuite(), onExportResults: () => this.handleExportTestResults(), onRunAll: () => this.runAllTests(), onSave: () => this.handleSave() }), h(ErrorMessage, { key: 'c6a34b81f66c6cd835eb8bc253f7a28d68c49874', message: this.error, onClear: () => (this.error = '') }), h("div", { key: '674daad8a2754afc8144463e9a173690a3d1d589', class: "test-runner-container__content" }, h(LLMTestCases, { key: '96c1aeae37f56378b7a9b5d54be73c5df48ae448', testCases: this.testCases, onRun: testCase => this.runSingleTest(testCase).catch(() => { }), onDelete: id => this.deleteTestCase(id), onAddTestCase: () => this.addNewTestCase(), handleTestCaseChange: this.handleTestCaseChange, onExpectedOutcomeChange: this.handleExpectedOutcomeChange }))));
|
|
30483
30485
|
}
|
|
30484
30486
|
};
|
|
30485
30487
|
LLMTestRunner.style = tokensCss() + (llmTestRunnerCss() + (llmTestRunnerHeaderCss() + (llmTestCasesCss() + (llmTestCaseRowCss() + (rowActionsCss() + (evaluationSummaryCss() + (responseOutputCss() + (errorMessageCss() + (buttonCss() + iconButtonCss())))))))));
|