@agent-inspect/eval 6.31.35 → 6.31.36

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/index.d.ts DELETED
@@ -1,213 +0,0 @@
1
- import { TraceReadResult } from 'agent-inspect/readers';
2
-
3
- type CircuitRuleId = "circuit.same-tool-repetition" | "circuit.same-args-repetition" | "circuit.max-loop-iterations" | "circuit.max-retries" | "circuit.tool-timeout" | "circuit.runaway-llm-loop" | "circuit.excessive-branch-width";
4
- interface ThresholdRule {
5
- maxRepeats: number;
6
- }
7
- interface MaxIterationsRule {
8
- maxIterations: number;
9
- }
10
- interface MaxRetriesRule {
11
- maxRetries: number;
12
- }
13
- interface ToolTimeoutRule {
14
- maxDurationMs: number;
15
- }
16
- interface RunawayLlmLoopRule {
17
- maxLlmCalls: number;
18
- }
19
- interface ExcessiveBranchWidthRule {
20
- maxWidth: number;
21
- }
22
- interface RunCircuitsOptions {
23
- rules?: readonly CircuitRuleId[];
24
- sameToolRepetition?: ThresholdRule;
25
- sameArgsRepetition?: ThresholdRule;
26
- maxLoopIterations?: MaxIterationsRule;
27
- maxRetries?: MaxRetriesRule;
28
- toolTimeout?: ToolTimeoutRule;
29
- runawayLlmLoop?: RunawayLlmLoopRule;
30
- excessiveBranchWidth?: ExcessiveBranchWidthRule;
31
- }
32
-
33
- type GuardrailRuleId = "guardrail.banned-phrase" | "guardrail.pii-leak" | "guardrail.unsafe-tool-args" | "guardrail.prompt-injection" | "guardrail.structured-output" | "guardrail.oversize-output" | "guardrail.required-json-shape";
34
- interface BannedPhraseOptions {
35
- phrases: readonly string[];
36
- caseInsensitive?: boolean;
37
- }
38
- interface PiiLeakOptions {
39
- profile?: "local" | "share" | "strict";
40
- minSeverity?: "info" | "warning" | "error";
41
- }
42
- interface UnsafeToolArgsOptions {
43
- blockedTools?: readonly string[];
44
- maxDepth?: number;
45
- maxStringLength?: number;
46
- }
47
- interface PromptInjectionOptions {
48
- patterns?: readonly string[];
49
- }
50
- interface JsonSchemaField {
51
- type?: "string" | "number" | "boolean" | "object" | "array";
52
- enum?: readonly unknown[];
53
- required?: readonly string[];
54
- }
55
- interface StructuredOutputOptions {
56
- schema: Record<string, JsonSchemaField>;
57
- }
58
- interface OversizeOutputOptions {
59
- maxLength?: number;
60
- maxSerializedLength?: number;
61
- }
62
- interface RequiredJsonShapeOptions {
63
- requiredKeys: readonly string[];
64
- }
65
- interface GuardrailRuleOptions {
66
- bannedPhrase?: BannedPhraseOptions;
67
- piiLeak?: PiiLeakOptions;
68
- unsafeToolArgs?: UnsafeToolArgsOptions;
69
- promptInjection?: PromptInjectionOptions;
70
- structuredOutput?: StructuredOutputOptions;
71
- oversizeOutput?: OversizeOutputOptions;
72
- requiredJsonShape?: RequiredJsonShapeOptions;
73
- }
74
- interface RunGuardrailsOptions extends GuardrailRuleOptions {
75
- rules?: readonly GuardrailRuleId[];
76
- }
77
-
78
- interface EvalGuardrailRuleOptions extends RunGuardrailsOptions {
79
- rules: readonly GuardrailRuleId[];
80
- }
81
- interface EvalCircuitRuleOptions extends RunCircuitsOptions {
82
- rules: readonly CircuitRuleId[];
83
- }
84
- declare function createEvalGuardrailRule(options: EvalGuardrailRuleOptions): EvalRule;
85
- declare function createEvalCircuitRule(options: EvalCircuitRuleOptions): EvalRule;
86
-
87
- type EvalStatus = "pass" | "fail" | "error";
88
- type EvalSeverity = "error" | "warning" | "info";
89
- type EvalFindingStatus = "pass" | "fail" | "warning";
90
- type EvalRuleCategory = "run" | "tool" | "llm" | "retrieval" | "structure" | "safety" | "custom";
91
- interface EvalEvidence {
92
- runId?: string;
93
- eventId?: string;
94
- parentId?: string;
95
- traceId?: string;
96
- spanId?: string;
97
- kind?: string;
98
- name?: string;
99
- path?: string;
100
- }
101
- interface EvalFinding {
102
- ruleId: string;
103
- status: EvalFindingStatus;
104
- severity: EvalSeverity;
105
- message: string;
106
- expected?: unknown;
107
- actual?: unknown;
108
- evidence: EvalEvidence[];
109
- }
110
- interface EvalDiagnostic {
111
- code: "AI_EVAL_TRACE_UNREADABLE" | "AI_EVAL_UNSUPPORTED_FORMAT" | "AI_EVAL_AMBIGUOUS_FORMAT" | "AI_EVAL_RUN_SELECTION_REQUIRED" | "AI_EVAL_RULE_FAILED" | "AI_EVAL_INVALID_ARGUMENTS" | "AI_EVAL_INVALID_CONFIG" | "AI_EVAL_CONFIG_LOAD_FAILED";
112
- severity: EvalSeverity;
113
- message: string;
114
- ruleId?: string;
115
- }
116
- type EvalDiagnosticCode = EvalDiagnostic["code"];
117
- interface EvalSummary {
118
- passed: number;
119
- failed: number;
120
- warnings: number;
121
- errors: number;
122
- }
123
- interface EvalRunResult {
124
- ok: boolean;
125
- status: EvalStatus;
126
- format: string;
127
- runId?: string;
128
- summary: EvalSummary;
129
- findings: EvalFinding[];
130
- diagnostics: EvalDiagnostic[];
131
- }
132
- interface EvalInput {
133
- trace: string | URL | TraceReadResult;
134
- runId?: string;
135
- format?: "agent-inspect-jsonl" | "openinference-json" | "otlp-json" | "auto";
136
- }
137
- interface EvalRunOptions {
138
- checks?: readonly EvalRule[];
139
- runId?: string;
140
- format?: EvalInput["format"];
141
- }
142
- type EvalRunInput = EvalInput | string | TraceReadResult;
143
- /** Experimental options for deterministic answer/context overlap checks. */
144
- interface ContextOverlapOptions {
145
- minOverlap?: number;
146
- minSharedTerms?: number;
147
- answerKeys?: readonly string[];
148
- contextKeys?: readonly string[];
149
- }
150
- /** Experimental options for deterministic quote grounding checks. */
151
- interface QuoteOverlapOptions {
152
- answerKeys?: readonly string[];
153
- contextKeys?: readonly string[];
154
- minQuoteLength?: number;
155
- requireQuote?: boolean;
156
- }
157
- /** Experimental options for deterministic citation presence checks. */
158
- interface CitationPresenceOptions {
159
- answerKeys?: readonly string[];
160
- citationKeys?: readonly string[];
161
- }
162
- /** Experimental options for deterministic source-id checks. */
163
- interface RequiredSourceIdsOptions {
164
- sourceIdKeys?: readonly string[];
165
- }
166
- /** Experimental options for deterministic answer length checks. */
167
- interface AnswerLengthBoundsOptions {
168
- minCharacters?: number;
169
- maxCharacters?: number;
170
- minWords?: number;
171
- maxWords?: number;
172
- answerKeys?: readonly string[];
173
- }
174
- /** Experimental options for deterministic unsupported-phrase checks. */
175
- interface BannedUnsupportedPhrasesOptions {
176
- answerKeys?: readonly string[];
177
- }
178
- interface EvalRule {
179
- id: string;
180
- category: EvalRuleCategory;
181
- severity?: EvalSeverity;
182
- evaluate(context: EvalContext): readonly EvalFinding[];
183
- }
184
- type EvalRunTree = TraceReadResult["runs"][number];
185
- type EvalNode = EvalRunTree["children"][number];
186
- interface EvalContext {
187
- format: string;
188
- run: EvalRunTree;
189
- nodes: readonly EvalNode[];
190
- events: readonly TraceReadResult["events"][number][];
191
- }
192
- declare function evalRun(input: EvalRunInput, options?: EvalRunOptions): Promise<EvalRunResult>;
193
- declare const checks: {
194
- readonly requireSuccess: () => EvalRule;
195
- readonly requiredTools: (required: readonly string[]) => EvalRule;
196
- readonly forbiddenTools: (forbidden: readonly string[]) => EvalRule;
197
- readonly maxDurationMs: (maxDurationMs: number) => EvalRule;
198
- readonly maxDepth: (maxDepth: number) => EvalRule;
199
- readonly maxRetries: (maxRetries: number) => EvalRule;
200
- readonly maxTotalTokens: (maxTotalTokens: number) => EvalRule;
201
- readonly noFailedSteps: () => EvalRule;
202
- readonly requiredRetrievalBeforeGeneration: () => EvalRule;
203
- readonly requiredDecisionMetadata: (keys: readonly string[]) => EvalRule;
204
- readonly contextOverlap: (options?: ContextOverlapOptions) => EvalRule;
205
- readonly quoteOverlap: (options?: QuoteOverlapOptions) => EvalRule;
206
- readonly citationPresence: (options?: CitationPresenceOptions) => EvalRule;
207
- readonly requiredSourceIds: (requiredIds: readonly string[], options?: RequiredSourceIdsOptions) => EvalRule;
208
- readonly answerLengthBounds: (options: AnswerLengthBoundsOptions) => EvalRule;
209
- readonly bannedUnsupportedPhrases: (phrases?: readonly string[], options?: BannedUnsupportedPhrasesOptions) => EvalRule;
210
- };
211
- declare function renderEvalMarkdown(result: EvalRunResult): string;
212
-
213
- export { type AnswerLengthBoundsOptions, type BannedUnsupportedPhrasesOptions, type CitationPresenceOptions, type ContextOverlapOptions, type EvalCircuitRuleOptions, type EvalContext, type EvalDiagnostic, type EvalDiagnosticCode, type EvalEvidence, type EvalFinding, type EvalFindingStatus, type EvalGuardrailRuleOptions, type EvalInput, type EvalRule, type EvalRuleCategory, type EvalRunInput, type EvalRunOptions, type EvalRunResult, type EvalSeverity, type EvalStatus, type EvalSummary, type QuoteOverlapOptions, type RequiredSourceIdsOptions, checks, createEvalCircuitRule, createEvalGuardrailRule, evalRun, renderEvalMarkdown };