vitest-evals 0.10.0 → 0.11.0
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/README.md +18 -1
- package/dist/harness.d.mts +252 -1
- package/dist/harness.d.ts +252 -1
- package/dist/harness.js +298 -21
- package/dist/harness.js.map +1 -1
- package/dist/harness.mjs +289 -21
- package/dist/harness.mjs.map +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +331 -21
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +321 -21
- package/dist/index.mjs.map +1 -1
- package/dist/internal/toolCallScorer.js +32 -12
- package/dist/internal/toolCallScorer.js.map +1 -1
- package/dist/internal/toolCallScorer.mjs +32 -12
- package/dist/internal/toolCallScorer.mjs.map +1 -1
- package/dist/judges/factualityJudge.js.map +1 -1
- package/dist/judges/factualityJudge.mjs.map +1 -1
- package/dist/judges/index.js +291 -23
- package/dist/judges/index.js.map +1 -1
- package/dist/judges/index.mjs +291 -23
- package/dist/judges/index.mjs.map +1 -1
- package/dist/judges/judgeHarness.js +291 -23
- package/dist/judges/judgeHarness.js.map +1 -1
- package/dist/judges/judgeHarness.mjs +291 -23
- package/dist/judges/judgeHarness.mjs.map +1 -1
- package/dist/judges/toolCallJudge.js +32 -12
- package/dist/judges/toolCallJudge.js.map +1 -1
- package/dist/judges/toolCallJudge.mjs +32 -12
- package/dist/judges/toolCallJudge.mjs.map +1 -1
- package/dist/legacy/scorers/index.js +32 -12
- package/dist/legacy/scorers/index.js.map +1 -1
- package/dist/legacy/scorers/index.mjs +32 -12
- package/dist/legacy/scorers/index.mjs.map +1 -1
- package/dist/legacy/scorers/toolCallScorer.js +32 -12
- package/dist/legacy/scorers/toolCallScorer.js.map +1 -1
- package/dist/legacy/scorers/toolCallScorer.mjs +32 -12
- package/dist/legacy/scorers/toolCallScorer.mjs.map +1 -1
- package/dist/legacy.js +33 -13
- package/dist/legacy.js.map +1 -1
- package/dist/legacy.mjs +33 -13
- package/dist/legacy.mjs.map +1 -1
- package/dist/reporter.d.mts +5 -0
- package/dist/reporter.d.ts +5 -0
- package/dist/reporter.js +26 -2
- package/dist/reporter.js.map +1 -1
- package/dist/reporter.mjs +26 -2
- package/dist/reporter.mjs.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -33,8 +33,14 @@ workflow.
|
|
|
33
33
|
- `run(input, { metadata? })` executes the harness explicitly and returns a
|
|
34
34
|
normalized `HarnessRun`
|
|
35
35
|
- the returned `result.output` is the app-facing value you assert on directly
|
|
36
|
-
- the returned `result.session` is the canonical JSON-serializable
|
|
36
|
+
- the returned `result.session` is the canonical JSON-serializable transcript for
|
|
37
37
|
reporting, replay, tool assertions, and judges
|
|
38
|
+
- the returned `result.traces` contains JSON-serializable operation spans; the
|
|
39
|
+
first-party harnesses attach run, model, and tool spans automatically, while
|
|
40
|
+
`createHarness(...)` attaches fallback run and tool spans for custom harnesses
|
|
41
|
+
that do not return traces themselves. Span attributes include typed
|
|
42
|
+
OpenTelemetry GenAI semantic keys while still allowing provider-specific
|
|
43
|
+
metadata
|
|
38
44
|
- scenario-specific judge criteria can live in `input`; use `metadata` for
|
|
39
45
|
per-run expectations or harness configuration that are not part of the
|
|
40
46
|
scenario payload
|
|
@@ -127,6 +133,17 @@ describeEval("refund agent", { harness }, (it) => {
|
|
|
127
133
|
});
|
|
128
134
|
```
|
|
129
135
|
|
|
136
|
+
## Terminal Reporting
|
|
137
|
+
|
|
138
|
+
The terminal reporter has two eval report levels. Normal mode prints compact
|
|
139
|
+
test, score, usage, and tool-count summaries. Info mode adds per-tool summaries,
|
|
140
|
+
arguments, timing/size metadata, replay status, and final output summaries.
|
|
141
|
+
Set `VITEST_EVALS_REPORT_LEVEL=info`, or pass `--info` through the workspace
|
|
142
|
+
eval scripts, to enable it. `--verbose` and `-v` remain aliases for
|
|
143
|
+
compatibility.
|
|
144
|
+
|
|
145
|
+
Full transcripts and spans are preserved in the Vitest JSON report metadata.
|
|
146
|
+
|
|
130
147
|
## GitHub Actions Reporting
|
|
131
148
|
|
|
132
149
|
Use Vitest JSON as the eval report artifact. It preserves the `meta` field that
|
package/dist/harness.d.mts
CHANGED
|
@@ -4,6 +4,169 @@ type JsonPrimitive = string | number | boolean | null;
|
|
|
4
4
|
type JsonValue = JsonPrimitive | JsonValue[] | {
|
|
5
5
|
[key: string]: JsonValue;
|
|
6
6
|
};
|
|
7
|
+
/** Well-known OpenTelemetry GenAI operation names. */
|
|
8
|
+
type GenAiOperationName = "chat" | "create_agent" | "embeddings" | "execute_tool" | "generate_content" | "invoke_agent" | "invoke_workflow" | "retrieval" | "text_completion" | (string & {});
|
|
9
|
+
/** Well-known OpenTelemetry GenAI output content types. */
|
|
10
|
+
type GenAiOutputType = "image" | "json" | "speech" | "text" | (string & {});
|
|
11
|
+
/** Well-known OpenTelemetry GenAI provider names. */
|
|
12
|
+
type GenAiProviderName = "anthropic" | "aws.bedrock" | "azure.ai.inference" | "azure.ai.openai" | "cohere" | "deepseek" | "gcp.gemini" | "gcp.gen_ai" | "gcp.vertex_ai" | "groq" | "ibm.watsonx.ai" | "mistral_ai" | "openai" | "perplexity" | "x_ai" | (string & {});
|
|
13
|
+
/** Well-known OpenTelemetry GenAI token types. */
|
|
14
|
+
type GenAiTokenType = "input" | "output" | (string & {});
|
|
15
|
+
/** Well-known OpenTelemetry GenAI tool execution types. */
|
|
16
|
+
type GenAiToolType = "datastore" | "extension" | "function" | (string & {});
|
|
17
|
+
/** Typed subset of OpenTelemetry GenAI semantic attributes. */
|
|
18
|
+
type GenAiSemanticAttributes = {
|
|
19
|
+
"gen_ai.agent.description"?: string;
|
|
20
|
+
"gen_ai.agent.id"?: string;
|
|
21
|
+
"gen_ai.agent.name"?: string;
|
|
22
|
+
"gen_ai.agent.version"?: string;
|
|
23
|
+
"gen_ai.conversation.id"?: string;
|
|
24
|
+
"gen_ai.data_source.id"?: string;
|
|
25
|
+
"gen_ai.embeddings.dimension.count"?: number;
|
|
26
|
+
"gen_ai.evaluation.explanation"?: string;
|
|
27
|
+
"gen_ai.evaluation.name"?: string;
|
|
28
|
+
"gen_ai.evaluation.score.label"?: string;
|
|
29
|
+
"gen_ai.evaluation.score.value"?: number;
|
|
30
|
+
"gen_ai.input.messages"?: JsonValue;
|
|
31
|
+
"gen_ai.operation.name"?: GenAiOperationName;
|
|
32
|
+
"gen_ai.output.messages"?: JsonValue;
|
|
33
|
+
"gen_ai.output.type"?: GenAiOutputType;
|
|
34
|
+
"gen_ai.prompt.name"?: string;
|
|
35
|
+
"gen_ai.provider.name"?: GenAiProviderName;
|
|
36
|
+
"gen_ai.request.choice.count"?: number;
|
|
37
|
+
"gen_ai.request.encoding_formats"?: string[];
|
|
38
|
+
"gen_ai.request.frequency_penalty"?: number;
|
|
39
|
+
"gen_ai.request.max_tokens"?: number;
|
|
40
|
+
"gen_ai.request.model"?: string;
|
|
41
|
+
"gen_ai.request.presence_penalty"?: number;
|
|
42
|
+
"gen_ai.request.seed"?: number;
|
|
43
|
+
"gen_ai.request.stop_sequences"?: string[];
|
|
44
|
+
"gen_ai.request.stream"?: boolean;
|
|
45
|
+
"gen_ai.request.temperature"?: number;
|
|
46
|
+
"gen_ai.request.top_k"?: number;
|
|
47
|
+
"gen_ai.request.top_p"?: number;
|
|
48
|
+
"gen_ai.response.finish_reasons"?: string[];
|
|
49
|
+
"gen_ai.response.id"?: string;
|
|
50
|
+
"gen_ai.response.model"?: string;
|
|
51
|
+
"gen_ai.response.time_to_first_chunk"?: number;
|
|
52
|
+
"gen_ai.retrieval.documents"?: JsonValue;
|
|
53
|
+
"gen_ai.retrieval.query.text"?: string;
|
|
54
|
+
"gen_ai.system_instructions"?: JsonValue;
|
|
55
|
+
"gen_ai.token.type"?: GenAiTokenType;
|
|
56
|
+
"gen_ai.tool.call.arguments"?: JsonValue;
|
|
57
|
+
"gen_ai.tool.call.id"?: string;
|
|
58
|
+
"gen_ai.tool.call.result"?: JsonValue;
|
|
59
|
+
"gen_ai.tool.definitions"?: JsonValue;
|
|
60
|
+
"gen_ai.tool.description"?: string;
|
|
61
|
+
"gen_ai.tool.name"?: string;
|
|
62
|
+
"gen_ai.tool.type"?: GenAiToolType;
|
|
63
|
+
"gen_ai.usage.cache_creation.input_tokens"?: number;
|
|
64
|
+
"gen_ai.usage.cache_read.input_tokens"?: number;
|
|
65
|
+
"gen_ai.usage.input_tokens"?: number;
|
|
66
|
+
"gen_ai.usage.output_tokens"?: number;
|
|
67
|
+
"gen_ai.usage.reasoning.output_tokens"?: number;
|
|
68
|
+
"gen_ai.workflow.name"?: string;
|
|
69
|
+
};
|
|
70
|
+
/** Attribute keys defined by the OpenTelemetry GenAI semantic conventions. */
|
|
71
|
+
type GenAiSemanticAttributeKey = keyof GenAiSemanticAttributes;
|
|
72
|
+
/** Typed OpenTelemetry semantic attributes accepted on normalized spans. */
|
|
73
|
+
type OpenTelemetrySemanticAttributes = GenAiSemanticAttributes & {
|
|
74
|
+
"error.type"?: string;
|
|
75
|
+
"server.address"?: string;
|
|
76
|
+
"server.port"?: number;
|
|
77
|
+
};
|
|
78
|
+
/** Known OpenTelemetry semantic attribute keys accepted on normalized spans. */
|
|
79
|
+
type OpenTelemetrySemanticAttributeKey = keyof OpenTelemetrySemanticAttributes;
|
|
80
|
+
/** Attribute keys accepted on normalized spans. */
|
|
81
|
+
type NormalizedSpanAttributeKey = OpenTelemetrySemanticAttributeKey | (string & {});
|
|
82
|
+
/**
|
|
83
|
+
* JSON-safe span attributes. Known OpenTelemetry GenAI keys are typed while
|
|
84
|
+
* custom provider and application keys remain allowed.
|
|
85
|
+
*/
|
|
86
|
+
type NormalizedSpanAttributes = OpenTelemetrySemanticAttributes & {
|
|
87
|
+
[key: string]: JsonValue | undefined;
|
|
88
|
+
};
|
|
89
|
+
/** Event attached to one normalized span. */
|
|
90
|
+
type NormalizedSpanEvent = {
|
|
91
|
+
/** Event name emitted by the runtime or harness. */
|
|
92
|
+
name: string;
|
|
93
|
+
/** ISO timestamp for the event when available. */
|
|
94
|
+
timestamp?: string;
|
|
95
|
+
/** JSON-safe event attributes. */
|
|
96
|
+
attributes?: NormalizedSpanAttributes;
|
|
97
|
+
};
|
|
98
|
+
/** Normalized operation span captured during a harness run. */
|
|
99
|
+
type NormalizedSpan = {
|
|
100
|
+
/** Runtime or provider span id when one is available. */
|
|
101
|
+
id?: string;
|
|
102
|
+
/** Trace id this span belongs to. */
|
|
103
|
+
traceId?: string;
|
|
104
|
+
/** Parent span id when the runtime exposes hierarchy. */
|
|
105
|
+
parentId?: string;
|
|
106
|
+
/** Human-readable operation name. */
|
|
107
|
+
name: string;
|
|
108
|
+
/** Coarse operation kind used by reporters and judges. */
|
|
109
|
+
kind?: "run" | "agent" | "model" | "tool" | "guardrail" | "handoff" | "custom";
|
|
110
|
+
/** ISO timestamp for the start of the span. */
|
|
111
|
+
startedAt?: string;
|
|
112
|
+
/** ISO timestamp for the end of the span. */
|
|
113
|
+
finishedAt?: string;
|
|
114
|
+
/** Span duration in milliseconds. */
|
|
115
|
+
durationMs?: number;
|
|
116
|
+
/** Success or failure status for the span. */
|
|
117
|
+
status?: "ok" | "error";
|
|
118
|
+
/** Normalized error when the span failed. */
|
|
119
|
+
error?: {
|
|
120
|
+
message: string;
|
|
121
|
+
type?: string;
|
|
122
|
+
[key: string]: JsonValue | undefined;
|
|
123
|
+
};
|
|
124
|
+
/** JSON-safe operation attributes. */
|
|
125
|
+
attributes?: NormalizedSpanAttributes;
|
|
126
|
+
/** Events observed inside this span. */
|
|
127
|
+
events?: NormalizedSpanEvent[];
|
|
128
|
+
};
|
|
129
|
+
/** Normalized trace captured during a harness run. */
|
|
130
|
+
type NormalizedTrace = {
|
|
131
|
+
/** Runtime or provider trace id when one is available. */
|
|
132
|
+
id?: string;
|
|
133
|
+
/** Human-readable trace or workflow name. */
|
|
134
|
+
name?: string;
|
|
135
|
+
/** ISO timestamp for the start of the trace. */
|
|
136
|
+
startedAt?: string;
|
|
137
|
+
/** ISO timestamp for the end of the trace. */
|
|
138
|
+
finishedAt?: string;
|
|
139
|
+
/** Trace duration in milliseconds. */
|
|
140
|
+
durationMs?: number;
|
|
141
|
+
/** Extra JSON-safe trace metadata. */
|
|
142
|
+
metadata?: Record<string, JsonValue>;
|
|
143
|
+
/** Spans that make up this trace. */
|
|
144
|
+
spans: NormalizedSpan[];
|
|
145
|
+
};
|
|
146
|
+
/** Options for converting normalized tool calls into trace spans. */
|
|
147
|
+
type CreateToolCallSpansOptions = {
|
|
148
|
+
/** Trace id to attach to each generated tool span. */
|
|
149
|
+
traceId?: string;
|
|
150
|
+
/** Parent span id to attach to each generated tool span. */
|
|
151
|
+
parentId?: string;
|
|
152
|
+
/** Prefix used to create internal span ids instead of reusing tool-call ids. */
|
|
153
|
+
spanIdPrefix?: string;
|
|
154
|
+
};
|
|
155
|
+
/** Options for attaching a fallback run trace to a harness result. */
|
|
156
|
+
type EnsureRunTraceOptions = {
|
|
157
|
+
/** Human-readable run or harness name. */
|
|
158
|
+
name: string;
|
|
159
|
+
/** Wall-clock start time for the harness run. */
|
|
160
|
+
startedAt: Date;
|
|
161
|
+
/** Wall-clock finish time for the harness run. */
|
|
162
|
+
finishedAt: Date;
|
|
163
|
+
/** Optional trace id. A generated id is used when omitted. */
|
|
164
|
+
id?: string;
|
|
165
|
+
/** GenAI operation name to place on the root run span. */
|
|
166
|
+
operationName?: GenAiOperationName;
|
|
167
|
+
/** Optional JSON-safe source marker for the trace metadata. */
|
|
168
|
+
source?: string;
|
|
169
|
+
};
|
|
7
170
|
/**
|
|
8
171
|
* Normalized record for one tool call observed during a harness run.
|
|
9
172
|
*
|
|
@@ -160,6 +323,8 @@ type HarnessRun<TOutput extends JsonValue | undefined = JsonValue | undefined> =
|
|
|
160
323
|
timings?: TimingSummary;
|
|
161
324
|
/** JSON-safe run artifacts captured by the harness or test context. */
|
|
162
325
|
artifacts?: Record<string, JsonValue>;
|
|
326
|
+
/** Normalized traces and spans captured during execution. */
|
|
327
|
+
traces?: NormalizedTrace[];
|
|
163
328
|
/** Normalized errors captured during execution. */
|
|
164
329
|
errors: Array<Record<string, JsonValue>>;
|
|
165
330
|
};
|
|
@@ -232,6 +397,27 @@ type SimpleToolCallRecord = Omit<ToolCallRecord, "arguments" | "result" | "error
|
|
|
232
397
|
/** Raw tool metadata accepted by `createHarness(...)` before normalization. */
|
|
233
398
|
metadata?: Record<string, unknown>;
|
|
234
399
|
};
|
|
400
|
+
/** Lightweight span event accepted by `createHarness(...)` results. */
|
|
401
|
+
type SimpleSpanEvent = Omit<NormalizedSpanEvent, "attributes"> & {
|
|
402
|
+
/** Raw event attributes accepted by `createHarness(...)` before normalization. */
|
|
403
|
+
attributes?: Record<string, unknown>;
|
|
404
|
+
};
|
|
405
|
+
/** Lightweight span record accepted by `createHarness(...)` results. */
|
|
406
|
+
type SimpleSpanRecord = Omit<NormalizedSpan, "attributes" | "error" | "events"> & {
|
|
407
|
+
/** Raw span attributes accepted by `createHarness(...)` before normalization. */
|
|
408
|
+
attributes?: Record<string, unknown>;
|
|
409
|
+
/** Raw span error accepted by `createHarness(...)` before normalization. */
|
|
410
|
+
error?: unknown;
|
|
411
|
+
/** Raw span events accepted by `createHarness(...)` before normalization. */
|
|
412
|
+
events?: SimpleSpanEvent[];
|
|
413
|
+
};
|
|
414
|
+
/** Lightweight trace record accepted by `createHarness(...)` results. */
|
|
415
|
+
type SimpleTraceRecord = Omit<NormalizedTrace, "metadata" | "spans"> & {
|
|
416
|
+
/** Raw trace metadata accepted by `createHarness(...)` before normalization. */
|
|
417
|
+
metadata?: Record<string, unknown>;
|
|
418
|
+
/** Lightweight spans to normalize into the trace. */
|
|
419
|
+
spans: SimpleSpanRecord[];
|
|
420
|
+
};
|
|
235
421
|
/**
|
|
236
422
|
* Lightweight result shape normalized by `createHarness(...)`.
|
|
237
423
|
*
|
|
@@ -255,6 +441,8 @@ type SimpleHarnessResult<TOutput extends JsonValue | undefined = JsonValue | und
|
|
|
255
441
|
timings?: TimingSummary;
|
|
256
442
|
/** Raw artifact values to normalize and merge into the run. */
|
|
257
443
|
artifacts?: Record<string, unknown>;
|
|
444
|
+
/** Lightweight traces and spans to normalize into the run. */
|
|
445
|
+
traces?: SimpleTraceRecord[];
|
|
258
446
|
/** Raw session metadata to normalize into the session. */
|
|
259
447
|
metadata?: Record<string, unknown>;
|
|
260
448
|
/** Raw errors to normalize into the run. */
|
|
@@ -354,6 +542,31 @@ declare function createHarness<TInput = unknown, TOutput extends JsonValue | und
|
|
|
354
542
|
* ```
|
|
355
543
|
*/
|
|
356
544
|
declare function normalizeHarnessRun<TInput = unknown, TMetadata extends HarnessMetadata = HarnessMetadata, TOutput extends JsonValue | undefined = JsonValue | undefined>(input: TInput, result: HarnessResultLike<TOutput>, context?: HarnessContext<TMetadata>): HarnessRun<TOutput>;
|
|
545
|
+
/**
|
|
546
|
+
* Builds a JSON-safe failed run for errors that happen before a harness can return.
|
|
547
|
+
*
|
|
548
|
+
* @param input - Original input passed to the harness.
|
|
549
|
+
* @param error - Error thrown by setup or execution.
|
|
550
|
+
* @param options - Optional artifacts to preserve on the failed run.
|
|
551
|
+
*/
|
|
552
|
+
declare function createFailedHarnessRun(input: unknown, error: unknown, options?: {
|
|
553
|
+
artifacts?: Record<string, JsonValue>;
|
|
554
|
+
}): HarnessRun;
|
|
555
|
+
/** Normalizes arbitrary span errors while preserving object-shaped messages. */
|
|
556
|
+
declare function normalizeSpanError(error: unknown): NormalizedSpan["error"] | undefined;
|
|
557
|
+
/** Normalizes raw span attributes into the JSON-safe span attribute shape. */
|
|
558
|
+
declare function normalizeSpanAttributes(attributes: Record<string, unknown>): NormalizedSpanAttributes | undefined;
|
|
559
|
+
/** Builds common OpenTelemetry GenAI usage attributes from a usage summary. */
|
|
560
|
+
declare function createGenAiUsageAttributes(usage: UsageSummary | undefined, options?: {
|
|
561
|
+
provider?: string;
|
|
562
|
+
}): {
|
|
563
|
+
"gen_ai.provider.name": string | undefined;
|
|
564
|
+
"gen_ai.request.model": string | undefined;
|
|
565
|
+
"gen_ai.response.model": string | undefined;
|
|
566
|
+
"gen_ai.usage.input_tokens": number | undefined;
|
|
567
|
+
"gen_ai.usage.output_tokens": number | undefined;
|
|
568
|
+
"gen_ai.usage.reasoning.output_tokens": number | undefined;
|
|
569
|
+
};
|
|
357
570
|
/**
|
|
358
571
|
* Flattens every recorded tool call from a normalized session.
|
|
359
572
|
*
|
|
@@ -367,6 +580,44 @@ declare function normalizeHarnessRun<TInput = unknown, TMetadata extends Harness
|
|
|
367
580
|
* ```
|
|
368
581
|
*/
|
|
369
582
|
declare function toolCalls(session: NormalizedSession): ToolCallRecord[];
|
|
583
|
+
/**
|
|
584
|
+
* Converts normalized tool-call records into trace spans.
|
|
585
|
+
*
|
|
586
|
+
* Tool-call ids are preserved as GenAI attributes. Pass `spanIdPrefix` when the
|
|
587
|
+
* spans belong to a known trace so span ids stay internally unique.
|
|
588
|
+
*/
|
|
589
|
+
declare function createToolCallSpans(calls: ToolCallRecord[], options?: CreateToolCallSpansOptions): NormalizedSpan[];
|
|
590
|
+
/**
|
|
591
|
+
* Attaches a fallback run trace when a harness result does not already contain spans.
|
|
592
|
+
*
|
|
593
|
+
* This keeps custom harnesses inspectable while first-party harness packages
|
|
594
|
+
* remain free to attach richer native traces.
|
|
595
|
+
*/
|
|
596
|
+
declare function ensureRunTrace(run: HarnessRun, options: EnsureRunTraceOptions): NormalizedTrace | undefined;
|
|
597
|
+
/**
|
|
598
|
+
* Flattens every recorded span from a normalized harness run.
|
|
599
|
+
*
|
|
600
|
+
* @param run - Normalized harness run produced by a harness.
|
|
601
|
+
*
|
|
602
|
+
* @example
|
|
603
|
+
* ```ts
|
|
604
|
+
* const modelSpans = spans(result).filter((span) => span.kind === "model");
|
|
605
|
+
* ```
|
|
606
|
+
*/
|
|
607
|
+
declare function spans(run: HarnessRun): NormalizedSpan[];
|
|
608
|
+
/**
|
|
609
|
+
* Returns spans of one coarse operation kind from a normalized run.
|
|
610
|
+
*
|
|
611
|
+
* @param run - Normalized harness run produced by a harness.
|
|
612
|
+
* @param kind - Span kind to keep.
|
|
613
|
+
*/
|
|
614
|
+
declare function spansByKind(run: HarnessRun, kind: NonNullable<NormalizedSpan["kind"]>): NormalizedSpan[];
|
|
615
|
+
/**
|
|
616
|
+
* Returns every span that explicitly failed or carries a normalized error.
|
|
617
|
+
*
|
|
618
|
+
* @param run - Normalized harness run produced by a harness.
|
|
619
|
+
*/
|
|
620
|
+
declare function failedSpans(run: HarnessRun): NormalizedSpan[];
|
|
370
621
|
/**
|
|
371
622
|
* Filters normalized session messages by role.
|
|
372
623
|
*
|
|
@@ -476,4 +727,4 @@ declare function resolveHarnessRunErrors(result: unknown): Array<Record<string,
|
|
|
476
727
|
/** Serializes an arbitrary thrown value into the normalized error shape. */
|
|
477
728
|
declare function serializeError(error: unknown): Record<string, JsonValue>;
|
|
478
729
|
|
|
479
|
-
export { type CreateHarnessOptions, type CreateHarnessRunArgs, type Harness, type HarnessContext, type HarnessMetadata, type HarnessResultLike, type HarnessRun, type HarnessRunError, type JsonPrimitive, type JsonValue, type MaybePromise, type NormalizedMessage, type NormalizedSession, type SimpleHarnessResult, type SimpleToolCallRecord, type TimingSummary, type ToolCallRecord, type UsageSummary, assistantMessages, attachHarnessRunToError, createHarness, getHarnessRunFromError, hasCallableMethod, isHarnessRun, isNormalizedSession, latestAssistantMessageContent, messagesByRole, normalizeContent, normalizeHarnessRun, normalizeMetadata, normalizeRecord, resolveHarnessRunErrors, serializeError, systemMessages, toJsonValue, toolCalls, toolMessages, userMessages };
|
|
730
|
+
export { type CreateHarnessOptions, type CreateHarnessRunArgs, type CreateToolCallSpansOptions, type EnsureRunTraceOptions, type GenAiOperationName, type GenAiOutputType, type GenAiProviderName, type GenAiSemanticAttributeKey, type GenAiSemanticAttributes, type GenAiTokenType, type GenAiToolType, type Harness, type HarnessContext, type HarnessMetadata, type HarnessResultLike, type HarnessRun, type HarnessRunError, type JsonPrimitive, type JsonValue, type MaybePromise, type NormalizedMessage, type NormalizedSession, type NormalizedSpan, type NormalizedSpanAttributeKey, type NormalizedSpanAttributes, type NormalizedSpanEvent, type NormalizedTrace, type OpenTelemetrySemanticAttributeKey, type OpenTelemetrySemanticAttributes, type SimpleHarnessResult, type SimpleSpanEvent, type SimpleSpanRecord, type SimpleToolCallRecord, type SimpleTraceRecord, type TimingSummary, type ToolCallRecord, type UsageSummary, assistantMessages, attachHarnessRunToError, createFailedHarnessRun, createGenAiUsageAttributes, createHarness, createToolCallSpans, ensureRunTrace, failedSpans, getHarnessRunFromError, hasCallableMethod, isHarnessRun, isNormalizedSession, latestAssistantMessageContent, messagesByRole, normalizeContent, normalizeHarnessRun, normalizeMetadata, normalizeRecord, normalizeSpanAttributes, normalizeSpanError, resolveHarnessRunErrors, serializeError, spans, spansByKind, systemMessages, toJsonValue, toolCalls, toolMessages, userMessages };
|
package/dist/harness.d.ts
CHANGED
|
@@ -4,6 +4,169 @@ type JsonPrimitive = string | number | boolean | null;
|
|
|
4
4
|
type JsonValue = JsonPrimitive | JsonValue[] | {
|
|
5
5
|
[key: string]: JsonValue;
|
|
6
6
|
};
|
|
7
|
+
/** Well-known OpenTelemetry GenAI operation names. */
|
|
8
|
+
type GenAiOperationName = "chat" | "create_agent" | "embeddings" | "execute_tool" | "generate_content" | "invoke_agent" | "invoke_workflow" | "retrieval" | "text_completion" | (string & {});
|
|
9
|
+
/** Well-known OpenTelemetry GenAI output content types. */
|
|
10
|
+
type GenAiOutputType = "image" | "json" | "speech" | "text" | (string & {});
|
|
11
|
+
/** Well-known OpenTelemetry GenAI provider names. */
|
|
12
|
+
type GenAiProviderName = "anthropic" | "aws.bedrock" | "azure.ai.inference" | "azure.ai.openai" | "cohere" | "deepseek" | "gcp.gemini" | "gcp.gen_ai" | "gcp.vertex_ai" | "groq" | "ibm.watsonx.ai" | "mistral_ai" | "openai" | "perplexity" | "x_ai" | (string & {});
|
|
13
|
+
/** Well-known OpenTelemetry GenAI token types. */
|
|
14
|
+
type GenAiTokenType = "input" | "output" | (string & {});
|
|
15
|
+
/** Well-known OpenTelemetry GenAI tool execution types. */
|
|
16
|
+
type GenAiToolType = "datastore" | "extension" | "function" | (string & {});
|
|
17
|
+
/** Typed subset of OpenTelemetry GenAI semantic attributes. */
|
|
18
|
+
type GenAiSemanticAttributes = {
|
|
19
|
+
"gen_ai.agent.description"?: string;
|
|
20
|
+
"gen_ai.agent.id"?: string;
|
|
21
|
+
"gen_ai.agent.name"?: string;
|
|
22
|
+
"gen_ai.agent.version"?: string;
|
|
23
|
+
"gen_ai.conversation.id"?: string;
|
|
24
|
+
"gen_ai.data_source.id"?: string;
|
|
25
|
+
"gen_ai.embeddings.dimension.count"?: number;
|
|
26
|
+
"gen_ai.evaluation.explanation"?: string;
|
|
27
|
+
"gen_ai.evaluation.name"?: string;
|
|
28
|
+
"gen_ai.evaluation.score.label"?: string;
|
|
29
|
+
"gen_ai.evaluation.score.value"?: number;
|
|
30
|
+
"gen_ai.input.messages"?: JsonValue;
|
|
31
|
+
"gen_ai.operation.name"?: GenAiOperationName;
|
|
32
|
+
"gen_ai.output.messages"?: JsonValue;
|
|
33
|
+
"gen_ai.output.type"?: GenAiOutputType;
|
|
34
|
+
"gen_ai.prompt.name"?: string;
|
|
35
|
+
"gen_ai.provider.name"?: GenAiProviderName;
|
|
36
|
+
"gen_ai.request.choice.count"?: number;
|
|
37
|
+
"gen_ai.request.encoding_formats"?: string[];
|
|
38
|
+
"gen_ai.request.frequency_penalty"?: number;
|
|
39
|
+
"gen_ai.request.max_tokens"?: number;
|
|
40
|
+
"gen_ai.request.model"?: string;
|
|
41
|
+
"gen_ai.request.presence_penalty"?: number;
|
|
42
|
+
"gen_ai.request.seed"?: number;
|
|
43
|
+
"gen_ai.request.stop_sequences"?: string[];
|
|
44
|
+
"gen_ai.request.stream"?: boolean;
|
|
45
|
+
"gen_ai.request.temperature"?: number;
|
|
46
|
+
"gen_ai.request.top_k"?: number;
|
|
47
|
+
"gen_ai.request.top_p"?: number;
|
|
48
|
+
"gen_ai.response.finish_reasons"?: string[];
|
|
49
|
+
"gen_ai.response.id"?: string;
|
|
50
|
+
"gen_ai.response.model"?: string;
|
|
51
|
+
"gen_ai.response.time_to_first_chunk"?: number;
|
|
52
|
+
"gen_ai.retrieval.documents"?: JsonValue;
|
|
53
|
+
"gen_ai.retrieval.query.text"?: string;
|
|
54
|
+
"gen_ai.system_instructions"?: JsonValue;
|
|
55
|
+
"gen_ai.token.type"?: GenAiTokenType;
|
|
56
|
+
"gen_ai.tool.call.arguments"?: JsonValue;
|
|
57
|
+
"gen_ai.tool.call.id"?: string;
|
|
58
|
+
"gen_ai.tool.call.result"?: JsonValue;
|
|
59
|
+
"gen_ai.tool.definitions"?: JsonValue;
|
|
60
|
+
"gen_ai.tool.description"?: string;
|
|
61
|
+
"gen_ai.tool.name"?: string;
|
|
62
|
+
"gen_ai.tool.type"?: GenAiToolType;
|
|
63
|
+
"gen_ai.usage.cache_creation.input_tokens"?: number;
|
|
64
|
+
"gen_ai.usage.cache_read.input_tokens"?: number;
|
|
65
|
+
"gen_ai.usage.input_tokens"?: number;
|
|
66
|
+
"gen_ai.usage.output_tokens"?: number;
|
|
67
|
+
"gen_ai.usage.reasoning.output_tokens"?: number;
|
|
68
|
+
"gen_ai.workflow.name"?: string;
|
|
69
|
+
};
|
|
70
|
+
/** Attribute keys defined by the OpenTelemetry GenAI semantic conventions. */
|
|
71
|
+
type GenAiSemanticAttributeKey = keyof GenAiSemanticAttributes;
|
|
72
|
+
/** Typed OpenTelemetry semantic attributes accepted on normalized spans. */
|
|
73
|
+
type OpenTelemetrySemanticAttributes = GenAiSemanticAttributes & {
|
|
74
|
+
"error.type"?: string;
|
|
75
|
+
"server.address"?: string;
|
|
76
|
+
"server.port"?: number;
|
|
77
|
+
};
|
|
78
|
+
/** Known OpenTelemetry semantic attribute keys accepted on normalized spans. */
|
|
79
|
+
type OpenTelemetrySemanticAttributeKey = keyof OpenTelemetrySemanticAttributes;
|
|
80
|
+
/** Attribute keys accepted on normalized spans. */
|
|
81
|
+
type NormalizedSpanAttributeKey = OpenTelemetrySemanticAttributeKey | (string & {});
|
|
82
|
+
/**
|
|
83
|
+
* JSON-safe span attributes. Known OpenTelemetry GenAI keys are typed while
|
|
84
|
+
* custom provider and application keys remain allowed.
|
|
85
|
+
*/
|
|
86
|
+
type NormalizedSpanAttributes = OpenTelemetrySemanticAttributes & {
|
|
87
|
+
[key: string]: JsonValue | undefined;
|
|
88
|
+
};
|
|
89
|
+
/** Event attached to one normalized span. */
|
|
90
|
+
type NormalizedSpanEvent = {
|
|
91
|
+
/** Event name emitted by the runtime or harness. */
|
|
92
|
+
name: string;
|
|
93
|
+
/** ISO timestamp for the event when available. */
|
|
94
|
+
timestamp?: string;
|
|
95
|
+
/** JSON-safe event attributes. */
|
|
96
|
+
attributes?: NormalizedSpanAttributes;
|
|
97
|
+
};
|
|
98
|
+
/** Normalized operation span captured during a harness run. */
|
|
99
|
+
type NormalizedSpan = {
|
|
100
|
+
/** Runtime or provider span id when one is available. */
|
|
101
|
+
id?: string;
|
|
102
|
+
/** Trace id this span belongs to. */
|
|
103
|
+
traceId?: string;
|
|
104
|
+
/** Parent span id when the runtime exposes hierarchy. */
|
|
105
|
+
parentId?: string;
|
|
106
|
+
/** Human-readable operation name. */
|
|
107
|
+
name: string;
|
|
108
|
+
/** Coarse operation kind used by reporters and judges. */
|
|
109
|
+
kind?: "run" | "agent" | "model" | "tool" | "guardrail" | "handoff" | "custom";
|
|
110
|
+
/** ISO timestamp for the start of the span. */
|
|
111
|
+
startedAt?: string;
|
|
112
|
+
/** ISO timestamp for the end of the span. */
|
|
113
|
+
finishedAt?: string;
|
|
114
|
+
/** Span duration in milliseconds. */
|
|
115
|
+
durationMs?: number;
|
|
116
|
+
/** Success or failure status for the span. */
|
|
117
|
+
status?: "ok" | "error";
|
|
118
|
+
/** Normalized error when the span failed. */
|
|
119
|
+
error?: {
|
|
120
|
+
message: string;
|
|
121
|
+
type?: string;
|
|
122
|
+
[key: string]: JsonValue | undefined;
|
|
123
|
+
};
|
|
124
|
+
/** JSON-safe operation attributes. */
|
|
125
|
+
attributes?: NormalizedSpanAttributes;
|
|
126
|
+
/** Events observed inside this span. */
|
|
127
|
+
events?: NormalizedSpanEvent[];
|
|
128
|
+
};
|
|
129
|
+
/** Normalized trace captured during a harness run. */
|
|
130
|
+
type NormalizedTrace = {
|
|
131
|
+
/** Runtime or provider trace id when one is available. */
|
|
132
|
+
id?: string;
|
|
133
|
+
/** Human-readable trace or workflow name. */
|
|
134
|
+
name?: string;
|
|
135
|
+
/** ISO timestamp for the start of the trace. */
|
|
136
|
+
startedAt?: string;
|
|
137
|
+
/** ISO timestamp for the end of the trace. */
|
|
138
|
+
finishedAt?: string;
|
|
139
|
+
/** Trace duration in milliseconds. */
|
|
140
|
+
durationMs?: number;
|
|
141
|
+
/** Extra JSON-safe trace metadata. */
|
|
142
|
+
metadata?: Record<string, JsonValue>;
|
|
143
|
+
/** Spans that make up this trace. */
|
|
144
|
+
spans: NormalizedSpan[];
|
|
145
|
+
};
|
|
146
|
+
/** Options for converting normalized tool calls into trace spans. */
|
|
147
|
+
type CreateToolCallSpansOptions = {
|
|
148
|
+
/** Trace id to attach to each generated tool span. */
|
|
149
|
+
traceId?: string;
|
|
150
|
+
/** Parent span id to attach to each generated tool span. */
|
|
151
|
+
parentId?: string;
|
|
152
|
+
/** Prefix used to create internal span ids instead of reusing tool-call ids. */
|
|
153
|
+
spanIdPrefix?: string;
|
|
154
|
+
};
|
|
155
|
+
/** Options for attaching a fallback run trace to a harness result. */
|
|
156
|
+
type EnsureRunTraceOptions = {
|
|
157
|
+
/** Human-readable run or harness name. */
|
|
158
|
+
name: string;
|
|
159
|
+
/** Wall-clock start time for the harness run. */
|
|
160
|
+
startedAt: Date;
|
|
161
|
+
/** Wall-clock finish time for the harness run. */
|
|
162
|
+
finishedAt: Date;
|
|
163
|
+
/** Optional trace id. A generated id is used when omitted. */
|
|
164
|
+
id?: string;
|
|
165
|
+
/** GenAI operation name to place on the root run span. */
|
|
166
|
+
operationName?: GenAiOperationName;
|
|
167
|
+
/** Optional JSON-safe source marker for the trace metadata. */
|
|
168
|
+
source?: string;
|
|
169
|
+
};
|
|
7
170
|
/**
|
|
8
171
|
* Normalized record for one tool call observed during a harness run.
|
|
9
172
|
*
|
|
@@ -160,6 +323,8 @@ type HarnessRun<TOutput extends JsonValue | undefined = JsonValue | undefined> =
|
|
|
160
323
|
timings?: TimingSummary;
|
|
161
324
|
/** JSON-safe run artifacts captured by the harness or test context. */
|
|
162
325
|
artifacts?: Record<string, JsonValue>;
|
|
326
|
+
/** Normalized traces and spans captured during execution. */
|
|
327
|
+
traces?: NormalizedTrace[];
|
|
163
328
|
/** Normalized errors captured during execution. */
|
|
164
329
|
errors: Array<Record<string, JsonValue>>;
|
|
165
330
|
};
|
|
@@ -232,6 +397,27 @@ type SimpleToolCallRecord = Omit<ToolCallRecord, "arguments" | "result" | "error
|
|
|
232
397
|
/** Raw tool metadata accepted by `createHarness(...)` before normalization. */
|
|
233
398
|
metadata?: Record<string, unknown>;
|
|
234
399
|
};
|
|
400
|
+
/** Lightweight span event accepted by `createHarness(...)` results. */
|
|
401
|
+
type SimpleSpanEvent = Omit<NormalizedSpanEvent, "attributes"> & {
|
|
402
|
+
/** Raw event attributes accepted by `createHarness(...)` before normalization. */
|
|
403
|
+
attributes?: Record<string, unknown>;
|
|
404
|
+
};
|
|
405
|
+
/** Lightweight span record accepted by `createHarness(...)` results. */
|
|
406
|
+
type SimpleSpanRecord = Omit<NormalizedSpan, "attributes" | "error" | "events"> & {
|
|
407
|
+
/** Raw span attributes accepted by `createHarness(...)` before normalization. */
|
|
408
|
+
attributes?: Record<string, unknown>;
|
|
409
|
+
/** Raw span error accepted by `createHarness(...)` before normalization. */
|
|
410
|
+
error?: unknown;
|
|
411
|
+
/** Raw span events accepted by `createHarness(...)` before normalization. */
|
|
412
|
+
events?: SimpleSpanEvent[];
|
|
413
|
+
};
|
|
414
|
+
/** Lightweight trace record accepted by `createHarness(...)` results. */
|
|
415
|
+
type SimpleTraceRecord = Omit<NormalizedTrace, "metadata" | "spans"> & {
|
|
416
|
+
/** Raw trace metadata accepted by `createHarness(...)` before normalization. */
|
|
417
|
+
metadata?: Record<string, unknown>;
|
|
418
|
+
/** Lightweight spans to normalize into the trace. */
|
|
419
|
+
spans: SimpleSpanRecord[];
|
|
420
|
+
};
|
|
235
421
|
/**
|
|
236
422
|
* Lightweight result shape normalized by `createHarness(...)`.
|
|
237
423
|
*
|
|
@@ -255,6 +441,8 @@ type SimpleHarnessResult<TOutput extends JsonValue | undefined = JsonValue | und
|
|
|
255
441
|
timings?: TimingSummary;
|
|
256
442
|
/** Raw artifact values to normalize and merge into the run. */
|
|
257
443
|
artifacts?: Record<string, unknown>;
|
|
444
|
+
/** Lightweight traces and spans to normalize into the run. */
|
|
445
|
+
traces?: SimpleTraceRecord[];
|
|
258
446
|
/** Raw session metadata to normalize into the session. */
|
|
259
447
|
metadata?: Record<string, unknown>;
|
|
260
448
|
/** Raw errors to normalize into the run. */
|
|
@@ -354,6 +542,31 @@ declare function createHarness<TInput = unknown, TOutput extends JsonValue | und
|
|
|
354
542
|
* ```
|
|
355
543
|
*/
|
|
356
544
|
declare function normalizeHarnessRun<TInput = unknown, TMetadata extends HarnessMetadata = HarnessMetadata, TOutput extends JsonValue | undefined = JsonValue | undefined>(input: TInput, result: HarnessResultLike<TOutput>, context?: HarnessContext<TMetadata>): HarnessRun<TOutput>;
|
|
545
|
+
/**
|
|
546
|
+
* Builds a JSON-safe failed run for errors that happen before a harness can return.
|
|
547
|
+
*
|
|
548
|
+
* @param input - Original input passed to the harness.
|
|
549
|
+
* @param error - Error thrown by setup or execution.
|
|
550
|
+
* @param options - Optional artifacts to preserve on the failed run.
|
|
551
|
+
*/
|
|
552
|
+
declare function createFailedHarnessRun(input: unknown, error: unknown, options?: {
|
|
553
|
+
artifacts?: Record<string, JsonValue>;
|
|
554
|
+
}): HarnessRun;
|
|
555
|
+
/** Normalizes arbitrary span errors while preserving object-shaped messages. */
|
|
556
|
+
declare function normalizeSpanError(error: unknown): NormalizedSpan["error"] | undefined;
|
|
557
|
+
/** Normalizes raw span attributes into the JSON-safe span attribute shape. */
|
|
558
|
+
declare function normalizeSpanAttributes(attributes: Record<string, unknown>): NormalizedSpanAttributes | undefined;
|
|
559
|
+
/** Builds common OpenTelemetry GenAI usage attributes from a usage summary. */
|
|
560
|
+
declare function createGenAiUsageAttributes(usage: UsageSummary | undefined, options?: {
|
|
561
|
+
provider?: string;
|
|
562
|
+
}): {
|
|
563
|
+
"gen_ai.provider.name": string | undefined;
|
|
564
|
+
"gen_ai.request.model": string | undefined;
|
|
565
|
+
"gen_ai.response.model": string | undefined;
|
|
566
|
+
"gen_ai.usage.input_tokens": number | undefined;
|
|
567
|
+
"gen_ai.usage.output_tokens": number | undefined;
|
|
568
|
+
"gen_ai.usage.reasoning.output_tokens": number | undefined;
|
|
569
|
+
};
|
|
357
570
|
/**
|
|
358
571
|
* Flattens every recorded tool call from a normalized session.
|
|
359
572
|
*
|
|
@@ -367,6 +580,44 @@ declare function normalizeHarnessRun<TInput = unknown, TMetadata extends Harness
|
|
|
367
580
|
* ```
|
|
368
581
|
*/
|
|
369
582
|
declare function toolCalls(session: NormalizedSession): ToolCallRecord[];
|
|
583
|
+
/**
|
|
584
|
+
* Converts normalized tool-call records into trace spans.
|
|
585
|
+
*
|
|
586
|
+
* Tool-call ids are preserved as GenAI attributes. Pass `spanIdPrefix` when the
|
|
587
|
+
* spans belong to a known trace so span ids stay internally unique.
|
|
588
|
+
*/
|
|
589
|
+
declare function createToolCallSpans(calls: ToolCallRecord[], options?: CreateToolCallSpansOptions): NormalizedSpan[];
|
|
590
|
+
/**
|
|
591
|
+
* Attaches a fallback run trace when a harness result does not already contain spans.
|
|
592
|
+
*
|
|
593
|
+
* This keeps custom harnesses inspectable while first-party harness packages
|
|
594
|
+
* remain free to attach richer native traces.
|
|
595
|
+
*/
|
|
596
|
+
declare function ensureRunTrace(run: HarnessRun, options: EnsureRunTraceOptions): NormalizedTrace | undefined;
|
|
597
|
+
/**
|
|
598
|
+
* Flattens every recorded span from a normalized harness run.
|
|
599
|
+
*
|
|
600
|
+
* @param run - Normalized harness run produced by a harness.
|
|
601
|
+
*
|
|
602
|
+
* @example
|
|
603
|
+
* ```ts
|
|
604
|
+
* const modelSpans = spans(result).filter((span) => span.kind === "model");
|
|
605
|
+
* ```
|
|
606
|
+
*/
|
|
607
|
+
declare function spans(run: HarnessRun): NormalizedSpan[];
|
|
608
|
+
/**
|
|
609
|
+
* Returns spans of one coarse operation kind from a normalized run.
|
|
610
|
+
*
|
|
611
|
+
* @param run - Normalized harness run produced by a harness.
|
|
612
|
+
* @param kind - Span kind to keep.
|
|
613
|
+
*/
|
|
614
|
+
declare function spansByKind(run: HarnessRun, kind: NonNullable<NormalizedSpan["kind"]>): NormalizedSpan[];
|
|
615
|
+
/**
|
|
616
|
+
* Returns every span that explicitly failed or carries a normalized error.
|
|
617
|
+
*
|
|
618
|
+
* @param run - Normalized harness run produced by a harness.
|
|
619
|
+
*/
|
|
620
|
+
declare function failedSpans(run: HarnessRun): NormalizedSpan[];
|
|
370
621
|
/**
|
|
371
622
|
* Filters normalized session messages by role.
|
|
372
623
|
*
|
|
@@ -476,4 +727,4 @@ declare function resolveHarnessRunErrors(result: unknown): Array<Record<string,
|
|
|
476
727
|
/** Serializes an arbitrary thrown value into the normalized error shape. */
|
|
477
728
|
declare function serializeError(error: unknown): Record<string, JsonValue>;
|
|
478
729
|
|
|
479
|
-
export { type CreateHarnessOptions, type CreateHarnessRunArgs, type Harness, type HarnessContext, type HarnessMetadata, type HarnessResultLike, type HarnessRun, type HarnessRunError, type JsonPrimitive, type JsonValue, type MaybePromise, type NormalizedMessage, type NormalizedSession, type SimpleHarnessResult, type SimpleToolCallRecord, type TimingSummary, type ToolCallRecord, type UsageSummary, assistantMessages, attachHarnessRunToError, createHarness, getHarnessRunFromError, hasCallableMethod, isHarnessRun, isNormalizedSession, latestAssistantMessageContent, messagesByRole, normalizeContent, normalizeHarnessRun, normalizeMetadata, normalizeRecord, resolveHarnessRunErrors, serializeError, systemMessages, toJsonValue, toolCalls, toolMessages, userMessages };
|
|
730
|
+
export { type CreateHarnessOptions, type CreateHarnessRunArgs, type CreateToolCallSpansOptions, type EnsureRunTraceOptions, type GenAiOperationName, type GenAiOutputType, type GenAiProviderName, type GenAiSemanticAttributeKey, type GenAiSemanticAttributes, type GenAiTokenType, type GenAiToolType, type Harness, type HarnessContext, type HarnessMetadata, type HarnessResultLike, type HarnessRun, type HarnessRunError, type JsonPrimitive, type JsonValue, type MaybePromise, type NormalizedMessage, type NormalizedSession, type NormalizedSpan, type NormalizedSpanAttributeKey, type NormalizedSpanAttributes, type NormalizedSpanEvent, type NormalizedTrace, type OpenTelemetrySemanticAttributeKey, type OpenTelemetrySemanticAttributes, type SimpleHarnessResult, type SimpleSpanEvent, type SimpleSpanRecord, type SimpleToolCallRecord, type SimpleTraceRecord, type TimingSummary, type ToolCallRecord, type UsageSummary, assistantMessages, attachHarnessRunToError, createFailedHarnessRun, createGenAiUsageAttributes, createHarness, createToolCallSpans, ensureRunTrace, failedSpans, getHarnessRunFromError, hasCallableMethod, isHarnessRun, isNormalizedSession, latestAssistantMessageContent, messagesByRole, normalizeContent, normalizeHarnessRun, normalizeMetadata, normalizeRecord, normalizeSpanAttributes, normalizeSpanError, resolveHarnessRunErrors, serializeError, spans, spansByKind, systemMessages, toJsonValue, toolCalls, toolMessages, userMessages };
|