@bitfab/sdk 0.58.5 → 0.59.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-YGZA3H67.js → chunk-4BNE5ETI.js} +2 -2
- package/dist/{chunk-E25HU4YZ.js → chunk-6IM35I7O.js} +2 -2
- package/dist/{chunk-E25HU4YZ.js.map → chunk-6IM35I7O.js.map} +1 -1
- package/dist/{chunk-IP2AYKT7.js → chunk-FBMHGUIK.js} +2 -2
- package/dist/{chunk-IP2AYKT7.js.map → chunk-FBMHGUIK.js.map} +1 -1
- package/dist/{chunk-NNSJVCR3.js → chunk-IW23QVY3.js} +3 -3
- package/dist/{chunk-Y47DQCCK.js → chunk-KGIKT4UT.js} +118 -21
- package/dist/chunk-KGIKT4UT.js.map +1 -0
- package/dist/{http-6K4GQC4S.js → http-FXLIHCQK.js} +2 -2
- package/dist/{http-PVE62D6W.js → http-HJJR2ZCE.js} +2 -2
- package/dist/index.cjs +117 -16
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +32 -10
- package/dist/index.d.ts +32 -10
- package/dist/index.js +11 -3
- package/dist/node.cjs +117 -16
- 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 +11 -3
- package/dist/node.js.map +1 -1
- package/dist/{replay-6WA5GD4R.js → replay-WBWGCZF7.js} +3 -3
- package/dist/replayCli.js +2 -2
- package/dist/seedCli.js +2 -2
- package/package.json +1 -1
- package/dist/chunk-Y47DQCCK.js.map +0 -1
- /package/dist/{chunk-YGZA3H67.js.map → chunk-4BNE5ETI.js.map} +0 -0
- /package/dist/{chunk-NNSJVCR3.js.map → chunk-IW23QVY3.js.map} +0 -0
- /package/dist/{http-6K4GQC4S.js.map → http-FXLIHCQK.js.map} +0 -0
- /package/dist/{http-PVE62D6W.js.map → http-HJJR2ZCE.js.map} +0 -0
- /package/dist/{replay-6WA5GD4R.js.map → replay-WBWGCZF7.js.map} +0 -0
package/dist/index.d.cts
CHANGED
|
@@ -1244,14 +1244,19 @@ interface GraderRerun {
|
|
|
1244
1244
|
}
|
|
1245
1245
|
interface RerunGradersOptions {
|
|
1246
1246
|
graderIds?: string[];
|
|
1247
|
-
wait?: boolean;
|
|
1248
1247
|
timeoutMs?: number;
|
|
1249
|
-
pollIntervalMs?: number;
|
|
1250
1248
|
}
|
|
1251
1249
|
interface RerunGradersResult {
|
|
1252
1250
|
run: GraderRerun;
|
|
1253
1251
|
joinedExisting: boolean;
|
|
1254
1252
|
}
|
|
1253
|
+
declare class GraderRerunError extends Error {
|
|
1254
|
+
readonly run: GraderRerun;
|
|
1255
|
+
constructor(message: string, run: GraderRerun);
|
|
1256
|
+
}
|
|
1257
|
+
declare class GraderRerunTimeoutError extends GraderRerunError {
|
|
1258
|
+
constructor(datasetId: string, run: GraderRerun, timeoutMs: number);
|
|
1259
|
+
}
|
|
1255
1260
|
/**
|
|
1256
1261
|
* Dataset operations for the authenticated organization, reached as
|
|
1257
1262
|
* `client.datasets`. A dataset is a named bucket of traces scoped to one trace
|
|
@@ -1291,12 +1296,6 @@ declare class DatasetsClient {
|
|
|
1291
1296
|
addGraders(datasetId: string, graderIds: string[]): Promise<AddDatasetGradersResult>;
|
|
1292
1297
|
/** Unassign graders from the dataset. */
|
|
1293
1298
|
removeGraders(datasetId: string, graderIds: string[]): Promise<RemoveDatasetGradersResult>;
|
|
1294
|
-
/**
|
|
1295
|
-
* Re-run graders over every trace in the dataset. Defaults to every assigned
|
|
1296
|
-
* grader; an unassigned id is rejected. Waits for the run to finish (up to
|
|
1297
|
-
* `timeoutMs`, default 90s) unless `wait` is `false`, and returns the last
|
|
1298
|
-
* run state seen either way. A request matching an in-flight run joins it.
|
|
1299
|
-
*/
|
|
1300
1299
|
rerunGraders(datasetId: string, options?: RerunGradersOptions): Promise<RerunGradersResult>;
|
|
1301
1300
|
/**
|
|
1302
1301
|
* The dataset's active grader re-run, or the run named by `runId`. Returns
|
|
@@ -1400,9 +1399,18 @@ type SaveAssertion = {
|
|
|
1400
1399
|
*/
|
|
1401
1400
|
assigneeEmail?: string | null;
|
|
1402
1401
|
};
|
|
1402
|
+
type AssertionGenerationStatus = "running" | "completed" | "failed";
|
|
1403
|
+
type AssertionGeneration = {
|
|
1404
|
+
status: AssertionGenerationStatus;
|
|
1405
|
+
error: string | null;
|
|
1406
|
+
assertionIds: string[];
|
|
1407
|
+
startedAt: string;
|
|
1408
|
+
finishedAt: string | null;
|
|
1409
|
+
};
|
|
1403
1410
|
type TraceAssertionsResult = {
|
|
1404
1411
|
assertions: TraceAssertion[];
|
|
1405
1412
|
inheritedFrom: string | null;
|
|
1413
|
+
generation: AssertionGeneration | null;
|
|
1406
1414
|
};
|
|
1407
1415
|
type TraceAssertionsUpdate = {
|
|
1408
1416
|
traceId: string;
|
|
@@ -1421,6 +1429,19 @@ type ArchiveAssertionsParams = {
|
|
|
1421
1429
|
traceId: string;
|
|
1422
1430
|
assertionIds: string[];
|
|
1423
1431
|
};
|
|
1432
|
+
type GenerateAssertionsOptions = {
|
|
1433
|
+
guidance?: string;
|
|
1434
|
+
categoryIds?: string[];
|
|
1435
|
+
regenerate?: boolean;
|
|
1436
|
+
timeoutMs?: number;
|
|
1437
|
+
};
|
|
1438
|
+
declare class AssertionGenerationError extends Error {
|
|
1439
|
+
readonly traceId: string;
|
|
1440
|
+
constructor(message: string, traceId: string);
|
|
1441
|
+
}
|
|
1442
|
+
declare class AssertionGenerationTimeoutError extends AssertionGenerationError {
|
|
1443
|
+
constructor(traceId: string, timeoutMs: number);
|
|
1444
|
+
}
|
|
1424
1445
|
declare class TracesClient {
|
|
1425
1446
|
private readonly httpClient;
|
|
1426
1447
|
constructor(httpClient: HttpClient);
|
|
@@ -1428,6 +1449,7 @@ declare class TracesClient {
|
|
|
1428
1449
|
getAssertions(traceId: string): Promise<TraceAssertionsResult>;
|
|
1429
1450
|
saveAssertions(params: SaveAssertionsParams): Promise<TraceAssertion[]>;
|
|
1430
1451
|
saveAssertionsAll(params: SaveAssertionsAllParams): Promise<TraceAssertion[]>;
|
|
1452
|
+
generateAssertions(traceId: string, options?: GenerateAssertionsOptions): Promise<TraceAssertion[]>;
|
|
1431
1453
|
archiveAssertions(params: ArchiveAssertionsParams): Promise<string[]>;
|
|
1432
1454
|
}
|
|
1433
1455
|
|
|
@@ -3659,7 +3681,7 @@ interface CommitRef {
|
|
|
3659
3681
|
/**
|
|
3660
3682
|
* SDK version from package.json (injected at build time)
|
|
3661
3683
|
*/
|
|
3662
|
-
declare const __version__ = "0.
|
|
3684
|
+
declare const __version__ = "0.59.0";
|
|
3663
3685
|
|
|
3664
3686
|
/**
|
|
3665
3687
|
* Constants for the Bitfab SDK.
|
|
@@ -3798,4 +3820,4 @@ declare function seedFromRegistry(registry: ReplayRegistry, pipeline: string, ca
|
|
|
3798
3820
|
run?: boolean;
|
|
3799
3821
|
}): Promise<SeedResult>;
|
|
3800
3822
|
|
|
3801
|
-
export { type ActiveSpanContext, type AdaptContext, type AdaptInputsFn, type AddDatasetGradersResult, type AddDatasetTracesResult, type AllowedEnvVars, type ApprovalFields, type ApprovalState, type Approver, type ArchiveAssertionsParams, AssertionCategoriesClient, type AssertionCategory, type AssertionCategorySummary, type AssertionEvidenceParameter, type AssertionLabelEvidence, type AssertionVerdict, type Assignee, BITFAB_PROGRESS_PREFIX, type BamlExecutionResult, Bitfab, BitfabClaudeAgentHandler, type BitfabConfig, BitfabError, BitfabFunction, BitfabLangGraphCallbackHandler as BitfabLangChainCallbackHandler, BitfabLangGraphCallbackHandler, BitfabLangGraphIntegration, type BitfabLanguageModelMiddleware, BitfabOpenAIAgentHandler, BitfabOpenAITracingProcessor, BitfabRivetIntegration, BitfabVercelAiHandler, type CaptureSurface, type CaptureWhen, type CapturedSpan, type CodeChangeFile, type CommitRef, 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 Justification, type JustificationSpan, type LabelAction, type LabelConfidence, type LabelOutcome, type LabelSource, type LabelStatus, type LabelTarget, 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 OrganizationMember, OrganizationMembersClient, 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, type ReseedOptions, type ReseedRegistryResult, type ReseedResult, type RivetContextLike, type RivetEffectType, type RivetIntegrationOptions, SUPPORTED_PROVIDERS, type SaveAssertion, type SaveAssertionCategoryParams, type SaveAssertionsAllParams, 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 TraceAssertionsUpdate, type TraceIngestionType, type TraceLabels, type TraceOutline, type TraceOutlineSpan, type TraceOutlineSpanError, type TraceResponse, type TraceSearchFilters, type TraceSearchParams, type TraceSearchResult, 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, reseedFromRegistry, seedFromRegistry, serializeReplayResult };
|
|
3823
|
+
export { type ActiveSpanContext, type AdaptContext, type AdaptInputsFn, type AddDatasetGradersResult, type AddDatasetTracesResult, type AllowedEnvVars, type ApprovalFields, type ApprovalState, type Approver, type ArchiveAssertionsParams, AssertionCategoriesClient, type AssertionCategory, type AssertionCategorySummary, type AssertionEvidenceParameter, type AssertionGeneration, AssertionGenerationError, type AssertionGenerationStatus, AssertionGenerationTimeoutError, type AssertionLabelEvidence, type AssertionVerdict, type Assignee, BITFAB_PROGRESS_PREFIX, type BamlExecutionResult, Bitfab, BitfabClaudeAgentHandler, type BitfabConfig, BitfabError, BitfabFunction, BitfabLangGraphCallbackHandler as BitfabLangChainCallbackHandler, BitfabLangGraphCallbackHandler, BitfabLangGraphIntegration, type BitfabLanguageModelMiddleware, BitfabOpenAIAgentHandler, BitfabOpenAITracingProcessor, BitfabRivetIntegration, BitfabVercelAiHandler, type CaptureSurface, type CaptureWhen, type CapturedSpan, type CodeChangeFile, type CommitRef, 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 GenerateAssertionsOptions, type GetGraderLabelsParams, type GraderLabel, type GraderLabelSource, type GraderRerun, GraderRerunError, type GraderRerunProgress, type GraderRerunResult, type GraderRerunStatus, GraderRerunTimeoutError, GradersClient, HttpClient, type HumanLabelOutcome, type HumanLabelUpdate, type Justification, type JustificationSpan, type LabelAction, type LabelConfidence, type LabelOutcome, type LabelSource, type LabelStatus, type LabelTarget, 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 OrganizationMember, OrganizationMembersClient, 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, type ReseedOptions, type ReseedRegistryResult, type ReseedResult, type RivetContextLike, type RivetEffectType, type RivetIntegrationOptions, SUPPORTED_PROVIDERS, type SaveAssertion, type SaveAssertionCategoryParams, type SaveAssertionsAllParams, 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 TraceAssertionsUpdate, type TraceIngestionType, type TraceLabels, type TraceOutline, type TraceOutlineSpan, type TraceOutlineSpanError, type TraceResponse, type TraceSearchFilters, type TraceSearchParams, type TraceSearchResult, 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, reseedFromRegistry, seedFromRegistry, serializeReplayResult };
|
package/dist/index.d.ts
CHANGED
|
@@ -1244,14 +1244,19 @@ interface GraderRerun {
|
|
|
1244
1244
|
}
|
|
1245
1245
|
interface RerunGradersOptions {
|
|
1246
1246
|
graderIds?: string[];
|
|
1247
|
-
wait?: boolean;
|
|
1248
1247
|
timeoutMs?: number;
|
|
1249
|
-
pollIntervalMs?: number;
|
|
1250
1248
|
}
|
|
1251
1249
|
interface RerunGradersResult {
|
|
1252
1250
|
run: GraderRerun;
|
|
1253
1251
|
joinedExisting: boolean;
|
|
1254
1252
|
}
|
|
1253
|
+
declare class GraderRerunError extends Error {
|
|
1254
|
+
readonly run: GraderRerun;
|
|
1255
|
+
constructor(message: string, run: GraderRerun);
|
|
1256
|
+
}
|
|
1257
|
+
declare class GraderRerunTimeoutError extends GraderRerunError {
|
|
1258
|
+
constructor(datasetId: string, run: GraderRerun, timeoutMs: number);
|
|
1259
|
+
}
|
|
1255
1260
|
/**
|
|
1256
1261
|
* Dataset operations for the authenticated organization, reached as
|
|
1257
1262
|
* `client.datasets`. A dataset is a named bucket of traces scoped to one trace
|
|
@@ -1291,12 +1296,6 @@ declare class DatasetsClient {
|
|
|
1291
1296
|
addGraders(datasetId: string, graderIds: string[]): Promise<AddDatasetGradersResult>;
|
|
1292
1297
|
/** Unassign graders from the dataset. */
|
|
1293
1298
|
removeGraders(datasetId: string, graderIds: string[]): Promise<RemoveDatasetGradersResult>;
|
|
1294
|
-
/**
|
|
1295
|
-
* Re-run graders over every trace in the dataset. Defaults to every assigned
|
|
1296
|
-
* grader; an unassigned id is rejected. Waits for the run to finish (up to
|
|
1297
|
-
* `timeoutMs`, default 90s) unless `wait` is `false`, and returns the last
|
|
1298
|
-
* run state seen either way. A request matching an in-flight run joins it.
|
|
1299
|
-
*/
|
|
1300
1299
|
rerunGraders(datasetId: string, options?: RerunGradersOptions): Promise<RerunGradersResult>;
|
|
1301
1300
|
/**
|
|
1302
1301
|
* The dataset's active grader re-run, or the run named by `runId`. Returns
|
|
@@ -1400,9 +1399,18 @@ type SaveAssertion = {
|
|
|
1400
1399
|
*/
|
|
1401
1400
|
assigneeEmail?: string | null;
|
|
1402
1401
|
};
|
|
1402
|
+
type AssertionGenerationStatus = "running" | "completed" | "failed";
|
|
1403
|
+
type AssertionGeneration = {
|
|
1404
|
+
status: AssertionGenerationStatus;
|
|
1405
|
+
error: string | null;
|
|
1406
|
+
assertionIds: string[];
|
|
1407
|
+
startedAt: string;
|
|
1408
|
+
finishedAt: string | null;
|
|
1409
|
+
};
|
|
1403
1410
|
type TraceAssertionsResult = {
|
|
1404
1411
|
assertions: TraceAssertion[];
|
|
1405
1412
|
inheritedFrom: string | null;
|
|
1413
|
+
generation: AssertionGeneration | null;
|
|
1406
1414
|
};
|
|
1407
1415
|
type TraceAssertionsUpdate = {
|
|
1408
1416
|
traceId: string;
|
|
@@ -1421,6 +1429,19 @@ type ArchiveAssertionsParams = {
|
|
|
1421
1429
|
traceId: string;
|
|
1422
1430
|
assertionIds: string[];
|
|
1423
1431
|
};
|
|
1432
|
+
type GenerateAssertionsOptions = {
|
|
1433
|
+
guidance?: string;
|
|
1434
|
+
categoryIds?: string[];
|
|
1435
|
+
regenerate?: boolean;
|
|
1436
|
+
timeoutMs?: number;
|
|
1437
|
+
};
|
|
1438
|
+
declare class AssertionGenerationError extends Error {
|
|
1439
|
+
readonly traceId: string;
|
|
1440
|
+
constructor(message: string, traceId: string);
|
|
1441
|
+
}
|
|
1442
|
+
declare class AssertionGenerationTimeoutError extends AssertionGenerationError {
|
|
1443
|
+
constructor(traceId: string, timeoutMs: number);
|
|
1444
|
+
}
|
|
1424
1445
|
declare class TracesClient {
|
|
1425
1446
|
private readonly httpClient;
|
|
1426
1447
|
constructor(httpClient: HttpClient);
|
|
@@ -1428,6 +1449,7 @@ declare class TracesClient {
|
|
|
1428
1449
|
getAssertions(traceId: string): Promise<TraceAssertionsResult>;
|
|
1429
1450
|
saveAssertions(params: SaveAssertionsParams): Promise<TraceAssertion[]>;
|
|
1430
1451
|
saveAssertionsAll(params: SaveAssertionsAllParams): Promise<TraceAssertion[]>;
|
|
1452
|
+
generateAssertions(traceId: string, options?: GenerateAssertionsOptions): Promise<TraceAssertion[]>;
|
|
1431
1453
|
archiveAssertions(params: ArchiveAssertionsParams): Promise<string[]>;
|
|
1432
1454
|
}
|
|
1433
1455
|
|
|
@@ -3659,7 +3681,7 @@ interface CommitRef {
|
|
|
3659
3681
|
/**
|
|
3660
3682
|
* SDK version from package.json (injected at build time)
|
|
3661
3683
|
*/
|
|
3662
|
-
declare const __version__ = "0.
|
|
3684
|
+
declare const __version__ = "0.59.0";
|
|
3663
3685
|
|
|
3664
3686
|
/**
|
|
3665
3687
|
* Constants for the Bitfab SDK.
|
|
@@ -3798,4 +3820,4 @@ declare function seedFromRegistry(registry: ReplayRegistry, pipeline: string, ca
|
|
|
3798
3820
|
run?: boolean;
|
|
3799
3821
|
}): Promise<SeedResult>;
|
|
3800
3822
|
|
|
3801
|
-
export { type ActiveSpanContext, type AdaptContext, type AdaptInputsFn, type AddDatasetGradersResult, type AddDatasetTracesResult, type AllowedEnvVars, type ApprovalFields, type ApprovalState, type Approver, type ArchiveAssertionsParams, AssertionCategoriesClient, type AssertionCategory, type AssertionCategorySummary, type AssertionEvidenceParameter, type AssertionLabelEvidence, type AssertionVerdict, type Assignee, BITFAB_PROGRESS_PREFIX, type BamlExecutionResult, Bitfab, BitfabClaudeAgentHandler, type BitfabConfig, BitfabError, BitfabFunction, BitfabLangGraphCallbackHandler as BitfabLangChainCallbackHandler, BitfabLangGraphCallbackHandler, BitfabLangGraphIntegration, type BitfabLanguageModelMiddleware, BitfabOpenAIAgentHandler, BitfabOpenAITracingProcessor, BitfabRivetIntegration, BitfabVercelAiHandler, type CaptureSurface, type CaptureWhen, type CapturedSpan, type CodeChangeFile, type CommitRef, 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 Justification, type JustificationSpan, type LabelAction, type LabelConfidence, type LabelOutcome, type LabelSource, type LabelStatus, type LabelTarget, 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 OrganizationMember, OrganizationMembersClient, 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, type ReseedOptions, type ReseedRegistryResult, type ReseedResult, type RivetContextLike, type RivetEffectType, type RivetIntegrationOptions, SUPPORTED_PROVIDERS, type SaveAssertion, type SaveAssertionCategoryParams, type SaveAssertionsAllParams, 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 TraceAssertionsUpdate, type TraceIngestionType, type TraceLabels, type TraceOutline, type TraceOutlineSpan, type TraceOutlineSpanError, type TraceResponse, type TraceSearchFilters, type TraceSearchParams, type TraceSearchResult, 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, reseedFromRegistry, seedFromRegistry, serializeReplayResult };
|
|
3823
|
+
export { type ActiveSpanContext, type AdaptContext, type AdaptInputsFn, type AddDatasetGradersResult, type AddDatasetTracesResult, type AllowedEnvVars, type ApprovalFields, type ApprovalState, type Approver, type ArchiveAssertionsParams, AssertionCategoriesClient, type AssertionCategory, type AssertionCategorySummary, type AssertionEvidenceParameter, type AssertionGeneration, AssertionGenerationError, type AssertionGenerationStatus, AssertionGenerationTimeoutError, type AssertionLabelEvidence, type AssertionVerdict, type Assignee, BITFAB_PROGRESS_PREFIX, type BamlExecutionResult, Bitfab, BitfabClaudeAgentHandler, type BitfabConfig, BitfabError, BitfabFunction, BitfabLangGraphCallbackHandler as BitfabLangChainCallbackHandler, BitfabLangGraphCallbackHandler, BitfabLangGraphIntegration, type BitfabLanguageModelMiddleware, BitfabOpenAIAgentHandler, BitfabOpenAITracingProcessor, BitfabRivetIntegration, BitfabVercelAiHandler, type CaptureSurface, type CaptureWhen, type CapturedSpan, type CodeChangeFile, type CommitRef, 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 GenerateAssertionsOptions, type GetGraderLabelsParams, type GraderLabel, type GraderLabelSource, type GraderRerun, GraderRerunError, type GraderRerunProgress, type GraderRerunResult, type GraderRerunStatus, GraderRerunTimeoutError, GradersClient, HttpClient, type HumanLabelOutcome, type HumanLabelUpdate, type Justification, type JustificationSpan, type LabelAction, type LabelConfidence, type LabelOutcome, type LabelSource, type LabelStatus, type LabelTarget, 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 OrganizationMember, OrganizationMembersClient, 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, type ReseedOptions, type ReseedRegistryResult, type ReseedResult, type RivetContextLike, type RivetEffectType, type RivetIntegrationOptions, SUPPORTED_PROVIDERS, type SaveAssertion, type SaveAssertionCategoryParams, type SaveAssertionsAllParams, 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 TraceAssertionsUpdate, type TraceIngestionType, type TraceLabels, type TraceOutline, type TraceOutlineSpan, type TraceOutlineSpanError, type TraceResponse, type TraceSearchFilters, type TraceSearchParams, type TraceSearchResult, 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, reseedFromRegistry, seedFromRegistry, serializeReplayResult };
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
AssertionCategoriesClient,
|
|
3
|
+
AssertionGenerationError,
|
|
4
|
+
AssertionGenerationTimeoutError,
|
|
3
5
|
Bitfab,
|
|
4
6
|
BitfabClaudeAgentHandler,
|
|
5
7
|
BitfabFunction,
|
|
@@ -10,6 +12,8 @@ import {
|
|
|
10
12
|
BitfabRivetIntegration,
|
|
11
13
|
BitfabVercelAiHandler,
|
|
12
14
|
DatasetsClient,
|
|
15
|
+
GraderRerunError,
|
|
16
|
+
GraderRerunTimeoutError,
|
|
13
17
|
GradersClient,
|
|
14
18
|
LabelsClient,
|
|
15
19
|
OrganizationMembersClient,
|
|
@@ -22,7 +26,7 @@ import {
|
|
|
22
26
|
getCurrentTrace,
|
|
23
27
|
reseedFromRegistry,
|
|
24
28
|
seedFromRegistry
|
|
25
|
-
} from "./chunk-
|
|
29
|
+
} from "./chunk-KGIKT4UT.js";
|
|
26
30
|
import "./chunk-ETZUSSF6.js";
|
|
27
31
|
import {
|
|
28
32
|
BITFAB_PROGRESS_PREFIX,
|
|
@@ -31,7 +35,7 @@ import {
|
|
|
31
35
|
ReplayError,
|
|
32
36
|
reportReplayProgress,
|
|
33
37
|
serializeReplayResult
|
|
34
|
-
} from "./chunk-
|
|
38
|
+
} from "./chunk-4BNE5ETI.js";
|
|
35
39
|
import {
|
|
36
40
|
BitfabError,
|
|
37
41
|
DEFAULT_SERVICE_URL,
|
|
@@ -39,10 +43,12 @@ import {
|
|
|
39
43
|
MixedTracingError,
|
|
40
44
|
__version__,
|
|
41
45
|
flushTraces
|
|
42
|
-
} from "./chunk-
|
|
46
|
+
} from "./chunk-FBMHGUIK.js";
|
|
43
47
|
import "./chunk-BAOIRE5T.js";
|
|
44
48
|
export {
|
|
45
49
|
AssertionCategoriesClient,
|
|
50
|
+
AssertionGenerationError,
|
|
51
|
+
AssertionGenerationTimeoutError,
|
|
46
52
|
BITFAB_PROGRESS_PREFIX,
|
|
47
53
|
Bitfab,
|
|
48
54
|
BitfabClaudeAgentHandler,
|
|
@@ -58,6 +64,8 @@ export {
|
|
|
58
64
|
DEFAULT_SERVICE_URL,
|
|
59
65
|
DatasetsClient,
|
|
60
66
|
DbBranchReplayError,
|
|
67
|
+
GraderRerunError,
|
|
68
|
+
GraderRerunTimeoutError,
|
|
61
69
|
GradersClient,
|
|
62
70
|
HttpClient,
|
|
63
71
|
LabelsClient,
|
package/dist/node.cjs
CHANGED
|
@@ -88,7 +88,7 @@ var __version__, __packageName__;
|
|
|
88
88
|
var init_version_generated = __esm({
|
|
89
89
|
"src/version.generated.ts"() {
|
|
90
90
|
"use strict";
|
|
91
|
-
__version__ = "0.
|
|
91
|
+
__version__ = "0.59.0";
|
|
92
92
|
__packageName__ = "@bitfab/sdk";
|
|
93
93
|
}
|
|
94
94
|
});
|
|
@@ -4397,6 +4397,8 @@ var init_replay = __esm({
|
|
|
4397
4397
|
var node_exports = {};
|
|
4398
4398
|
__export(node_exports, {
|
|
4399
4399
|
AssertionCategoriesClient: () => AssertionCategoriesClient,
|
|
4400
|
+
AssertionGenerationError: () => AssertionGenerationError,
|
|
4401
|
+
AssertionGenerationTimeoutError: () => AssertionGenerationTimeoutError,
|
|
4400
4402
|
BITFAB_PROGRESS_PREFIX: () => BITFAB_PROGRESS_PREFIX,
|
|
4401
4403
|
Bitfab: () => Bitfab,
|
|
4402
4404
|
BitfabClaudeAgentHandler: () => BitfabClaudeAgentHandler,
|
|
@@ -4412,6 +4414,8 @@ __export(node_exports, {
|
|
|
4412
4414
|
DEFAULT_SERVICE_URL: () => DEFAULT_SERVICE_URL,
|
|
4413
4415
|
DatasetsClient: () => DatasetsClient,
|
|
4414
4416
|
DbBranchReplayError: () => DbBranchReplayError,
|
|
4417
|
+
GraderRerunError: () => GraderRerunError,
|
|
4418
|
+
GraderRerunTimeoutError: () => GraderRerunTimeoutError,
|
|
4415
4419
|
GradersClient: () => GradersClient,
|
|
4416
4420
|
HttpClient: () => HttpClient,
|
|
4417
4421
|
LabelsClient: () => LabelsClient,
|
|
@@ -5846,11 +5850,39 @@ init_constants();
|
|
|
5846
5850
|
|
|
5847
5851
|
// src/datasets.ts
|
|
5848
5852
|
var DEFAULT_RERUN_TIMEOUT_MS = 9e4;
|
|
5849
|
-
var
|
|
5853
|
+
var RERUN_POLL_INTERVAL_MS = 1e3;
|
|
5850
5854
|
var TERMINAL_RERUN_STATUSES = /* @__PURE__ */ new Set([
|
|
5851
5855
|
"completed",
|
|
5852
5856
|
"errored"
|
|
5853
5857
|
]);
|
|
5858
|
+
var GraderRerunError = class extends Error {
|
|
5859
|
+
constructor(message, run) {
|
|
5860
|
+
super(message);
|
|
5861
|
+
this.run = run;
|
|
5862
|
+
this.name = "GraderRerunError";
|
|
5863
|
+
}
|
|
5864
|
+
};
|
|
5865
|
+
var GraderRerunTimeoutError = class extends GraderRerunError {
|
|
5866
|
+
constructor(datasetId, run, timeoutMs) {
|
|
5867
|
+
super(
|
|
5868
|
+
`Grader re-run ${run.id} on dataset ${datasetId} was still ${run.status} after ${timeoutMs}ms. It keeps running on Bitfab; read it later with getGraderRerun.`,
|
|
5869
|
+
run
|
|
5870
|
+
);
|
|
5871
|
+
this.name = "GraderRerunTimeoutError";
|
|
5872
|
+
}
|
|
5873
|
+
};
|
|
5874
|
+
function finishedRerun(datasetId, run, joinedExisting) {
|
|
5875
|
+
if (!TERMINAL_RERUN_STATUSES.has(run.status)) {
|
|
5876
|
+
return null;
|
|
5877
|
+
}
|
|
5878
|
+
if (run.status === "errored") {
|
|
5879
|
+
throw new GraderRerunError(
|
|
5880
|
+
`Grader re-run ${run.id} on dataset ${datasetId} errored: ${run.error ?? "no reason recorded"}`,
|
|
5881
|
+
run
|
|
5882
|
+
);
|
|
5883
|
+
}
|
|
5884
|
+
return { run, joinedExisting };
|
|
5885
|
+
}
|
|
5854
5886
|
function sleep(ms) {
|
|
5855
5887
|
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
5856
5888
|
}
|
|
@@ -5950,28 +5982,25 @@ var DatasetsClient = class {
|
|
|
5950
5982
|
{ graderIds }
|
|
5951
5983
|
);
|
|
5952
5984
|
}
|
|
5953
|
-
/**
|
|
5954
|
-
* Re-run graders over every trace in the dataset. Defaults to every assigned
|
|
5955
|
-
* grader; an unassigned id is rejected. Waits for the run to finish (up to
|
|
5956
|
-
* `timeoutMs`, default 90s) unless `wait` is `false`, and returns the last
|
|
5957
|
-
* run state seen either way. A request matching an in-flight run joins it.
|
|
5958
|
-
*/
|
|
5959
5985
|
async rerunGraders(datasetId, options = {}) {
|
|
5960
5986
|
const started = await this.httpClient.request(
|
|
5961
5987
|
datasetPath(datasetId, "/rerunGraders"),
|
|
5962
5988
|
options.graderIds === void 0 ? {} : { graderIds: options.graderIds }
|
|
5963
5989
|
);
|
|
5964
|
-
|
|
5965
|
-
|
|
5966
|
-
}
|
|
5967
|
-
const deadline = Date.now() + (options.timeoutMs ?? DEFAULT_RERUN_TIMEOUT_MS);
|
|
5968
|
-
const interval = options.pollIntervalMs ?? DEFAULT_RERUN_POLL_INTERVAL_MS;
|
|
5990
|
+
const timeoutMs = options.timeoutMs ?? DEFAULT_RERUN_TIMEOUT_MS;
|
|
5991
|
+
const deadline = Date.now() + timeoutMs;
|
|
5969
5992
|
let run = started.run;
|
|
5970
|
-
while (
|
|
5971
|
-
|
|
5993
|
+
while (true) {
|
|
5994
|
+
const finished = finishedRerun(datasetId, run, started.joinedExisting);
|
|
5995
|
+
if (finished !== null) {
|
|
5996
|
+
return finished;
|
|
5997
|
+
}
|
|
5998
|
+
if (Date.now() >= deadline) {
|
|
5999
|
+
throw new GraderRerunTimeoutError(datasetId, run, timeoutMs);
|
|
6000
|
+
}
|
|
6001
|
+
await sleep(RERUN_POLL_INTERVAL_MS);
|
|
5972
6002
|
run = await this.getGraderRerun(datasetId, run.id) ?? run;
|
|
5973
6003
|
}
|
|
5974
|
-
return { run, joinedExisting: started.joinedExisting };
|
|
5975
6004
|
}
|
|
5976
6005
|
/**
|
|
5977
6006
|
* The dataset's active grader re-run, or the run named by `runId`. Returns
|
|
@@ -7827,6 +7856,46 @@ init_traceMetadata();
|
|
|
7827
7856
|
// src/traces.ts
|
|
7828
7857
|
var ASSERTIONS_PATH = "/api/sdk/traces/assertions";
|
|
7829
7858
|
var SEARCH_PATH = "/api/sdk/traces/search";
|
|
7859
|
+
var DEFAULT_GENERATION_TIMEOUT_MS = 6e5;
|
|
7860
|
+
var GENERATION_POLL_INTERVAL_MS = 2e3;
|
|
7861
|
+
var AssertionGenerationError = class extends Error {
|
|
7862
|
+
constructor(message, traceId) {
|
|
7863
|
+
super(message);
|
|
7864
|
+
this.traceId = traceId;
|
|
7865
|
+
this.name = "AssertionGenerationError";
|
|
7866
|
+
}
|
|
7867
|
+
};
|
|
7868
|
+
var AssertionGenerationTimeoutError = class extends AssertionGenerationError {
|
|
7869
|
+
constructor(traceId, timeoutMs) {
|
|
7870
|
+
super(
|
|
7871
|
+
`Assertion generation for trace ${traceId} did not finish within ${timeoutMs}ms. Generation keeps running on Bitfab. Call getAssertions and read its generation field to check its status.`,
|
|
7872
|
+
traceId
|
|
7873
|
+
);
|
|
7874
|
+
this.name = "AssertionGenerationTimeoutError";
|
|
7875
|
+
}
|
|
7876
|
+
};
|
|
7877
|
+
function sleep2(ms) {
|
|
7878
|
+
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
7879
|
+
}
|
|
7880
|
+
function isGenerationFinished(traceId, generation) {
|
|
7881
|
+
if (generation === null || generation.status === "running") {
|
|
7882
|
+
return false;
|
|
7883
|
+
}
|
|
7884
|
+
if (generation.status === "failed") {
|
|
7885
|
+
throw new AssertionGenerationError(
|
|
7886
|
+
`Assertion generation for trace ${traceId} failed: ${generation.error ?? "no reason recorded"}. Pass regenerate: true to try again.`,
|
|
7887
|
+
traceId
|
|
7888
|
+
);
|
|
7889
|
+
}
|
|
7890
|
+
return true;
|
|
7891
|
+
}
|
|
7892
|
+
function draftsInGenerationOrder(assertions, assertionIds) {
|
|
7893
|
+
const byId = new Map(assertions.map((assertion) => [assertion.id, assertion]));
|
|
7894
|
+
return assertionIds.flatMap((id) => {
|
|
7895
|
+
const assertion = byId.get(id);
|
|
7896
|
+
return assertion === void 0 ? [] : [assertion];
|
|
7897
|
+
});
|
|
7898
|
+
}
|
|
7830
7899
|
function traceAssertionsPath(traceId, suffix = "") {
|
|
7831
7900
|
return `/api/sdk/traces/${encodeURIComponent(traceId)}/assertions${suffix}`;
|
|
7832
7901
|
}
|
|
@@ -7858,6 +7927,34 @@ var TracesClient = class {
|
|
|
7858
7927
|
});
|
|
7859
7928
|
return response.assertions;
|
|
7860
7929
|
}
|
|
7930
|
+
async generateAssertions(traceId, options = {}) {
|
|
7931
|
+
const started = await this.httpClient.request(
|
|
7932
|
+
traceAssertionsPath(traceId, "/generate"),
|
|
7933
|
+
{
|
|
7934
|
+
...options.guidance === void 0 ? {} : { guidance: options.guidance },
|
|
7935
|
+
...options.categoryIds === void 0 ? {} : { categoryIds: options.categoryIds },
|
|
7936
|
+
...options.regenerate === void 0 ? {} : { regenerate: options.regenerate }
|
|
7937
|
+
}
|
|
7938
|
+
);
|
|
7939
|
+
if (isGenerationFinished(traceId, started.generation)) {
|
|
7940
|
+
return started.assertions;
|
|
7941
|
+
}
|
|
7942
|
+
const timeoutMs = options.timeoutMs ?? DEFAULT_GENERATION_TIMEOUT_MS;
|
|
7943
|
+
const deadline = Date.now() + timeoutMs;
|
|
7944
|
+
while (true) {
|
|
7945
|
+
if (Date.now() >= deadline) {
|
|
7946
|
+
throw new AssertionGenerationTimeoutError(traceId, timeoutMs);
|
|
7947
|
+
}
|
|
7948
|
+
await sleep2(GENERATION_POLL_INTERVAL_MS);
|
|
7949
|
+
const read2 = await this.getAssertions(traceId);
|
|
7950
|
+
if (isGenerationFinished(traceId, read2.generation)) {
|
|
7951
|
+
return draftsInGenerationOrder(
|
|
7952
|
+
read2.assertions,
|
|
7953
|
+
read2.generation.assertionIds
|
|
7954
|
+
);
|
|
7955
|
+
}
|
|
7956
|
+
}
|
|
7957
|
+
}
|
|
7861
7958
|
async archiveAssertions(params) {
|
|
7862
7959
|
const response = await this.httpClient.request(
|
|
7863
7960
|
traceAssertionsPath(params.traceId, "/archive"),
|
|
@@ -11080,6 +11177,8 @@ assertAsyncStorageRegistered();
|
|
|
11080
11177
|
// Annotate the CommonJS export names for ESM import in node:
|
|
11081
11178
|
0 && (module.exports = {
|
|
11082
11179
|
AssertionCategoriesClient,
|
|
11180
|
+
AssertionGenerationError,
|
|
11181
|
+
AssertionGenerationTimeoutError,
|
|
11083
11182
|
BITFAB_PROGRESS_PREFIX,
|
|
11084
11183
|
Bitfab,
|
|
11085
11184
|
BitfabClaudeAgentHandler,
|
|
@@ -11095,6 +11194,8 @@ assertAsyncStorageRegistered();
|
|
|
11095
11194
|
DEFAULT_SERVICE_URL,
|
|
11096
11195
|
DatasetsClient,
|
|
11097
11196
|
DbBranchReplayError,
|
|
11197
|
+
GraderRerunError,
|
|
11198
|
+
GraderRerunTimeoutError,
|
|
11098
11199
|
GradersClient,
|
|
11099
11200
|
HttpClient,
|
|
11100
11201
|
LabelsClient,
|