netra-sdk 1.6.0 → 1.8.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/dist/index.cjs +428 -67
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +105 -7
- package/dist/index.d.ts +105 -7
- package/dist/index.js +427 -66
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -80,7 +80,7 @@ declare const DEFAULT_INSTRUMENTS: Set<NetraInstruments>;
|
|
|
80
80
|
declare class Config {
|
|
81
81
|
static readonly SDK_NAME = "netra";
|
|
82
82
|
static readonly LIBRARY_NAME = "netra";
|
|
83
|
-
static readonly LIBRARY_VERSION = "1.
|
|
83
|
+
static readonly LIBRARY_VERSION = "1.8.0";
|
|
84
84
|
static readonly TRIAL_BLOCK_DURATION_SECONDS = 900;
|
|
85
85
|
private static _spanAttributeMaxSize;
|
|
86
86
|
/**
|
|
@@ -1074,6 +1074,72 @@ interface DecoratorOptions {
|
|
|
1074
1074
|
}
|
|
1075
1075
|
type SpanCallback<T> = (span: SpanWrapper) => T;
|
|
1076
1076
|
|
|
1077
|
+
/**
|
|
1078
|
+
* Pre/post script hooks for multi-turn simulation runs.
|
|
1079
|
+
*
|
|
1080
|
+
* Hooks let you run setup and teardown logic around scenario execution
|
|
1081
|
+
* without merging all scenarios into one or relying on sequential ordering.
|
|
1082
|
+
*
|
|
1083
|
+
* Hook levels:
|
|
1084
|
+
* beforeAll -- runs once before any scenario starts (dataset-level setup)
|
|
1085
|
+
* beforeEach -- runs before every scenario (common per-item setup)
|
|
1086
|
+
* before -- runs before specific scenarios only (item-specific setup, keyed by datasetItemId)
|
|
1087
|
+
* after -- runs after specific scenarios only (item-specific teardown, keyed by datasetItemId)
|
|
1088
|
+
* afterEach -- runs after every scenario (common per-item teardown)
|
|
1089
|
+
* afterAll -- runs once after all scenarios complete (dataset-level teardown)
|
|
1090
|
+
*
|
|
1091
|
+
* Execution order per item:
|
|
1092
|
+
* beforeAll() -> returns sharedContext (Record | null)
|
|
1093
|
+
* beforeEach(sharedContext) -> returns eachContext (Record | null)
|
|
1094
|
+
* before[datasetItemId](mergedContext) -> returns itemContext (Record | null), if registered
|
|
1095
|
+
* BaseTask.run(..., setupContext) <- receives merged context
|
|
1096
|
+
* after[datasetItemId](result, setupContext), if registered
|
|
1097
|
+
* afterEach(result, setupContext)
|
|
1098
|
+
* afterAll(results, sharedContext)
|
|
1099
|
+
*
|
|
1100
|
+
* Failure semantics:
|
|
1101
|
+
* - beforeAll failure -> entire run is marked failed (prescript_failed), no scenarios run
|
|
1102
|
+
* - beforeEach failure -> that scenario is marked failed (prescript_failed), others continue
|
|
1103
|
+
* - before failure -> that scenario is marked failed (prescript_failed), others continue
|
|
1104
|
+
* - after / afterEach -> both always attempt to run; if the scenario otherwise
|
|
1105
|
+
* succeeded it is marked postscript_failed, otherwise the
|
|
1106
|
+
* existing failure status/reason is preserved
|
|
1107
|
+
* - afterAll failure -> successfully completed scenarios are marked
|
|
1108
|
+
* postscript_failed; already-failed scenarios keep their status
|
|
1109
|
+
*/
|
|
1110
|
+
/** Hook that runs once before any scenario starts. May return shared context. */
|
|
1111
|
+
type BeforeAllFn = () => Record<string, any> | null | void | Promise<Record<string, any> | null | void>;
|
|
1112
|
+
/** Hook that runs before every scenario. Receives shared context, may return per-item context. */
|
|
1113
|
+
type BeforeEachFn = (sharedContext: Record<string, any> | null) => Record<string, any> | null | void | Promise<Record<string, any> | null | void>;
|
|
1114
|
+
/** Hook that runs before a specific scenario. Receives merged context, may return item context. */
|
|
1115
|
+
type BeforeFn = (sharedContext: Record<string, any> | null) => Record<string, any> | null | void | Promise<Record<string, any> | null | void>;
|
|
1116
|
+
/** Hook that runs after a specific scenario. Receives result and setup context. */
|
|
1117
|
+
type AfterFn = (itemResult: Record<string, any>, setupContext: Record<string, any> | null) => void | Promise<void>;
|
|
1118
|
+
/** Hook that runs after every scenario. Receives result and setup context. */
|
|
1119
|
+
type AfterEachFn = (itemResult: Record<string, any>, setupContext: Record<string, any> | null) => void | Promise<void>;
|
|
1120
|
+
/** Hook that runs once after all scenarios complete. Receives aggregated results and shared context. */
|
|
1121
|
+
type AfterAllFn = (results: Record<string, any>, sharedContext: Record<string, any> | null) => void | Promise<void>;
|
|
1122
|
+
/**
|
|
1123
|
+
* Container for lifecycle hook functions attached to a simulation run.
|
|
1124
|
+
*
|
|
1125
|
+
* All hooks are optional. When a hook is not provided the corresponding
|
|
1126
|
+
* lifecycle phase is silently skipped.
|
|
1127
|
+
*/
|
|
1128
|
+
interface SimulationHooks {
|
|
1129
|
+
/** Called once before any scenario starts. May return a dict forwarded as sharedContext. */
|
|
1130
|
+
beforeAll?: BeforeAllFn;
|
|
1131
|
+
/** Called before every scenario. Receives sharedContext, may return per-item context merged into setupContext. */
|
|
1132
|
+
beforeEach?: BeforeEachFn;
|
|
1133
|
+
/** Dict mapping datasetItemId to hook functions. Called before specific scenarios only. */
|
|
1134
|
+
before?: Record<string, BeforeFn>;
|
|
1135
|
+
/** Dict mapping datasetItemId to hook functions. Called after specific scenarios only. */
|
|
1136
|
+
after?: Record<string, AfterFn>;
|
|
1137
|
+
/** Called after every scenario. Receives the item result and setupContext. */
|
|
1138
|
+
afterEach?: AfterEachFn;
|
|
1139
|
+
/** Called once after all scenarios finish. Receives aggregated results and sharedContext. */
|
|
1140
|
+
afterAll?: AfterAllFn;
|
|
1141
|
+
}
|
|
1142
|
+
|
|
1077
1143
|
/**
|
|
1078
1144
|
* Raw file metadata received from the backend.
|
|
1079
1145
|
*
|
|
@@ -1105,6 +1171,7 @@ interface ProcessedFile {
|
|
|
1105
1171
|
*/
|
|
1106
1172
|
interface SimulationItem {
|
|
1107
1173
|
runItemId: string;
|
|
1174
|
+
datasetItemId: string;
|
|
1108
1175
|
message: string;
|
|
1109
1176
|
turnId: string;
|
|
1110
1177
|
files?: FileData[];
|
|
@@ -1134,6 +1201,7 @@ interface ConversationResult {
|
|
|
1134
1201
|
runItemId: string;
|
|
1135
1202
|
success: boolean;
|
|
1136
1203
|
error?: string;
|
|
1204
|
+
status?: string;
|
|
1137
1205
|
finalTurnId?: string;
|
|
1138
1206
|
turnId?: string;
|
|
1139
1207
|
}
|
|
@@ -1155,11 +1223,15 @@ declare abstract class BaseTask {
|
|
|
1155
1223
|
* @param sessionId - The session identifier.
|
|
1156
1224
|
* @param files - Optional list of base64-encoded file attachments from the
|
|
1157
1225
|
* dataset item. Will be `null` when no files are attached.
|
|
1226
|
+
* @param setupContext - Optional dict populated by `beforeAll` and `before`
|
|
1227
|
+
* hooks. Will be `null` when no hooks are configured.
|
|
1228
|
+
* Use this to access shared resources (e.g. a pre-created
|
|
1229
|
+
* employee ID) set up before the scenario started.
|
|
1158
1230
|
* @returns The task result containing:
|
|
1159
1231
|
* - message (string): The response message from the task.
|
|
1160
1232
|
* - sessionId (string): The session identifier.
|
|
1161
1233
|
*/
|
|
1162
|
-
abstract run(message: string, sessionId?: string | null, files?: ProcessedFile[] | null): Promise<TaskResult> | TaskResult;
|
|
1234
|
+
abstract run(message: string, sessionId?: string | null, files?: ProcessedFile[] | null, setupContext?: Record<string, any> | null): Promise<TaskResult> | TaskResult;
|
|
1163
1235
|
}
|
|
1164
1236
|
|
|
1165
1237
|
/**
|
|
@@ -1172,6 +1244,7 @@ interface SimulationOptions {
|
|
|
1172
1244
|
task: BaseTask;
|
|
1173
1245
|
context?: Record<string, any>;
|
|
1174
1246
|
maxConcurrency?: number;
|
|
1247
|
+
hooks?: SimulationHooks;
|
|
1175
1248
|
}
|
|
1176
1249
|
/**
|
|
1177
1250
|
* Public API for running multi-turn conversation simulations.
|
|
@@ -1183,26 +1256,51 @@ declare class Simulation {
|
|
|
1183
1256
|
/**
|
|
1184
1257
|
* Run a multi-turn conversation simulation.
|
|
1185
1258
|
*
|
|
1259
|
+
* Uses the two-phase API flow:
|
|
1260
|
+
* 1. initializeRun (no LLM cost) — with optional lifecycle hooks metadata
|
|
1261
|
+
* 2. beforeAll hook (if configured)
|
|
1262
|
+
* 3. Per-item: before hook -> generateFirstTurn -> conversation loop -> after hook
|
|
1263
|
+
* 4. afterAll hook (if configured)
|
|
1264
|
+
*
|
|
1186
1265
|
* @param options - Simulation configuration options
|
|
1187
1266
|
* @returns Dictionary with simulation results, or null on failure
|
|
1188
1267
|
*/
|
|
1189
1268
|
runSimulation(options: SimulationOptions): Promise<SimulationResult | null>;
|
|
1190
1269
|
/**
|
|
1191
|
-
*
|
|
1270
|
+
* Orchestrate concurrent simulation execution with hooks support.
|
|
1192
1271
|
*/
|
|
1193
1272
|
private _runSimulationAsync;
|
|
1273
|
+
/**
|
|
1274
|
+
* Report failures for many items concurrently, capped like other paths.
|
|
1275
|
+
*/
|
|
1276
|
+
private _reportFailures;
|
|
1277
|
+
/**
|
|
1278
|
+
* Run after/afterEach hooks independently.
|
|
1279
|
+
*
|
|
1280
|
+
* Both hooks always attempt to run. `postscript_failed` is reported only
|
|
1281
|
+
* when the item otherwise succeeded — an existing failure status/reason is
|
|
1282
|
+
* never overwritten.
|
|
1283
|
+
*/
|
|
1284
|
+
private _runAfterHooks;
|
|
1194
1285
|
/**
|
|
1195
1286
|
* Execute a multi-turn conversation for a single simulation item.
|
|
1287
|
+
*
|
|
1288
|
+
* The per-item before hook has already been executed by the caller;
|
|
1289
|
+
* the merged setupContext is passed directly to executeTask.
|
|
1290
|
+
* The after hook runs when the conversation ends (success or failure).
|
|
1196
1291
|
*/
|
|
1197
1292
|
private _executeConversation;
|
|
1198
1293
|
}
|
|
1199
1294
|
|
|
1200
1295
|
/**
|
|
1201
|
-
* Result from
|
|
1296
|
+
* Result from initializing a simulation run (two-phase flow).
|
|
1202
1297
|
*/
|
|
1203
|
-
interface
|
|
1298
|
+
interface InitializeRunResult {
|
|
1204
1299
|
runId: string;
|
|
1205
|
-
|
|
1300
|
+
items: Array<{
|
|
1301
|
+
runItemId: string;
|
|
1302
|
+
datasetItemId: string;
|
|
1303
|
+
}>;
|
|
1206
1304
|
}
|
|
1207
1305
|
|
|
1208
1306
|
/**
|
|
@@ -1706,4 +1804,4 @@ declare class Netra {
|
|
|
1706
1804
|
static withBlockedSpansLocal: typeof withBlockedSpansLocal;
|
|
1707
1805
|
}
|
|
1708
1806
|
|
|
1709
|
-
export { type ActionModel, Aggregation, BaseTask, type CategoricalDataPoint, ChartType, Config, type ConversationResponse, type ConversationResult, ConversationType, type CreateDatasetParams,
|
|
1807
|
+
export { type ActionModel, type AfterAllFn, type AfterFn, Aggregation, BaseTask, type BeforeAllFn, type BeforeFn, type CategoricalDataPoint, ChartType, Config, type ConversationResponse, type ConversationResult, ConversationType, type CreateDatasetParams, DEFAULT_INSTRUMENTS, DEFAULT_INSTRUMENTS_FOR_ROOT, Dashboard, type DashboardData, type Dataset, type DatasetEntry, type DatasetItem, type Dimension, DimensionField, type DimensionValue, EntryStatus, Evaluation, type EvaluationScore, type EvaluatorFunction, type Filter, type FilterConfig, FilterField, FilterType, FilteringSpanExporter, type GetPromptParams, GroupBy, type InitializeRunResult, InstrumentationSpanProcessor, type ListSpansParams, type ListTracesParams, Measure, type Metrics, Netra, NetraAgentsTracingProcessor, NetraInstruments, NetraOpenAIAgentsInstrumentor, type NumberResponse, Operator, type ProcessedFile, type PromptResponse, Prompts, type QueryDataParams, type QueryResponse, type Run, RunEntryContext, RunStatus, type SafeStringifyOptions, Scope, ScrubbingSpanProcessor, SerializationSpanProcessor, SessionSpanProcessor, type SessionUsageData, Simulation, type SimulationHooks, type SimulationItem, type SimulationOptions, type SimulationResult, SpanIOProcessor, type SpanOptions, SpanType, type SpansPage, type TaskFunction, type TaskResult, type TenantUsageData, type TestSuiteResult, type TimeRange, type TimeSeriesDataPoint, type TimeSeriesResponse, type TimeSeriesWithDimension, type TraceSpan, type TraceSummary, type TracesPage, TrialAwareOTLPExporter, TruncatingSerializer, Usage, type UsageModel, agent, Netra as default, metadataField, mistralAIInstrumentor, netraExpressMiddleware, openaiAgentsInstrumentor, runWithExtractedContext, safeStringify, span, task, workflow };
|
package/dist/index.d.ts
CHANGED
|
@@ -80,7 +80,7 @@ declare const DEFAULT_INSTRUMENTS: Set<NetraInstruments>;
|
|
|
80
80
|
declare class Config {
|
|
81
81
|
static readonly SDK_NAME = "netra";
|
|
82
82
|
static readonly LIBRARY_NAME = "netra";
|
|
83
|
-
static readonly LIBRARY_VERSION = "1.
|
|
83
|
+
static readonly LIBRARY_VERSION = "1.8.0";
|
|
84
84
|
static readonly TRIAL_BLOCK_DURATION_SECONDS = 900;
|
|
85
85
|
private static _spanAttributeMaxSize;
|
|
86
86
|
/**
|
|
@@ -1074,6 +1074,72 @@ interface DecoratorOptions {
|
|
|
1074
1074
|
}
|
|
1075
1075
|
type SpanCallback<T> = (span: SpanWrapper) => T;
|
|
1076
1076
|
|
|
1077
|
+
/**
|
|
1078
|
+
* Pre/post script hooks for multi-turn simulation runs.
|
|
1079
|
+
*
|
|
1080
|
+
* Hooks let you run setup and teardown logic around scenario execution
|
|
1081
|
+
* without merging all scenarios into one or relying on sequential ordering.
|
|
1082
|
+
*
|
|
1083
|
+
* Hook levels:
|
|
1084
|
+
* beforeAll -- runs once before any scenario starts (dataset-level setup)
|
|
1085
|
+
* beforeEach -- runs before every scenario (common per-item setup)
|
|
1086
|
+
* before -- runs before specific scenarios only (item-specific setup, keyed by datasetItemId)
|
|
1087
|
+
* after -- runs after specific scenarios only (item-specific teardown, keyed by datasetItemId)
|
|
1088
|
+
* afterEach -- runs after every scenario (common per-item teardown)
|
|
1089
|
+
* afterAll -- runs once after all scenarios complete (dataset-level teardown)
|
|
1090
|
+
*
|
|
1091
|
+
* Execution order per item:
|
|
1092
|
+
* beforeAll() -> returns sharedContext (Record | null)
|
|
1093
|
+
* beforeEach(sharedContext) -> returns eachContext (Record | null)
|
|
1094
|
+
* before[datasetItemId](mergedContext) -> returns itemContext (Record | null), if registered
|
|
1095
|
+
* BaseTask.run(..., setupContext) <- receives merged context
|
|
1096
|
+
* after[datasetItemId](result, setupContext), if registered
|
|
1097
|
+
* afterEach(result, setupContext)
|
|
1098
|
+
* afterAll(results, sharedContext)
|
|
1099
|
+
*
|
|
1100
|
+
* Failure semantics:
|
|
1101
|
+
* - beforeAll failure -> entire run is marked failed (prescript_failed), no scenarios run
|
|
1102
|
+
* - beforeEach failure -> that scenario is marked failed (prescript_failed), others continue
|
|
1103
|
+
* - before failure -> that scenario is marked failed (prescript_failed), others continue
|
|
1104
|
+
* - after / afterEach -> both always attempt to run; if the scenario otherwise
|
|
1105
|
+
* succeeded it is marked postscript_failed, otherwise the
|
|
1106
|
+
* existing failure status/reason is preserved
|
|
1107
|
+
* - afterAll failure -> successfully completed scenarios are marked
|
|
1108
|
+
* postscript_failed; already-failed scenarios keep their status
|
|
1109
|
+
*/
|
|
1110
|
+
/** Hook that runs once before any scenario starts. May return shared context. */
|
|
1111
|
+
type BeforeAllFn = () => Record<string, any> | null | void | Promise<Record<string, any> | null | void>;
|
|
1112
|
+
/** Hook that runs before every scenario. Receives shared context, may return per-item context. */
|
|
1113
|
+
type BeforeEachFn = (sharedContext: Record<string, any> | null) => Record<string, any> | null | void | Promise<Record<string, any> | null | void>;
|
|
1114
|
+
/** Hook that runs before a specific scenario. Receives merged context, may return item context. */
|
|
1115
|
+
type BeforeFn = (sharedContext: Record<string, any> | null) => Record<string, any> | null | void | Promise<Record<string, any> | null | void>;
|
|
1116
|
+
/** Hook that runs after a specific scenario. Receives result and setup context. */
|
|
1117
|
+
type AfterFn = (itemResult: Record<string, any>, setupContext: Record<string, any> | null) => void | Promise<void>;
|
|
1118
|
+
/** Hook that runs after every scenario. Receives result and setup context. */
|
|
1119
|
+
type AfterEachFn = (itemResult: Record<string, any>, setupContext: Record<string, any> | null) => void | Promise<void>;
|
|
1120
|
+
/** Hook that runs once after all scenarios complete. Receives aggregated results and shared context. */
|
|
1121
|
+
type AfterAllFn = (results: Record<string, any>, sharedContext: Record<string, any> | null) => void | Promise<void>;
|
|
1122
|
+
/**
|
|
1123
|
+
* Container for lifecycle hook functions attached to a simulation run.
|
|
1124
|
+
*
|
|
1125
|
+
* All hooks are optional. When a hook is not provided the corresponding
|
|
1126
|
+
* lifecycle phase is silently skipped.
|
|
1127
|
+
*/
|
|
1128
|
+
interface SimulationHooks {
|
|
1129
|
+
/** Called once before any scenario starts. May return a dict forwarded as sharedContext. */
|
|
1130
|
+
beforeAll?: BeforeAllFn;
|
|
1131
|
+
/** Called before every scenario. Receives sharedContext, may return per-item context merged into setupContext. */
|
|
1132
|
+
beforeEach?: BeforeEachFn;
|
|
1133
|
+
/** Dict mapping datasetItemId to hook functions. Called before specific scenarios only. */
|
|
1134
|
+
before?: Record<string, BeforeFn>;
|
|
1135
|
+
/** Dict mapping datasetItemId to hook functions. Called after specific scenarios only. */
|
|
1136
|
+
after?: Record<string, AfterFn>;
|
|
1137
|
+
/** Called after every scenario. Receives the item result and setupContext. */
|
|
1138
|
+
afterEach?: AfterEachFn;
|
|
1139
|
+
/** Called once after all scenarios finish. Receives aggregated results and sharedContext. */
|
|
1140
|
+
afterAll?: AfterAllFn;
|
|
1141
|
+
}
|
|
1142
|
+
|
|
1077
1143
|
/**
|
|
1078
1144
|
* Raw file metadata received from the backend.
|
|
1079
1145
|
*
|
|
@@ -1105,6 +1171,7 @@ interface ProcessedFile {
|
|
|
1105
1171
|
*/
|
|
1106
1172
|
interface SimulationItem {
|
|
1107
1173
|
runItemId: string;
|
|
1174
|
+
datasetItemId: string;
|
|
1108
1175
|
message: string;
|
|
1109
1176
|
turnId: string;
|
|
1110
1177
|
files?: FileData[];
|
|
@@ -1134,6 +1201,7 @@ interface ConversationResult {
|
|
|
1134
1201
|
runItemId: string;
|
|
1135
1202
|
success: boolean;
|
|
1136
1203
|
error?: string;
|
|
1204
|
+
status?: string;
|
|
1137
1205
|
finalTurnId?: string;
|
|
1138
1206
|
turnId?: string;
|
|
1139
1207
|
}
|
|
@@ -1155,11 +1223,15 @@ declare abstract class BaseTask {
|
|
|
1155
1223
|
* @param sessionId - The session identifier.
|
|
1156
1224
|
* @param files - Optional list of base64-encoded file attachments from the
|
|
1157
1225
|
* dataset item. Will be `null` when no files are attached.
|
|
1226
|
+
* @param setupContext - Optional dict populated by `beforeAll` and `before`
|
|
1227
|
+
* hooks. Will be `null` when no hooks are configured.
|
|
1228
|
+
* Use this to access shared resources (e.g. a pre-created
|
|
1229
|
+
* employee ID) set up before the scenario started.
|
|
1158
1230
|
* @returns The task result containing:
|
|
1159
1231
|
* - message (string): The response message from the task.
|
|
1160
1232
|
* - sessionId (string): The session identifier.
|
|
1161
1233
|
*/
|
|
1162
|
-
abstract run(message: string, sessionId?: string | null, files?: ProcessedFile[] | null): Promise<TaskResult> | TaskResult;
|
|
1234
|
+
abstract run(message: string, sessionId?: string | null, files?: ProcessedFile[] | null, setupContext?: Record<string, any> | null): Promise<TaskResult> | TaskResult;
|
|
1163
1235
|
}
|
|
1164
1236
|
|
|
1165
1237
|
/**
|
|
@@ -1172,6 +1244,7 @@ interface SimulationOptions {
|
|
|
1172
1244
|
task: BaseTask;
|
|
1173
1245
|
context?: Record<string, any>;
|
|
1174
1246
|
maxConcurrency?: number;
|
|
1247
|
+
hooks?: SimulationHooks;
|
|
1175
1248
|
}
|
|
1176
1249
|
/**
|
|
1177
1250
|
* Public API for running multi-turn conversation simulations.
|
|
@@ -1183,26 +1256,51 @@ declare class Simulation {
|
|
|
1183
1256
|
/**
|
|
1184
1257
|
* Run a multi-turn conversation simulation.
|
|
1185
1258
|
*
|
|
1259
|
+
* Uses the two-phase API flow:
|
|
1260
|
+
* 1. initializeRun (no LLM cost) — with optional lifecycle hooks metadata
|
|
1261
|
+
* 2. beforeAll hook (if configured)
|
|
1262
|
+
* 3. Per-item: before hook -> generateFirstTurn -> conversation loop -> after hook
|
|
1263
|
+
* 4. afterAll hook (if configured)
|
|
1264
|
+
*
|
|
1186
1265
|
* @param options - Simulation configuration options
|
|
1187
1266
|
* @returns Dictionary with simulation results, or null on failure
|
|
1188
1267
|
*/
|
|
1189
1268
|
runSimulation(options: SimulationOptions): Promise<SimulationResult | null>;
|
|
1190
1269
|
/**
|
|
1191
|
-
*
|
|
1270
|
+
* Orchestrate concurrent simulation execution with hooks support.
|
|
1192
1271
|
*/
|
|
1193
1272
|
private _runSimulationAsync;
|
|
1273
|
+
/**
|
|
1274
|
+
* Report failures for many items concurrently, capped like other paths.
|
|
1275
|
+
*/
|
|
1276
|
+
private _reportFailures;
|
|
1277
|
+
/**
|
|
1278
|
+
* Run after/afterEach hooks independently.
|
|
1279
|
+
*
|
|
1280
|
+
* Both hooks always attempt to run. `postscript_failed` is reported only
|
|
1281
|
+
* when the item otherwise succeeded — an existing failure status/reason is
|
|
1282
|
+
* never overwritten.
|
|
1283
|
+
*/
|
|
1284
|
+
private _runAfterHooks;
|
|
1194
1285
|
/**
|
|
1195
1286
|
* Execute a multi-turn conversation for a single simulation item.
|
|
1287
|
+
*
|
|
1288
|
+
* The per-item before hook has already been executed by the caller;
|
|
1289
|
+
* the merged setupContext is passed directly to executeTask.
|
|
1290
|
+
* The after hook runs when the conversation ends (success or failure).
|
|
1196
1291
|
*/
|
|
1197
1292
|
private _executeConversation;
|
|
1198
1293
|
}
|
|
1199
1294
|
|
|
1200
1295
|
/**
|
|
1201
|
-
* Result from
|
|
1296
|
+
* Result from initializing a simulation run (two-phase flow).
|
|
1202
1297
|
*/
|
|
1203
|
-
interface
|
|
1298
|
+
interface InitializeRunResult {
|
|
1204
1299
|
runId: string;
|
|
1205
|
-
|
|
1300
|
+
items: Array<{
|
|
1301
|
+
runItemId: string;
|
|
1302
|
+
datasetItemId: string;
|
|
1303
|
+
}>;
|
|
1206
1304
|
}
|
|
1207
1305
|
|
|
1208
1306
|
/**
|
|
@@ -1706,4 +1804,4 @@ declare class Netra {
|
|
|
1706
1804
|
static withBlockedSpansLocal: typeof withBlockedSpansLocal;
|
|
1707
1805
|
}
|
|
1708
1806
|
|
|
1709
|
-
export { type ActionModel, Aggregation, BaseTask, type CategoricalDataPoint, ChartType, Config, type ConversationResponse, type ConversationResult, ConversationType, type CreateDatasetParams,
|
|
1807
|
+
export { type ActionModel, type AfterAllFn, type AfterFn, Aggregation, BaseTask, type BeforeAllFn, type BeforeFn, type CategoricalDataPoint, ChartType, Config, type ConversationResponse, type ConversationResult, ConversationType, type CreateDatasetParams, DEFAULT_INSTRUMENTS, DEFAULT_INSTRUMENTS_FOR_ROOT, Dashboard, type DashboardData, type Dataset, type DatasetEntry, type DatasetItem, type Dimension, DimensionField, type DimensionValue, EntryStatus, Evaluation, type EvaluationScore, type EvaluatorFunction, type Filter, type FilterConfig, FilterField, FilterType, FilteringSpanExporter, type GetPromptParams, GroupBy, type InitializeRunResult, InstrumentationSpanProcessor, type ListSpansParams, type ListTracesParams, Measure, type Metrics, Netra, NetraAgentsTracingProcessor, NetraInstruments, NetraOpenAIAgentsInstrumentor, type NumberResponse, Operator, type ProcessedFile, type PromptResponse, Prompts, type QueryDataParams, type QueryResponse, type Run, RunEntryContext, RunStatus, type SafeStringifyOptions, Scope, ScrubbingSpanProcessor, SerializationSpanProcessor, SessionSpanProcessor, type SessionUsageData, Simulation, type SimulationHooks, type SimulationItem, type SimulationOptions, type SimulationResult, SpanIOProcessor, type SpanOptions, SpanType, type SpansPage, type TaskFunction, type TaskResult, type TenantUsageData, type TestSuiteResult, type TimeRange, type TimeSeriesDataPoint, type TimeSeriesResponse, type TimeSeriesWithDimension, type TraceSpan, type TraceSummary, type TracesPage, TrialAwareOTLPExporter, TruncatingSerializer, Usage, type UsageModel, agent, Netra as default, metadataField, mistralAIInstrumentor, netraExpressMiddleware, openaiAgentsInstrumentor, runWithExtractedContext, safeStringify, span, task, workflow };
|