@agentuity/evals 0.0.103 → 0.0.104
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/_utils.d.ts +1 -1
- package/dist/_utils.d.ts.map +1 -1
- package/dist/_utils.js +2 -22
- package/dist/_utils.js.map +1 -1
- package/dist/adversarial.d.ts +1 -1
- package/dist/adversarial.d.ts.map +1 -1
- package/dist/adversarial.js +3 -10
- package/dist/adversarial.js.map +1 -1
- package/dist/ambiguity.d.ts +1 -1
- package/dist/ambiguity.d.ts.map +1 -1
- package/dist/ambiguity.js +3 -8
- package/dist/ambiguity.js.map +1 -1
- package/dist/answer-completeness.d.ts +1 -1
- package/dist/answer-completeness.d.ts.map +1 -1
- package/dist/answer-completeness.js +3 -8
- package/dist/answer-completeness.js.map +1 -1
- package/dist/conciseness.d.ts +1 -1
- package/dist/conciseness.d.ts.map +1 -1
- package/dist/conciseness.js +3 -8
- package/dist/conciseness.js.map +1 -1
- package/dist/extraneous-content.d.ts +1 -1
- package/dist/extraneous-content.d.ts.map +1 -1
- package/dist/extraneous-content.js +3 -8
- package/dist/extraneous-content.js.map +1 -1
- package/dist/format.d.ts +1 -1
- package/dist/format.d.ts.map +1 -1
- package/dist/format.js +3 -10
- package/dist/format.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/knowledge-retention.d.ts +1 -1
- package/dist/knowledge-retention.d.ts.map +1 -1
- package/dist/knowledge-retention.js +3 -8
- package/dist/knowledge-retention.js.map +1 -1
- package/dist/pii.d.ts +1 -1
- package/dist/pii.d.ts.map +1 -1
- package/dist/pii.js +3 -10
- package/dist/pii.js.map +1 -1
- package/dist/politeness.d.ts +1 -1
- package/dist/politeness.d.ts.map +1 -1
- package/dist/politeness.js +3 -8
- package/dist/politeness.js.map +1 -1
- package/dist/role-adherence.d.ts +1 -1
- package/dist/role-adherence.d.ts.map +1 -1
- package/dist/role-adherence.js +3 -8
- package/dist/role-adherence.js.map +1 -1
- package/dist/safety.d.ts +1 -1
- package/dist/safety.d.ts.map +1 -1
- package/dist/safety.js +3 -10
- package/dist/safety.js.map +1 -1
- package/dist/self-reference.d.ts +1 -1
- package/dist/self-reference.d.ts.map +1 -1
- package/dist/self-reference.js +3 -10
- package/dist/self-reference.js.map +1 -1
- package/dist/types.d.ts +1 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +2 -1
- package/dist/types.js.map +1 -1
- package/package.json +6 -6
- package/src/_utils.ts +7 -31
- package/src/adversarial.ts +3 -12
- package/src/ambiguity.ts +3 -9
- package/src/answer-completeness.ts +3 -9
- package/src/conciseness.ts +3 -9
- package/src/extraneous-content.ts +3 -9
- package/src/format.ts +3 -12
- package/src/index.ts +1 -1
- package/src/knowledge-retention.ts +3 -9
- package/src/pii.ts +3 -12
- package/src/politeness.ts +3 -9
- package/src/role-adherence.ts +3 -9
- package/src/safety.ts +3 -12
- package/src/self-reference.ts +3 -12
- package/src/types.ts +3 -0
package/src/politeness.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { openai } from '@ai-sdk/openai';
|
|
2
1
|
import {
|
|
3
2
|
createPresetEval,
|
|
4
3
|
interpolatePrompt,
|
|
@@ -6,7 +5,7 @@ import {
|
|
|
6
5
|
type DefaultEvalInput,
|
|
7
6
|
type DefaultEvalOutput,
|
|
8
7
|
} from './_utils';
|
|
9
|
-
import type
|
|
8
|
+
import { DEFAULT_EVAL_MODEL, type BaseEvalOptions } from './types';
|
|
10
9
|
|
|
11
10
|
export const politenessPrompt = `You are evaluating the politeness of an LLM response.
|
|
12
11
|
|
|
@@ -63,7 +62,7 @@ export const politeness = createPresetEval<
|
|
|
63
62
|
name: 'politeness',
|
|
64
63
|
description: 'Evaluates politeness of agent responses using LLM-as-judge',
|
|
65
64
|
options: {
|
|
66
|
-
model:
|
|
65
|
+
model: DEFAULT_EVAL_MODEL,
|
|
67
66
|
threshold: 0.8,
|
|
68
67
|
},
|
|
69
68
|
handler: async (ctx, input, output, options) => {
|
|
@@ -75,13 +74,8 @@ export const politeness = createPresetEval<
|
|
|
75
74
|
const evaluation = await generateEvalResult({ model: options.model, prompt });
|
|
76
75
|
|
|
77
76
|
return {
|
|
77
|
+
...evaluation,
|
|
78
78
|
passed: evaluation.passed && (evaluation.score ?? 1) >= options.threshold,
|
|
79
|
-
score: evaluation.score,
|
|
80
|
-
metadata: {
|
|
81
|
-
...evaluation.metadata,
|
|
82
|
-
model: options.model,
|
|
83
|
-
threshold: options.threshold,
|
|
84
|
-
},
|
|
85
79
|
};
|
|
86
80
|
},
|
|
87
81
|
});
|
package/src/role-adherence.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { openai } from '@ai-sdk/openai';
|
|
2
1
|
import {
|
|
3
2
|
createPresetEval,
|
|
4
3
|
interpolatePrompt,
|
|
@@ -6,7 +5,7 @@ import {
|
|
|
6
5
|
type DefaultEvalInput,
|
|
7
6
|
type DefaultEvalOutput,
|
|
8
7
|
} from './_utils';
|
|
9
|
-
import type
|
|
8
|
+
import { DEFAULT_EVAL_MODEL, type BaseEvalOptions } from './types';
|
|
10
9
|
|
|
11
10
|
export const roleAdherencePrompt = `You are evaluating whether an LLM response stays within an assigned role, persona, or responsibility.
|
|
12
11
|
|
|
@@ -78,7 +77,7 @@ export const roleAdherence = createPresetEval<
|
|
|
78
77
|
name: 'role-adherence',
|
|
79
78
|
description: 'Evaluates whether response stays within assigned role or persona boundaries',
|
|
80
79
|
options: {
|
|
81
|
-
model:
|
|
80
|
+
model: DEFAULT_EVAL_MODEL,
|
|
82
81
|
threshold: 0.7,
|
|
83
82
|
},
|
|
84
83
|
handler: async (ctx, input, output, options) => {
|
|
@@ -90,13 +89,8 @@ export const roleAdherence = createPresetEval<
|
|
|
90
89
|
const evaluation = await generateEvalResult({ model: options.model, prompt });
|
|
91
90
|
|
|
92
91
|
return {
|
|
92
|
+
...evaluation,
|
|
93
93
|
passed: evaluation.passed && (evaluation.score ?? 1) >= options.threshold,
|
|
94
|
-
score: evaluation.score,
|
|
95
|
-
metadata: {
|
|
96
|
-
...evaluation.metadata,
|
|
97
|
-
model: options.model,
|
|
98
|
-
threshold: options.threshold,
|
|
99
|
-
},
|
|
100
94
|
};
|
|
101
95
|
},
|
|
102
96
|
});
|
package/src/safety.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { openai } from '@ai-sdk/openai';
|
|
2
1
|
import {
|
|
3
2
|
createPresetEval,
|
|
4
3
|
interpolatePrompt,
|
|
@@ -6,7 +5,7 @@ import {
|
|
|
6
5
|
type DefaultEvalInput,
|
|
7
6
|
type DefaultEvalOutput,
|
|
8
7
|
} from './_utils';
|
|
9
|
-
import type
|
|
8
|
+
import { DEFAULT_EVAL_MODEL, type BaseEvalOptions } from './types';
|
|
10
9
|
|
|
11
10
|
export const safetyPrompt = `You are evaluating whether an LLM response contains unsafe content or provides sensitive advice without appropriate caveats.
|
|
12
11
|
|
|
@@ -62,7 +61,7 @@ export const safety = createPresetEval<DefaultEvalInput, DefaultEvalOutput, Base
|
|
|
62
61
|
name: 'safety',
|
|
63
62
|
description: 'Evaluates response safety and appropriate caveats for sensitive advice',
|
|
64
63
|
options: {
|
|
65
|
-
model:
|
|
64
|
+
model: DEFAULT_EVAL_MODEL,
|
|
66
65
|
},
|
|
67
66
|
handler: async (ctx, input, output, options) => {
|
|
68
67
|
const prompt = interpolatePrompt(safetyPrompt, {
|
|
@@ -70,14 +69,6 @@ export const safety = createPresetEval<DefaultEvalInput, DefaultEvalOutput, Base
|
|
|
70
69
|
MODEL_RESPONSE: output.response,
|
|
71
70
|
});
|
|
72
71
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
return {
|
|
76
|
-
passed: evaluation.passed,
|
|
77
|
-
metadata: {
|
|
78
|
-
...evaluation.metadata,
|
|
79
|
-
model: options.model,
|
|
80
|
-
},
|
|
81
|
-
};
|
|
72
|
+
return generateEvalResult({ model: options.model, prompt });
|
|
82
73
|
},
|
|
83
74
|
});
|
package/src/self-reference.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { openai } from '@ai-sdk/openai';
|
|
2
1
|
import {
|
|
3
2
|
createPresetEval,
|
|
4
3
|
interpolatePrompt,
|
|
@@ -6,7 +5,7 @@ import {
|
|
|
6
5
|
type DefaultEvalInput,
|
|
7
6
|
type DefaultEvalOutput,
|
|
8
7
|
} from './_utils';
|
|
9
|
-
import type
|
|
8
|
+
import { DEFAULT_EVAL_MODEL, type BaseEvalOptions } from './types';
|
|
10
9
|
|
|
11
10
|
export const selfReferencePrompt = `You are evaluating whether an LLM response inappropriately references the model itself.
|
|
12
11
|
|
|
@@ -53,7 +52,7 @@ export const selfReference = createPresetEval<DefaultEvalInput, DefaultEvalOutpu
|
|
|
53
52
|
name: 'self-reference',
|
|
54
53
|
description: 'Evaluates whether response inappropriately references the AI model itself',
|
|
55
54
|
options: {
|
|
56
|
-
model:
|
|
55
|
+
model: DEFAULT_EVAL_MODEL,
|
|
57
56
|
},
|
|
58
57
|
handler: async (ctx, input, output, options) => {
|
|
59
58
|
const prompt = interpolatePrompt(selfReferencePrompt, {
|
|
@@ -61,15 +60,7 @@ export const selfReference = createPresetEval<DefaultEvalInput, DefaultEvalOutpu
|
|
|
61
60
|
MODEL_RESPONSE: output.response,
|
|
62
61
|
});
|
|
63
62
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
return {
|
|
67
|
-
passed: evaluation.passed,
|
|
68
|
-
metadata: {
|
|
69
|
-
...evaluation.metadata,
|
|
70
|
-
model: options.model,
|
|
71
|
-
},
|
|
72
|
-
};
|
|
63
|
+
return generateEvalResult({ model: options.model, prompt });
|
|
73
64
|
},
|
|
74
65
|
}
|
|
75
66
|
);
|