bitfab 0.48.0 → 0.51.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/{chunk-JXDMOPST.js → chunk-2RAX75MI.js} +62 -6
- package/dist/chunk-2RAX75MI.js.map +1 -0
- package/dist/{chunk-3VHHLXEJ.js → chunk-4Z5FCOMO.js} +9 -5
- package/dist/{chunk-3VHHLXEJ.js.map → chunk-4Z5FCOMO.js.map} +1 -1
- package/dist/{chunk-I6SVO5KX.js → chunk-TCOMLVHK.js} +23 -5
- package/dist/chunk-TCOMLVHK.js.map +1 -0
- package/dist/{chunk-CPMT6Y43.js → chunk-WBV4YW7X.js} +9 -5
- package/dist/{chunk-CPMT6Y43.js.map → chunk-WBV4YW7X.js.map} +1 -1
- package/dist/{http-42E3SI2N.js → http-CS565CIX.js} +2 -2
- package/dist/{http-YN67UB3K.js → http-RQXNGCUQ.js} +2 -2
- package/dist/index.cjs +89 -7
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +77 -9
- package/dist/index.d.ts +77 -9
- package/dist/index.js +5 -3
- package/dist/node.cjs +89 -7
- package/dist/node.cjs.map +1 -1
- package/dist/node.d.cts +1 -1
- package/dist/node.d.ts +1 -1
- package/dist/node.js +5 -3
- package/dist/node.js.map +1 -1
- package/dist/{replay-QMTLYKMX.js → replay-77T5PFOU.js} +3 -3
- package/dist/replayCli.js +40 -14
- package/dist/replayCli.js.map +1 -1
- package/package.json +1 -1
- package/dist/chunk-I6SVO5KX.js.map +0 -1
- package/dist/chunk-JXDMOPST.js.map +0 -1
- /package/dist/{http-42E3SI2N.js.map → http-CS565CIX.js.map} +0 -0
- /package/dist/{http-YN67UB3K.js.map → http-RQXNGCUQ.js.map} +0 -0
- /package/dist/{replay-QMTLYKMX.js.map → replay-77T5PFOU.js.map} +0 -0
package/dist/index.d.cts
CHANGED
|
@@ -556,7 +556,7 @@ declare class HttpClient {
|
|
|
556
556
|
* Start a replay session by fetching historical traces.
|
|
557
557
|
* Blocking call - creates a test run and returns lightweight item references.
|
|
558
558
|
*/
|
|
559
|
-
startReplay(traceFunctionKey: string, limit: number | undefined, traceIds?: string[], name?: string, codeChangeDescription?: string | null, codeChangeFiles?: CodeChangeFile[] | null, includeDbBranchLease?: boolean, experimentGroupId?: string,
|
|
559
|
+
startReplay(traceFunctionKey: string, limit: number | undefined, traceIds?: string[], name?: string, codeChangeDescription?: string | null, codeChangeFiles?: CodeChangeFile[] | null, includeDbBranchLease?: boolean, experimentGroupId?: string, datasetIds?: string[], graderIds?: string[], dbBranchSettings?: DbBranchSettings, attempts?: number, includeOriginalMetadata?: boolean, onlyWithAssertions?: boolean): Promise<StartReplayResponse>;
|
|
560
560
|
/**
|
|
561
561
|
* Fetch an external span by ID.
|
|
562
562
|
* Blocking GET request.
|
|
@@ -1259,6 +1259,8 @@ declare class DatasetsClient {
|
|
|
1259
1259
|
|
|
1260
1260
|
type LabelConfidence = "VeryLow" | "Low" | "Medium" | "High" | "VeryHigh";
|
|
1261
1261
|
type LabelAction = "set" | "archived" | "no-active-label" | "skipped";
|
|
1262
|
+
type LabelStatus = "labeled" | "skipped" | "unlabeled";
|
|
1263
|
+
type LabelSource = "human" | "agent";
|
|
1262
1264
|
type LabelTarget = ({
|
|
1263
1265
|
traceId: string;
|
|
1264
1266
|
originalTraceId?: never;
|
|
@@ -1285,11 +1287,72 @@ type LabelOutcome = {
|
|
|
1285
1287
|
traceId: string;
|
|
1286
1288
|
action: LabelAction;
|
|
1287
1289
|
};
|
|
1290
|
+
type HumanLabelUpdate = {
|
|
1291
|
+
traceId: string;
|
|
1292
|
+
assertionId?: string;
|
|
1293
|
+
label: boolean;
|
|
1294
|
+
annotation: string;
|
|
1295
|
+
confidence?: LabelConfidence;
|
|
1296
|
+
};
|
|
1297
|
+
type HumanLabelOutcome = {
|
|
1298
|
+
traceId: string;
|
|
1299
|
+
assertionId: string | null;
|
|
1300
|
+
label: boolean;
|
|
1301
|
+
action: "set";
|
|
1302
|
+
};
|
|
1303
|
+
type AssertionVerdict = {
|
|
1304
|
+
assertionId: string;
|
|
1305
|
+
assertion: string | null;
|
|
1306
|
+
labelStatus: LabelStatus;
|
|
1307
|
+
label: boolean | null;
|
|
1308
|
+
annotation: string | null;
|
|
1309
|
+
confidence: LabelConfidence | null;
|
|
1310
|
+
labelSource: LabelSource;
|
|
1311
|
+
approved: boolean;
|
|
1312
|
+
};
|
|
1313
|
+
type TraceLabels = {
|
|
1314
|
+
traceId: string;
|
|
1315
|
+
labelStatus: LabelStatus;
|
|
1316
|
+
label: boolean | null;
|
|
1317
|
+
annotation: string | null;
|
|
1318
|
+
approved: boolean;
|
|
1319
|
+
passed: number;
|
|
1320
|
+
failed: number;
|
|
1321
|
+
assertions: AssertionVerdict[];
|
|
1322
|
+
};
|
|
1288
1323
|
declare class LabelsClient {
|
|
1289
1324
|
private readonly httpClient;
|
|
1290
1325
|
constructor(httpClient: HttpClient);
|
|
1291
1326
|
save(update: LabelUpdate, testRunId?: string): Promise<LabelOutcome>;
|
|
1292
1327
|
saveAll(updates: LabelUpdate[], testRunId?: string): Promise<LabelOutcome[]>;
|
|
1328
|
+
saveHuman(update: HumanLabelUpdate): Promise<HumanLabelOutcome>;
|
|
1329
|
+
saveHumanAll(updates: HumanLabelUpdate[]): Promise<HumanLabelOutcome[]>;
|
|
1330
|
+
get(traceId: string): Promise<TraceLabels | null>;
|
|
1331
|
+
getAll(traceIds: string[]): Promise<TraceLabels[]>;
|
|
1332
|
+
}
|
|
1333
|
+
|
|
1334
|
+
type GraderLabelSource = "human" | "live_grader";
|
|
1335
|
+
type GraderLabel = {
|
|
1336
|
+
traceId: string;
|
|
1337
|
+
graderId: string;
|
|
1338
|
+
graderName: string | null;
|
|
1339
|
+
graderStatus: string;
|
|
1340
|
+
label: boolean | null;
|
|
1341
|
+
labelReason: string | null;
|
|
1342
|
+
failureDiagnostic: string | null;
|
|
1343
|
+
labelConfidence: LabelConfidence | null;
|
|
1344
|
+
source: GraderLabelSource;
|
|
1345
|
+
evaluatedAt: string | null;
|
|
1346
|
+
};
|
|
1347
|
+
type GetGraderLabelsParams = {
|
|
1348
|
+
traceIds?: string[];
|
|
1349
|
+
graderId?: string;
|
|
1350
|
+
limit?: number;
|
|
1351
|
+
};
|
|
1352
|
+
declare class GradersClient {
|
|
1353
|
+
private readonly httpClient;
|
|
1354
|
+
constructor(httpClient: HttpClient);
|
|
1355
|
+
getLabels(params: GetGraderLabelsParams): Promise<GraderLabel[]>;
|
|
1293
1356
|
}
|
|
1294
1357
|
|
|
1295
1358
|
/**
|
|
@@ -1582,12 +1645,15 @@ interface DbBranchOptions {
|
|
|
1582
1645
|
interface ReplayOptions {
|
|
1583
1646
|
/**
|
|
1584
1647
|
* Maximum number of traces to replay (1-5,000, default 5). Ignored when
|
|
1585
|
-
* `traceIds` is passed (with a warning), or when `datasetId`
|
|
1586
|
-
* because either source already determines how many traces replay.
|
|
1648
|
+
* `traceIds` is passed (with a warning), or when `datasetId` / `datasetIds`
|
|
1649
|
+
* is passed, because either source already determines how many traces replay.
|
|
1587
1650
|
*/
|
|
1588
1651
|
limit?: number;
|
|
1589
1652
|
attempts?: number;
|
|
1590
|
-
/**
|
|
1653
|
+
/**
|
|
1654
|
+
* Optional list of specific trace IDs to replay (max 100). Mutually exclusive
|
|
1655
|
+
* with `datasetId` and `datasetIds`.
|
|
1656
|
+
*/
|
|
1591
1657
|
traceIds?: string[];
|
|
1592
1658
|
/** Optional display name for the resulting experiment/test run. */
|
|
1593
1659
|
name?: string;
|
|
@@ -1644,13 +1710,14 @@ interface ReplayOptions {
|
|
|
1644
1710
|
/** Group ID to associate this replay with an experiment group for live streaming in Studio. */
|
|
1645
1711
|
experimentGroupId?: string;
|
|
1646
1712
|
/**
|
|
1647
|
-
* Dataset this replay runs against. Mutually exclusive with `traceIds
|
|
1648
|
-
* set, the resulting experiment is
|
|
1713
|
+
* Dataset this replay runs against. Mutually exclusive with `traceIds` and
|
|
1714
|
+
* with `datasetIds`. When set, the resulting experiment is
|
|
1649
1715
|
* durably attributed to the dataset (stored on the test run), so it appears
|
|
1650
1716
|
* under the dataset's experiments even if the trace lineage can't be
|
|
1651
1717
|
* reconstructed. Validated server-side against the org.
|
|
1652
1718
|
*/
|
|
1653
1719
|
datasetId?: string;
|
|
1720
|
+
datasetIds?: string[];
|
|
1654
1721
|
/**
|
|
1655
1722
|
* Graders to attach directly to this experiment (test run), independent of any
|
|
1656
1723
|
* graders already on the dataset. The resulting experiment is graded by the
|
|
@@ -1663,7 +1730,7 @@ interface ReplayOptions {
|
|
|
1663
1730
|
/**
|
|
1664
1731
|
* Replay only the selected traces that carry at least one assertion.
|
|
1665
1732
|
*
|
|
1666
|
-
* Narrows whatever `limit`, `traceIds` or `
|
|
1733
|
+
* Narrows whatever `limit`, `traceIds` or `datasetIds` selected, so a run that
|
|
1667
1734
|
* measures assertion outcomes does not pay to re-execute traces nothing can
|
|
1668
1735
|
* grade. The server applies it as part of selection, which is what makes it
|
|
1669
1736
|
* compose with `limit`: `{ limit: 10, onlyWithAssertions: true }` is the ten
|
|
@@ -2566,6 +2633,7 @@ declare class Bitfab {
|
|
|
2566
2633
|
readonly datasets: DatasetsClient;
|
|
2567
2634
|
readonly traces: TracesClient;
|
|
2568
2635
|
readonly labels: LabelsClient;
|
|
2636
|
+
readonly graders: GradersClient;
|
|
2569
2637
|
private readonly bamlClient;
|
|
2570
2638
|
private readonly dbSnapshot;
|
|
2571
2639
|
private readonly autoTracePolicyRefreshes;
|
|
@@ -3211,7 +3279,7 @@ declare class BitfabFunction {
|
|
|
3211
3279
|
/**
|
|
3212
3280
|
* SDK version from package.json (injected at build time)
|
|
3213
3281
|
*/
|
|
3214
|
-
declare const __version__ = "0.
|
|
3282
|
+
declare const __version__ = "0.51.0";
|
|
3215
3283
|
|
|
3216
3284
|
/**
|
|
3217
3285
|
* Constants for the Bitfab SDK.
|
|
@@ -3341,4 +3409,4 @@ declare function seedFromRegistry(registry: ReplayRegistry, pipeline: string, ca
|
|
|
3341
3409
|
run?: boolean;
|
|
3342
3410
|
}): Promise<SeedResult>;
|
|
3343
3411
|
|
|
3344
|
-
export { type ActiveSpanContext, type AdaptContext, type AdaptInputsFn, type AddDatasetGradersResult, type AddDatasetTracesResult, type AllowedEnvVars, type ArchiveAssertionsParams, BITFAB_PROGRESS_PREFIX, type BamlExecutionResult, Bitfab, BitfabClaudeAgentHandler, type BitfabConfig, BitfabError, BitfabFunction, BitfabLangGraphCallbackHandler as BitfabLangChainCallbackHandler, BitfabLangGraphCallbackHandler, BitfabLangGraphIntegration, type BitfabLanguageModelMiddleware, BitfabOpenAIAgentHandler, BitfabOpenAITracingProcessor, BitfabVercelAiHandler, type CaptureSurface, type CaptureWhen, type CapturedSpan, type CodeChangeFile, type CurrentSpan, type CurrentTrace, DEFAULT_SERVICE_URL, type Dataset, type DatasetGraderRef, type DatasetTraceIds, DatasetsClient, type DbBranchOptions, DbBranchReplayError, type DbBranchTimings, type DbSnapshotConfig, type DbSnapshotProvider, type DbSnapshotRef, type DetachedTrace, type GraderRerun, type GraderRerunProgress, type GraderRerunResult, type GraderRerunStatus, HttpClient, type LabelAction, type LabelConfidence, type LabelOutcome, type LabelUpdate, LabelsClient, type LangGraphIntegrationOptions, type ListDatasetsParams, MixedTracingError, type MockOverride, type MockOverrideCtx, type MockOverrideInput, type MockOverrideResolver, type MockStrategy, type MockValue, NO_MOCK_OVERRIDE, type NodeMatcher, type NodeMethodDecorator, type NodeOptions, type ProviderDefinition, type RemoveDatasetGradersResult, type RemoveDatasetTracesResult, ReplayBranch, ReplayError, type ReplayItem, type ReplayItemFinishProgress, type ReplayItemStartProgress, type ReplayOptions, type ReplayOptionsFactory, type ReplayProgress, type ReplayProgressItem, type ReplayRegistration, type ReplayRegistry, type ReplayRegistryContext, type ReplayRegistryOptions, type ReplayResult, type RerunGradersOptions, type RerunGradersResult, SUPPORTED_PROVIDERS, type SaveAssertion, type SaveAssertionsParams, type SaveDatasetParams, type SaveDatasetResult, type SeedCase, type SeedCaseOptions, type SeedResult, type SeedRunOptions, type SpanLookup, type SpanMethodDecorator, type SpanMethodDecoratorContext, type SpanNodeMeta, type SpanOccurrence, type SpanOptions, type SpanType, type TokenUsage, type TraceAssertion, type TraceAssertionSource, type TraceAssertionsResult, type TraceIngestionType, type TraceOutline, type TraceOutlineSpan, type TraceOutlineSpanError, type TraceResponse, type TraceTarget, type TraceTargetOccurrence, TracesClient, type TracingProcessor, type VercelCallParams, type VercelGenerateResult, type VercelStreamResult, type WrapBAMLOptions, type WrappedBamlFn, __version__, defineReplayRegistry, finalizers, flushTraces, getCurrentReplayBranch, getCurrentSpan, getCurrentTrace, reportReplayProgress, seedFromRegistry, serializeReplayResult };
|
|
3412
|
+
export { type ActiveSpanContext, type AdaptContext, type AdaptInputsFn, type AddDatasetGradersResult, type AddDatasetTracesResult, type AllowedEnvVars, type ArchiveAssertionsParams, type AssertionVerdict, BITFAB_PROGRESS_PREFIX, type BamlExecutionResult, Bitfab, BitfabClaudeAgentHandler, type BitfabConfig, BitfabError, BitfabFunction, BitfabLangGraphCallbackHandler as BitfabLangChainCallbackHandler, BitfabLangGraphCallbackHandler, BitfabLangGraphIntegration, type BitfabLanguageModelMiddleware, BitfabOpenAIAgentHandler, BitfabOpenAITracingProcessor, BitfabVercelAiHandler, type CaptureSurface, type CaptureWhen, type CapturedSpan, type CodeChangeFile, type CurrentSpan, type CurrentTrace, DEFAULT_SERVICE_URL, type Dataset, type DatasetGraderRef, type DatasetTraceIds, DatasetsClient, type DbBranchOptions, DbBranchReplayError, type DbBranchTimings, type DbSnapshotConfig, type DbSnapshotProvider, type DbSnapshotRef, type DetachedTrace, type GetGraderLabelsParams, type GraderLabel, type GraderLabelSource, type GraderRerun, type GraderRerunProgress, type GraderRerunResult, type GraderRerunStatus, GradersClient, HttpClient, type HumanLabelOutcome, type HumanLabelUpdate, type LabelAction, type LabelConfidence, type LabelOutcome, type LabelSource, type LabelStatus, type LabelUpdate, LabelsClient, type LangGraphIntegrationOptions, type ListDatasetsParams, MixedTracingError, type MockOverride, type MockOverrideCtx, type MockOverrideInput, type MockOverrideResolver, type MockStrategy, type MockValue, NO_MOCK_OVERRIDE, type NodeMatcher, type NodeMethodDecorator, type NodeOptions, type ProviderDefinition, type RemoveDatasetGradersResult, type RemoveDatasetTracesResult, ReplayBranch, ReplayError, type ReplayItem, type ReplayItemFinishProgress, type ReplayItemStartProgress, type ReplayOptions, type ReplayOptionsFactory, type ReplayProgress, type ReplayProgressItem, type ReplayRegistration, type ReplayRegistry, type ReplayRegistryContext, type ReplayRegistryOptions, type ReplayResult, type RerunGradersOptions, type RerunGradersResult, SUPPORTED_PROVIDERS, type SaveAssertion, type SaveAssertionsParams, type SaveDatasetParams, type SaveDatasetResult, type SeedCase, type SeedCaseOptions, type SeedResult, type SeedRunOptions, type SpanLookup, type SpanMethodDecorator, type SpanMethodDecoratorContext, type SpanNodeMeta, type SpanOccurrence, type SpanOptions, type SpanType, type TokenUsage, type TraceAssertion, type TraceAssertionSource, type TraceAssertionsResult, type TraceIngestionType, type TraceLabels, type TraceOutline, type TraceOutlineSpan, type TraceOutlineSpanError, type TraceResponse, type TraceTarget, type TraceTargetOccurrence, TracesClient, type TracingProcessor, type VercelCallParams, type VercelGenerateResult, type VercelStreamResult, type WrapBAMLOptions, type WrappedBamlFn, __version__, defineReplayRegistry, finalizers, flushTraces, getCurrentReplayBranch, getCurrentSpan, getCurrentTrace, reportReplayProgress, seedFromRegistry, serializeReplayResult };
|
package/dist/index.d.ts
CHANGED
|
@@ -556,7 +556,7 @@ declare class HttpClient {
|
|
|
556
556
|
* Start a replay session by fetching historical traces.
|
|
557
557
|
* Blocking call - creates a test run and returns lightweight item references.
|
|
558
558
|
*/
|
|
559
|
-
startReplay(traceFunctionKey: string, limit: number | undefined, traceIds?: string[], name?: string, codeChangeDescription?: string | null, codeChangeFiles?: CodeChangeFile[] | null, includeDbBranchLease?: boolean, experimentGroupId?: string,
|
|
559
|
+
startReplay(traceFunctionKey: string, limit: number | undefined, traceIds?: string[], name?: string, codeChangeDescription?: string | null, codeChangeFiles?: CodeChangeFile[] | null, includeDbBranchLease?: boolean, experimentGroupId?: string, datasetIds?: string[], graderIds?: string[], dbBranchSettings?: DbBranchSettings, attempts?: number, includeOriginalMetadata?: boolean, onlyWithAssertions?: boolean): Promise<StartReplayResponse>;
|
|
560
560
|
/**
|
|
561
561
|
* Fetch an external span by ID.
|
|
562
562
|
* Blocking GET request.
|
|
@@ -1259,6 +1259,8 @@ declare class DatasetsClient {
|
|
|
1259
1259
|
|
|
1260
1260
|
type LabelConfidence = "VeryLow" | "Low" | "Medium" | "High" | "VeryHigh";
|
|
1261
1261
|
type LabelAction = "set" | "archived" | "no-active-label" | "skipped";
|
|
1262
|
+
type LabelStatus = "labeled" | "skipped" | "unlabeled";
|
|
1263
|
+
type LabelSource = "human" | "agent";
|
|
1262
1264
|
type LabelTarget = ({
|
|
1263
1265
|
traceId: string;
|
|
1264
1266
|
originalTraceId?: never;
|
|
@@ -1285,11 +1287,72 @@ type LabelOutcome = {
|
|
|
1285
1287
|
traceId: string;
|
|
1286
1288
|
action: LabelAction;
|
|
1287
1289
|
};
|
|
1290
|
+
type HumanLabelUpdate = {
|
|
1291
|
+
traceId: string;
|
|
1292
|
+
assertionId?: string;
|
|
1293
|
+
label: boolean;
|
|
1294
|
+
annotation: string;
|
|
1295
|
+
confidence?: LabelConfidence;
|
|
1296
|
+
};
|
|
1297
|
+
type HumanLabelOutcome = {
|
|
1298
|
+
traceId: string;
|
|
1299
|
+
assertionId: string | null;
|
|
1300
|
+
label: boolean;
|
|
1301
|
+
action: "set";
|
|
1302
|
+
};
|
|
1303
|
+
type AssertionVerdict = {
|
|
1304
|
+
assertionId: string;
|
|
1305
|
+
assertion: string | null;
|
|
1306
|
+
labelStatus: LabelStatus;
|
|
1307
|
+
label: boolean | null;
|
|
1308
|
+
annotation: string | null;
|
|
1309
|
+
confidence: LabelConfidence | null;
|
|
1310
|
+
labelSource: LabelSource;
|
|
1311
|
+
approved: boolean;
|
|
1312
|
+
};
|
|
1313
|
+
type TraceLabels = {
|
|
1314
|
+
traceId: string;
|
|
1315
|
+
labelStatus: LabelStatus;
|
|
1316
|
+
label: boolean | null;
|
|
1317
|
+
annotation: string | null;
|
|
1318
|
+
approved: boolean;
|
|
1319
|
+
passed: number;
|
|
1320
|
+
failed: number;
|
|
1321
|
+
assertions: AssertionVerdict[];
|
|
1322
|
+
};
|
|
1288
1323
|
declare class LabelsClient {
|
|
1289
1324
|
private readonly httpClient;
|
|
1290
1325
|
constructor(httpClient: HttpClient);
|
|
1291
1326
|
save(update: LabelUpdate, testRunId?: string): Promise<LabelOutcome>;
|
|
1292
1327
|
saveAll(updates: LabelUpdate[], testRunId?: string): Promise<LabelOutcome[]>;
|
|
1328
|
+
saveHuman(update: HumanLabelUpdate): Promise<HumanLabelOutcome>;
|
|
1329
|
+
saveHumanAll(updates: HumanLabelUpdate[]): Promise<HumanLabelOutcome[]>;
|
|
1330
|
+
get(traceId: string): Promise<TraceLabels | null>;
|
|
1331
|
+
getAll(traceIds: string[]): Promise<TraceLabels[]>;
|
|
1332
|
+
}
|
|
1333
|
+
|
|
1334
|
+
type GraderLabelSource = "human" | "live_grader";
|
|
1335
|
+
type GraderLabel = {
|
|
1336
|
+
traceId: string;
|
|
1337
|
+
graderId: string;
|
|
1338
|
+
graderName: string | null;
|
|
1339
|
+
graderStatus: string;
|
|
1340
|
+
label: boolean | null;
|
|
1341
|
+
labelReason: string | null;
|
|
1342
|
+
failureDiagnostic: string | null;
|
|
1343
|
+
labelConfidence: LabelConfidence | null;
|
|
1344
|
+
source: GraderLabelSource;
|
|
1345
|
+
evaluatedAt: string | null;
|
|
1346
|
+
};
|
|
1347
|
+
type GetGraderLabelsParams = {
|
|
1348
|
+
traceIds?: string[];
|
|
1349
|
+
graderId?: string;
|
|
1350
|
+
limit?: number;
|
|
1351
|
+
};
|
|
1352
|
+
declare class GradersClient {
|
|
1353
|
+
private readonly httpClient;
|
|
1354
|
+
constructor(httpClient: HttpClient);
|
|
1355
|
+
getLabels(params: GetGraderLabelsParams): Promise<GraderLabel[]>;
|
|
1293
1356
|
}
|
|
1294
1357
|
|
|
1295
1358
|
/**
|
|
@@ -1582,12 +1645,15 @@ interface DbBranchOptions {
|
|
|
1582
1645
|
interface ReplayOptions {
|
|
1583
1646
|
/**
|
|
1584
1647
|
* Maximum number of traces to replay (1-5,000, default 5). Ignored when
|
|
1585
|
-
* `traceIds` is passed (with a warning), or when `datasetId`
|
|
1586
|
-
* because either source already determines how many traces replay.
|
|
1648
|
+
* `traceIds` is passed (with a warning), or when `datasetId` / `datasetIds`
|
|
1649
|
+
* is passed, because either source already determines how many traces replay.
|
|
1587
1650
|
*/
|
|
1588
1651
|
limit?: number;
|
|
1589
1652
|
attempts?: number;
|
|
1590
|
-
/**
|
|
1653
|
+
/**
|
|
1654
|
+
* Optional list of specific trace IDs to replay (max 100). Mutually exclusive
|
|
1655
|
+
* with `datasetId` and `datasetIds`.
|
|
1656
|
+
*/
|
|
1591
1657
|
traceIds?: string[];
|
|
1592
1658
|
/** Optional display name for the resulting experiment/test run. */
|
|
1593
1659
|
name?: string;
|
|
@@ -1644,13 +1710,14 @@ interface ReplayOptions {
|
|
|
1644
1710
|
/** Group ID to associate this replay with an experiment group for live streaming in Studio. */
|
|
1645
1711
|
experimentGroupId?: string;
|
|
1646
1712
|
/**
|
|
1647
|
-
* Dataset this replay runs against. Mutually exclusive with `traceIds
|
|
1648
|
-
* set, the resulting experiment is
|
|
1713
|
+
* Dataset this replay runs against. Mutually exclusive with `traceIds` and
|
|
1714
|
+
* with `datasetIds`. When set, the resulting experiment is
|
|
1649
1715
|
* durably attributed to the dataset (stored on the test run), so it appears
|
|
1650
1716
|
* under the dataset's experiments even if the trace lineage can't be
|
|
1651
1717
|
* reconstructed. Validated server-side against the org.
|
|
1652
1718
|
*/
|
|
1653
1719
|
datasetId?: string;
|
|
1720
|
+
datasetIds?: string[];
|
|
1654
1721
|
/**
|
|
1655
1722
|
* Graders to attach directly to this experiment (test run), independent of any
|
|
1656
1723
|
* graders already on the dataset. The resulting experiment is graded by the
|
|
@@ -1663,7 +1730,7 @@ interface ReplayOptions {
|
|
|
1663
1730
|
/**
|
|
1664
1731
|
* Replay only the selected traces that carry at least one assertion.
|
|
1665
1732
|
*
|
|
1666
|
-
* Narrows whatever `limit`, `traceIds` or `
|
|
1733
|
+
* Narrows whatever `limit`, `traceIds` or `datasetIds` selected, so a run that
|
|
1667
1734
|
* measures assertion outcomes does not pay to re-execute traces nothing can
|
|
1668
1735
|
* grade. The server applies it as part of selection, which is what makes it
|
|
1669
1736
|
* compose with `limit`: `{ limit: 10, onlyWithAssertions: true }` is the ten
|
|
@@ -2566,6 +2633,7 @@ declare class Bitfab {
|
|
|
2566
2633
|
readonly datasets: DatasetsClient;
|
|
2567
2634
|
readonly traces: TracesClient;
|
|
2568
2635
|
readonly labels: LabelsClient;
|
|
2636
|
+
readonly graders: GradersClient;
|
|
2569
2637
|
private readonly bamlClient;
|
|
2570
2638
|
private readonly dbSnapshot;
|
|
2571
2639
|
private readonly autoTracePolicyRefreshes;
|
|
@@ -3211,7 +3279,7 @@ declare class BitfabFunction {
|
|
|
3211
3279
|
/**
|
|
3212
3280
|
* SDK version from package.json (injected at build time)
|
|
3213
3281
|
*/
|
|
3214
|
-
declare const __version__ = "0.
|
|
3282
|
+
declare const __version__ = "0.51.0";
|
|
3215
3283
|
|
|
3216
3284
|
/**
|
|
3217
3285
|
* Constants for the Bitfab SDK.
|
|
@@ -3341,4 +3409,4 @@ declare function seedFromRegistry(registry: ReplayRegistry, pipeline: string, ca
|
|
|
3341
3409
|
run?: boolean;
|
|
3342
3410
|
}): Promise<SeedResult>;
|
|
3343
3411
|
|
|
3344
|
-
export { type ActiveSpanContext, type AdaptContext, type AdaptInputsFn, type AddDatasetGradersResult, type AddDatasetTracesResult, type AllowedEnvVars, type ArchiveAssertionsParams, BITFAB_PROGRESS_PREFIX, type BamlExecutionResult, Bitfab, BitfabClaudeAgentHandler, type BitfabConfig, BitfabError, BitfabFunction, BitfabLangGraphCallbackHandler as BitfabLangChainCallbackHandler, BitfabLangGraphCallbackHandler, BitfabLangGraphIntegration, type BitfabLanguageModelMiddleware, BitfabOpenAIAgentHandler, BitfabOpenAITracingProcessor, BitfabVercelAiHandler, type CaptureSurface, type CaptureWhen, type CapturedSpan, type CodeChangeFile, type CurrentSpan, type CurrentTrace, DEFAULT_SERVICE_URL, type Dataset, type DatasetGraderRef, type DatasetTraceIds, DatasetsClient, type DbBranchOptions, DbBranchReplayError, type DbBranchTimings, type DbSnapshotConfig, type DbSnapshotProvider, type DbSnapshotRef, type DetachedTrace, type GraderRerun, type GraderRerunProgress, type GraderRerunResult, type GraderRerunStatus, HttpClient, type LabelAction, type LabelConfidence, type LabelOutcome, type LabelUpdate, LabelsClient, type LangGraphIntegrationOptions, type ListDatasetsParams, MixedTracingError, type MockOverride, type MockOverrideCtx, type MockOverrideInput, type MockOverrideResolver, type MockStrategy, type MockValue, NO_MOCK_OVERRIDE, type NodeMatcher, type NodeMethodDecorator, type NodeOptions, type ProviderDefinition, type RemoveDatasetGradersResult, type RemoveDatasetTracesResult, ReplayBranch, ReplayError, type ReplayItem, type ReplayItemFinishProgress, type ReplayItemStartProgress, type ReplayOptions, type ReplayOptionsFactory, type ReplayProgress, type ReplayProgressItem, type ReplayRegistration, type ReplayRegistry, type ReplayRegistryContext, type ReplayRegistryOptions, type ReplayResult, type RerunGradersOptions, type RerunGradersResult, SUPPORTED_PROVIDERS, type SaveAssertion, type SaveAssertionsParams, type SaveDatasetParams, type SaveDatasetResult, type SeedCase, type SeedCaseOptions, type SeedResult, type SeedRunOptions, type SpanLookup, type SpanMethodDecorator, type SpanMethodDecoratorContext, type SpanNodeMeta, type SpanOccurrence, type SpanOptions, type SpanType, type TokenUsage, type TraceAssertion, type TraceAssertionSource, type TraceAssertionsResult, type TraceIngestionType, type TraceOutline, type TraceOutlineSpan, type TraceOutlineSpanError, type TraceResponse, type TraceTarget, type TraceTargetOccurrence, TracesClient, type TracingProcessor, type VercelCallParams, type VercelGenerateResult, type VercelStreamResult, type WrapBAMLOptions, type WrappedBamlFn, __version__, defineReplayRegistry, finalizers, flushTraces, getCurrentReplayBranch, getCurrentSpan, getCurrentTrace, reportReplayProgress, seedFromRegistry, serializeReplayResult };
|
|
3412
|
+
export { type ActiveSpanContext, type AdaptContext, type AdaptInputsFn, type AddDatasetGradersResult, type AddDatasetTracesResult, type AllowedEnvVars, type ArchiveAssertionsParams, type AssertionVerdict, BITFAB_PROGRESS_PREFIX, type BamlExecutionResult, Bitfab, BitfabClaudeAgentHandler, type BitfabConfig, BitfabError, BitfabFunction, BitfabLangGraphCallbackHandler as BitfabLangChainCallbackHandler, BitfabLangGraphCallbackHandler, BitfabLangGraphIntegration, type BitfabLanguageModelMiddleware, BitfabOpenAIAgentHandler, BitfabOpenAITracingProcessor, BitfabVercelAiHandler, type CaptureSurface, type CaptureWhen, type CapturedSpan, type CodeChangeFile, type CurrentSpan, type CurrentTrace, DEFAULT_SERVICE_URL, type Dataset, type DatasetGraderRef, type DatasetTraceIds, DatasetsClient, type DbBranchOptions, DbBranchReplayError, type DbBranchTimings, type DbSnapshotConfig, type DbSnapshotProvider, type DbSnapshotRef, type DetachedTrace, type GetGraderLabelsParams, type GraderLabel, type GraderLabelSource, type GraderRerun, type GraderRerunProgress, type GraderRerunResult, type GraderRerunStatus, GradersClient, HttpClient, type HumanLabelOutcome, type HumanLabelUpdate, type LabelAction, type LabelConfidence, type LabelOutcome, type LabelSource, type LabelStatus, type LabelUpdate, LabelsClient, type LangGraphIntegrationOptions, type ListDatasetsParams, MixedTracingError, type MockOverride, type MockOverrideCtx, type MockOverrideInput, type MockOverrideResolver, type MockStrategy, type MockValue, NO_MOCK_OVERRIDE, type NodeMatcher, type NodeMethodDecorator, type NodeOptions, type ProviderDefinition, type RemoveDatasetGradersResult, type RemoveDatasetTracesResult, ReplayBranch, ReplayError, type ReplayItem, type ReplayItemFinishProgress, type ReplayItemStartProgress, type ReplayOptions, type ReplayOptionsFactory, type ReplayProgress, type ReplayProgressItem, type ReplayRegistration, type ReplayRegistry, type ReplayRegistryContext, type ReplayRegistryOptions, type ReplayResult, type RerunGradersOptions, type RerunGradersResult, SUPPORTED_PROVIDERS, type SaveAssertion, type SaveAssertionsParams, type SaveDatasetParams, type SaveDatasetResult, type SeedCase, type SeedCaseOptions, type SeedResult, type SeedRunOptions, type SpanLookup, type SpanMethodDecorator, type SpanMethodDecoratorContext, type SpanNodeMeta, type SpanOccurrence, type SpanOptions, type SpanType, type TokenUsage, type TraceAssertion, type TraceAssertionSource, type TraceAssertionsResult, type TraceIngestionType, type TraceLabels, type TraceOutline, type TraceOutlineSpan, type TraceOutlineSpanError, type TraceResponse, type TraceTarget, type TraceTargetOccurrence, TracesClient, type TracingProcessor, type VercelCallParams, type VercelGenerateResult, type VercelStreamResult, type WrapBAMLOptions, type WrappedBamlFn, __version__, defineReplayRegistry, finalizers, flushTraces, getCurrentReplayBranch, getCurrentSpan, getCurrentTrace, reportReplayProgress, seedFromRegistry, serializeReplayResult };
|
package/dist/index.js
CHANGED
|
@@ -17,6 +17,7 @@ import {
|
|
|
17
17
|
BitfabOpenAITracingProcessor,
|
|
18
18
|
BitfabVercelAiHandler,
|
|
19
19
|
DatasetsClient,
|
|
20
|
+
GradersClient,
|
|
20
21
|
LabelsClient,
|
|
21
22
|
SUPPORTED_PROVIDERS,
|
|
22
23
|
TracesClient,
|
|
@@ -26,7 +27,7 @@ import {
|
|
|
26
27
|
getCurrentSpan,
|
|
27
28
|
getCurrentTrace,
|
|
28
29
|
seedFromRegistry
|
|
29
|
-
} from "./chunk-
|
|
30
|
+
} from "./chunk-2RAX75MI.js";
|
|
30
31
|
import "./chunk-ZUD7OFYB.js";
|
|
31
32
|
import {
|
|
32
33
|
BITFAB_PROGRESS_PREFIX,
|
|
@@ -35,7 +36,7 @@ import {
|
|
|
35
36
|
ReplayError,
|
|
36
37
|
reportReplayProgress,
|
|
37
38
|
serializeReplayResult
|
|
38
|
-
} from "./chunk-
|
|
39
|
+
} from "./chunk-TCOMLVHK.js";
|
|
39
40
|
import {
|
|
40
41
|
BitfabError,
|
|
41
42
|
DEFAULT_SERVICE_URL,
|
|
@@ -43,7 +44,7 @@ import {
|
|
|
43
44
|
MixedTracingError,
|
|
44
45
|
__version__,
|
|
45
46
|
flushTraces
|
|
46
|
-
} from "./chunk-
|
|
47
|
+
} from "./chunk-4Z5FCOMO.js";
|
|
47
48
|
import "./chunk-H6LZRFMN.js";
|
|
48
49
|
export {
|
|
49
50
|
BITFAB_PROGRESS_PREFIX,
|
|
@@ -60,6 +61,7 @@ export {
|
|
|
60
61
|
DEFAULT_SERVICE_URL,
|
|
61
62
|
DatasetsClient,
|
|
62
63
|
DbBranchReplayError,
|
|
64
|
+
GradersClient,
|
|
63
65
|
HttpClient,
|
|
64
66
|
LabelsClient,
|
|
65
67
|
MixedTracingError,
|
package/dist/node.cjs
CHANGED
|
@@ -97,7 +97,7 @@ var __version__, __packageName__;
|
|
|
97
97
|
var init_version_generated = __esm({
|
|
98
98
|
"src/version.generated.ts"() {
|
|
99
99
|
"use strict";
|
|
100
|
-
__version__ = "0.
|
|
100
|
+
__version__ = "0.51.0";
|
|
101
101
|
__packageName__ = "bitfab";
|
|
102
102
|
}
|
|
103
103
|
});
|
|
@@ -1863,7 +1863,7 @@ var init_http = __esm({
|
|
|
1863
1863
|
* Start a replay session by fetching historical traces.
|
|
1864
1864
|
* Blocking call - creates a test run and returns lightweight item references.
|
|
1865
1865
|
*/
|
|
1866
|
-
async startReplay(traceFunctionKey, limit, traceIds, name, codeChangeDescription, codeChangeFiles, includeDbBranchLease, experimentGroupId,
|
|
1866
|
+
async startReplay(traceFunctionKey, limit, traceIds, name, codeChangeDescription, codeChangeFiles, includeDbBranchLease, experimentGroupId, datasetIds, graderIds, dbBranchSettings, attempts, includeOriginalMetadata, onlyWithAssertions) {
|
|
1867
1867
|
const payload = { traceFunctionKey };
|
|
1868
1868
|
if (limit !== void 0) {
|
|
1869
1869
|
payload.limit = limit;
|
|
@@ -1887,8 +1887,12 @@ var init_http = __esm({
|
|
|
1887
1887
|
if (experimentGroupId !== void 0) {
|
|
1888
1888
|
payload.experimentGroupId = experimentGroupId;
|
|
1889
1889
|
}
|
|
1890
|
-
if (
|
|
1891
|
-
|
|
1890
|
+
if (datasetIds !== void 0) {
|
|
1891
|
+
if (datasetIds.length === 1) {
|
|
1892
|
+
payload.datasetId = datasetIds[0];
|
|
1893
|
+
} else {
|
|
1894
|
+
payload.datasetIds = datasetIds;
|
|
1895
|
+
}
|
|
1892
1896
|
}
|
|
1893
1897
|
if (graderIds !== void 0) {
|
|
1894
1898
|
payload.graderIds = graderIds;
|
|
@@ -2490,6 +2494,23 @@ function resolveAttempts(attempts) {
|
|
|
2490
2494
|
}
|
|
2491
2495
|
return attempts;
|
|
2492
2496
|
}
|
|
2497
|
+
function resolveDatasetIds(options) {
|
|
2498
|
+
if (options?.datasetId !== void 0 && options?.datasetIds !== void 0) {
|
|
2499
|
+
throw new BitfabError(
|
|
2500
|
+
"datasetId and datasetIds are the same selector: pass one dataset through datasetId, or several through datasetIds."
|
|
2501
|
+
);
|
|
2502
|
+
}
|
|
2503
|
+
if (options?.datasetId !== void 0) {
|
|
2504
|
+
return [options.datasetId];
|
|
2505
|
+
}
|
|
2506
|
+
if (options?.datasetIds === void 0) {
|
|
2507
|
+
return void 0;
|
|
2508
|
+
}
|
|
2509
|
+
if (options.datasetIds.length === 0) {
|
|
2510
|
+
throw new BitfabError("datasetIds must contain at least one dataset ID.");
|
|
2511
|
+
}
|
|
2512
|
+
return [...new Set(options.datasetIds)];
|
|
2513
|
+
}
|
|
2493
2514
|
function dbBranchEnabled(dbBranch) {
|
|
2494
2515
|
return dbBranch !== void 0 && dbBranch !== false;
|
|
2495
2516
|
}
|
|
@@ -2922,9 +2943,10 @@ async function replay(httpClient, serviceUrl, traceFunctionKey, fn, options, reg
|
|
|
2922
2943
|
);
|
|
2923
2944
|
}
|
|
2924
2945
|
}
|
|
2925
|
-
|
|
2946
|
+
const datasetIds = resolveDatasetIds(options);
|
|
2947
|
+
if (options?.traceIds !== void 0 && datasetIds !== void 0) {
|
|
2926
2948
|
throw new BitfabError(
|
|
2927
|
-
"traceIds and
|
|
2949
|
+
"traceIds and datasetIds select different replay sources and cannot be used together."
|
|
2928
2950
|
);
|
|
2929
2951
|
}
|
|
2930
2952
|
if (options?.limit !== void 0 && options?.traceIds !== void 0) {
|
|
@@ -2966,7 +2988,7 @@ async function replay(httpClient, serviceUrl, traceFunctionKey, fn, options, reg
|
|
|
2966
2988
|
// before it could report its resolved inputs.
|
|
2967
2989
|
dbBranchEnabled(options?.dbBranch) && options?.dryRun !== true,
|
|
2968
2990
|
options?.experimentGroupId,
|
|
2969
|
-
|
|
2991
|
+
datasetIds,
|
|
2970
2992
|
options?.graderIds,
|
|
2971
2993
|
resolveDbBranchSettings(options?.dbBranch),
|
|
2972
2994
|
attempts,
|
|
@@ -3288,6 +3310,7 @@ __export(node_exports, {
|
|
|
3288
3310
|
DEFAULT_SERVICE_URL: () => DEFAULT_SERVICE_URL,
|
|
3289
3311
|
DatasetsClient: () => DatasetsClient,
|
|
3290
3312
|
DbBranchReplayError: () => DbBranchReplayError,
|
|
3313
|
+
GradersClient: () => GradersClient,
|
|
3291
3314
|
HttpClient: () => HttpClient,
|
|
3292
3315
|
LabelsClient: () => LabelsClient,
|
|
3293
3316
|
MixedTracingError: () => MixedTracingError,
|
|
@@ -4590,10 +4613,45 @@ function buildSnapshotRef(config, sdkWallClockBeforeFn) {
|
|
|
4590
4613
|
|
|
4591
4614
|
// src/client.ts
|
|
4592
4615
|
init_errors();
|
|
4616
|
+
|
|
4617
|
+
// src/graders.ts
|
|
4618
|
+
init_errors();
|
|
4619
|
+
var GRADER_LABELS_PATH = "/api/sdk/graderLabels";
|
|
4620
|
+
var GradersClient = class {
|
|
4621
|
+
constructor(httpClient) {
|
|
4622
|
+
this.httpClient = httpClient;
|
|
4623
|
+
}
|
|
4624
|
+
async getLabels(params) {
|
|
4625
|
+
const hasTraceIds = params.traceIds !== void 0 && params.traceIds.length > 0;
|
|
4626
|
+
const hasGraderId = params.graderId !== void 0;
|
|
4627
|
+
if (!hasTraceIds && !hasGraderId) {
|
|
4628
|
+
throw new BitfabError(
|
|
4629
|
+
"Pass traceIds, graderId, or both: there is nothing to read otherwise."
|
|
4630
|
+
);
|
|
4631
|
+
}
|
|
4632
|
+
const query = new URLSearchParams();
|
|
4633
|
+
if (params.traceIds !== void 0 && params.traceIds.length > 0) {
|
|
4634
|
+
query.set("traceIds", params.traceIds.join(","));
|
|
4635
|
+
}
|
|
4636
|
+
if (params.graderId !== void 0) {
|
|
4637
|
+
query.set("graderId", params.graderId);
|
|
4638
|
+
}
|
|
4639
|
+
if (params.limit !== void 0) {
|
|
4640
|
+
query.set("limit", String(params.limit));
|
|
4641
|
+
}
|
|
4642
|
+
const response = await this.httpClient.get(
|
|
4643
|
+
`${GRADER_LABELS_PATH}?${query.toString()}`
|
|
4644
|
+
);
|
|
4645
|
+
return response.labels;
|
|
4646
|
+
}
|
|
4647
|
+
};
|
|
4648
|
+
|
|
4649
|
+
// src/client.ts
|
|
4593
4650
|
init_http();
|
|
4594
4651
|
|
|
4595
4652
|
// src/labels.ts
|
|
4596
4653
|
var LABELS_PATH = "/api/sdk/traces/labels";
|
|
4654
|
+
var HUMAN_LABELS_PATH = "/api/sdk/traces/labels/human";
|
|
4597
4655
|
var LabelsClient = class {
|
|
4598
4656
|
constructor(httpClient) {
|
|
4599
4657
|
this.httpClient = httpClient;
|
|
@@ -4612,6 +4670,28 @@ var LabelsClient = class {
|
|
|
4612
4670
|
);
|
|
4613
4671
|
return response.labels;
|
|
4614
4672
|
}
|
|
4673
|
+
async saveHuman(update) {
|
|
4674
|
+
const [outcome] = await this.saveHumanAll([update]);
|
|
4675
|
+
return outcome;
|
|
4676
|
+
}
|
|
4677
|
+
async saveHumanAll(updates) {
|
|
4678
|
+
const response = await this.httpClient.request(HUMAN_LABELS_PATH, { labels: updates });
|
|
4679
|
+
return response.labels;
|
|
4680
|
+
}
|
|
4681
|
+
async get(traceId) {
|
|
4682
|
+
const [labels] = await this.getAll([traceId]);
|
|
4683
|
+
return labels ?? null;
|
|
4684
|
+
}
|
|
4685
|
+
async getAll(traceIds) {
|
|
4686
|
+
if (traceIds.length === 0) {
|
|
4687
|
+
return [];
|
|
4688
|
+
}
|
|
4689
|
+
const query = new URLSearchParams({ traceIds: traceIds.join(",") });
|
|
4690
|
+
const response = await this.httpClient.get(
|
|
4691
|
+
`${LABELS_PATH}?${query.toString()}`
|
|
4692
|
+
);
|
|
4693
|
+
return response.labels;
|
|
4694
|
+
}
|
|
4615
4695
|
};
|
|
4616
4696
|
|
|
4617
4697
|
// src/langgraph.ts
|
|
@@ -6389,6 +6469,7 @@ var Bitfab = class {
|
|
|
6389
6469
|
this.datasets = new DatasetsClient(this.httpClient);
|
|
6390
6470
|
this.traces = new TracesClient(this.httpClient);
|
|
6391
6471
|
this.labels = new LabelsClient(this.httpClient);
|
|
6472
|
+
this.graders = new GradersClient(this.httpClient);
|
|
6392
6473
|
}
|
|
6393
6474
|
/**
|
|
6394
6475
|
* Decorate a class method as an automatically expanded trace root.
|
|
@@ -8293,6 +8374,7 @@ assertAsyncStorageRegistered();
|
|
|
8293
8374
|
DEFAULT_SERVICE_URL,
|
|
8294
8375
|
DatasetsClient,
|
|
8295
8376
|
DbBranchReplayError,
|
|
8377
|
+
GradersClient,
|
|
8296
8378
|
HttpClient,
|
|
8297
8379
|
LabelsClient,
|
|
8298
8380
|
MixedTracingError,
|