braintrust 0.3.6 → 0.3.8
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/dev/dist/index.d.mts +234 -16
- package/dev/dist/index.d.ts +234 -16
- package/dev/dist/index.js +2192 -1134
- package/dev/dist/index.mjs +2148 -1090
- package/dist/browser.d.mts +339 -39
- package/dist/browser.d.ts +339 -39
- package/dist/browser.js +2170 -1114
- package/dist/browser.mjs +2105 -1049
- package/dist/cli.js +2326 -1219
- package/dist/index.d.mts +403 -28
- package/dist/index.d.ts +403 -28
- package/dist/index.js +2799 -1233
- package/dist/index.mjs +2711 -1145
- package/package.json +15 -9
- package/util/dist/index.d.mts +5229 -0
- package/util/dist/index.d.ts +5229 -0
- package/util/dist/index.js +1264 -0
- package/util/dist/index.mjs +1264 -0
package/dev/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,216 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { z } from 'zod';
|
|
1
|
+
import { z } from 'zod/v3';
|
|
2
|
+
import { z as z$1 } from 'zod';
|
|
3
|
+
|
|
4
|
+
declare const TRANSACTION_ID_FIELD = "_xact_id";
|
|
5
|
+
declare const IS_MERGE_FIELD = "_is_merge";
|
|
6
|
+
declare const MERGE_PATHS_FIELD = "_merge_paths";
|
|
7
|
+
declare const AUDIT_SOURCE_FIELD = "_audit_source";
|
|
8
|
+
declare const AUDIT_METADATA_FIELD = "_audit_metadata";
|
|
9
|
+
declare const VALID_SOURCES: readonly ["app", "api", "external"];
|
|
10
|
+
type Source = (typeof VALID_SOURCES)[number];
|
|
11
|
+
declare const ASYNC_SCORING_CONTROL_FIELD = "_async_scoring_control";
|
|
12
|
+
declare const SKIP_ASYNC_SCORING_FIELD = "_skip_async_scoring";
|
|
13
|
+
type TransactionId = string;
|
|
14
|
+
|
|
15
|
+
declare const AsyncScoringControl: z.ZodUnion<[z.ZodObject<{
|
|
16
|
+
kind: z.ZodLiteral<"score_update">;
|
|
17
|
+
token: z.ZodString;
|
|
18
|
+
}, "strip", z.ZodTypeAny, {
|
|
19
|
+
token: string;
|
|
20
|
+
kind: "score_update";
|
|
21
|
+
}, {
|
|
22
|
+
token: string;
|
|
23
|
+
kind: "score_update";
|
|
24
|
+
}>, z.ZodObject<{
|
|
25
|
+
kind: z.ZodLiteral<"state_override">;
|
|
26
|
+
state: z.ZodUnion<[z.ZodObject<{
|
|
27
|
+
status: z.ZodLiteral<"enabled">;
|
|
28
|
+
token: z.ZodString;
|
|
29
|
+
function_ids: z.ZodArray<z.ZodUnknown, "many">;
|
|
30
|
+
skip_logging: z.ZodOptional<z.ZodUnion<[z.ZodBoolean, z.ZodNull]>>;
|
|
31
|
+
}, "strip", z.ZodTypeAny, {
|
|
32
|
+
status: "enabled";
|
|
33
|
+
token: string;
|
|
34
|
+
function_ids: unknown[];
|
|
35
|
+
skip_logging?: boolean | null | undefined;
|
|
36
|
+
}, {
|
|
37
|
+
status: "enabled";
|
|
38
|
+
token: string;
|
|
39
|
+
function_ids: unknown[];
|
|
40
|
+
skip_logging?: boolean | null | undefined;
|
|
41
|
+
}>, z.ZodObject<{
|
|
42
|
+
status: z.ZodLiteral<"disabled">;
|
|
43
|
+
}, "strip", z.ZodTypeAny, {
|
|
44
|
+
status: "disabled";
|
|
45
|
+
}, {
|
|
46
|
+
status: "disabled";
|
|
47
|
+
}>, z.ZodNull, z.ZodNull]>;
|
|
48
|
+
}, "strip", z.ZodTypeAny, {
|
|
49
|
+
kind: "state_override";
|
|
50
|
+
state: {
|
|
51
|
+
status: "enabled";
|
|
52
|
+
token: string;
|
|
53
|
+
function_ids: unknown[];
|
|
54
|
+
skip_logging?: boolean | null | undefined;
|
|
55
|
+
} | {
|
|
56
|
+
status: "disabled";
|
|
57
|
+
} | null;
|
|
58
|
+
}, {
|
|
59
|
+
kind: "state_override";
|
|
60
|
+
state: {
|
|
61
|
+
status: "enabled";
|
|
62
|
+
token: string;
|
|
63
|
+
function_ids: unknown[];
|
|
64
|
+
skip_logging?: boolean | null | undefined;
|
|
65
|
+
} | {
|
|
66
|
+
status: "disabled";
|
|
67
|
+
} | null;
|
|
68
|
+
}>, z.ZodObject<{
|
|
69
|
+
kind: z.ZodLiteral<"state_force_reselect">;
|
|
70
|
+
}, "strip", z.ZodTypeAny, {
|
|
71
|
+
kind: "state_force_reselect";
|
|
72
|
+
}, {
|
|
73
|
+
kind: "state_force_reselect";
|
|
74
|
+
}>, z.ZodObject<{
|
|
75
|
+
kind: z.ZodLiteral<"state_enabled_force_rescore">;
|
|
76
|
+
}, "strip", z.ZodTypeAny, {
|
|
77
|
+
kind: "state_enabled_force_rescore";
|
|
78
|
+
}, {
|
|
79
|
+
kind: "state_enabled_force_rescore";
|
|
80
|
+
}>]>;
|
|
81
|
+
type AsyncScoringControlType = z.infer<typeof AsyncScoringControl>;
|
|
82
|
+
declare const ObjectReference$1: z.ZodObject<{
|
|
83
|
+
object_type: z.ZodEnum<["project_logs", "experiment", "dataset", "prompt", "function", "prompt_session"]>;
|
|
84
|
+
object_id: z.ZodString;
|
|
85
|
+
id: z.ZodString;
|
|
86
|
+
_xact_id: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodNull]>>;
|
|
87
|
+
created: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodNull]>>;
|
|
88
|
+
}, "strip", z.ZodTypeAny, {
|
|
89
|
+
id: string;
|
|
90
|
+
object_type: "function" | "experiment" | "dataset" | "prompt" | "prompt_session" | "project_logs";
|
|
91
|
+
object_id: string;
|
|
92
|
+
created?: string | null | undefined;
|
|
93
|
+
_xact_id?: string | null | undefined;
|
|
94
|
+
}, {
|
|
95
|
+
id: string;
|
|
96
|
+
object_type: "function" | "experiment" | "dataset" | "prompt" | "prompt_session" | "project_logs";
|
|
97
|
+
object_id: string;
|
|
98
|
+
created?: string | null | undefined;
|
|
99
|
+
_xact_id?: string | null | undefined;
|
|
100
|
+
}>;
|
|
101
|
+
|
|
102
|
+
type IdField = {
|
|
103
|
+
id: string;
|
|
104
|
+
};
|
|
105
|
+
type InputField = {
|
|
106
|
+
input: unknown;
|
|
107
|
+
};
|
|
108
|
+
type OtherExperimentLogFields = {
|
|
109
|
+
output: unknown;
|
|
110
|
+
expected: unknown;
|
|
111
|
+
error: unknown;
|
|
112
|
+
tags: string[];
|
|
113
|
+
scores: Record<string, number | null>;
|
|
114
|
+
metadata: Record<string, unknown>;
|
|
115
|
+
metrics: Record<string, unknown>;
|
|
116
|
+
datasetRecordId: string;
|
|
117
|
+
origin: z.infer<typeof ObjectReference$1>;
|
|
118
|
+
span_attributes: Record<string, unknown>;
|
|
119
|
+
[ASYNC_SCORING_CONTROL_FIELD]: AsyncScoringControlType;
|
|
120
|
+
[MERGE_PATHS_FIELD]: string[][];
|
|
121
|
+
[SKIP_ASYNC_SCORING_FIELD]: boolean;
|
|
122
|
+
};
|
|
123
|
+
type ExperimentLogPartialArgs = Partial<OtherExperimentLogFields> & Partial<InputField>;
|
|
124
|
+
type ExperimentLogFullArgs = Partial<Omit<OtherExperimentLogFields, "output" | "scores">> & Required<Pick<OtherExperimentLogFields, "output" | "scores">> & Partial<InputField> & Partial<IdField>;
|
|
125
|
+
type LogFeedbackFullArgs = IdField & Partial<Omit<OtherExperimentLogFields, "output" | "metrics" | "datasetRecordId"> & {
|
|
126
|
+
comment: string;
|
|
127
|
+
source: Source;
|
|
128
|
+
}>;
|
|
129
|
+
interface ParentExperimentIds {
|
|
130
|
+
experiment_id: string;
|
|
131
|
+
}
|
|
132
|
+
interface ParentProjectLogIds {
|
|
133
|
+
project_id: string;
|
|
134
|
+
log_id: "g";
|
|
135
|
+
}
|
|
136
|
+
interface ParentPlaygroundLogIds {
|
|
137
|
+
prompt_session_id: string;
|
|
138
|
+
log_id: "x";
|
|
139
|
+
}
|
|
140
|
+
type ExperimentEvent = Partial<InputField> & Partial<OtherExperimentLogFields> & {
|
|
141
|
+
id: string;
|
|
142
|
+
span_id?: string;
|
|
143
|
+
root_span_id?: string;
|
|
144
|
+
experiment_id: string;
|
|
145
|
+
[IS_MERGE_FIELD]: boolean;
|
|
146
|
+
} & Partial<{
|
|
147
|
+
created: string;
|
|
148
|
+
span_parents: string[];
|
|
149
|
+
span_attributes: Record<string, unknown>;
|
|
150
|
+
context: Record<string, unknown>;
|
|
151
|
+
[AUDIT_SOURCE_FIELD]: Source;
|
|
152
|
+
[AUDIT_METADATA_FIELD]?: Record<string, unknown>;
|
|
153
|
+
}>;
|
|
154
|
+
type DatasetEvent = {
|
|
155
|
+
input?: unknown;
|
|
156
|
+
tags?: string[];
|
|
157
|
+
metadata?: unknown;
|
|
158
|
+
created?: string;
|
|
159
|
+
id: string;
|
|
160
|
+
dataset_id: string;
|
|
161
|
+
} & ({
|
|
162
|
+
expected?: unknown;
|
|
163
|
+
} | {
|
|
164
|
+
output?: unknown;
|
|
165
|
+
});
|
|
166
|
+
type LoggingEvent = Omit<ExperimentEvent, "experiment_id"> & {
|
|
167
|
+
project_id: string;
|
|
168
|
+
log_id: "g";
|
|
169
|
+
};
|
|
170
|
+
type PlaygroundLogEvent = Omit<ExperimentEvent, "experiment_id"> & {
|
|
171
|
+
prompt_session_id: string;
|
|
172
|
+
log_id: "x";
|
|
173
|
+
};
|
|
174
|
+
type CommentEvent = IdField & {
|
|
175
|
+
created: string;
|
|
176
|
+
origin: {
|
|
177
|
+
id: string;
|
|
178
|
+
};
|
|
179
|
+
comment: {
|
|
180
|
+
text: string;
|
|
181
|
+
};
|
|
182
|
+
[AUDIT_SOURCE_FIELD]: Source;
|
|
183
|
+
[AUDIT_METADATA_FIELD]?: Record<string, unknown>;
|
|
184
|
+
} & (ParentExperimentIds | ParentProjectLogIds | ParentPlaygroundLogIds);
|
|
185
|
+
type BackgroundLogEvent = ExperimentEvent | DatasetEvent | LoggingEvent | PlaygroundLogEvent | CommentEvent;
|
|
186
|
+
declare const DEFAULT_IS_LEGACY_DATASET = false;
|
|
187
|
+
interface LegacyDatasetRecord {
|
|
188
|
+
id: string;
|
|
189
|
+
input: any;
|
|
190
|
+
output: any;
|
|
191
|
+
metadata: any;
|
|
192
|
+
}
|
|
193
|
+
interface NewDatasetRecord {
|
|
194
|
+
id: string;
|
|
195
|
+
input: any;
|
|
196
|
+
expected: any;
|
|
197
|
+
tags: any;
|
|
198
|
+
metadata: any;
|
|
199
|
+
}
|
|
200
|
+
type DatasetRecord<IsLegacyDataset extends boolean = typeof DEFAULT_IS_LEGACY_DATASET> = IsLegacyDataset extends true ? LegacyDatasetRecord : NewDatasetRecord;
|
|
201
|
+
|
|
202
|
+
interface Score {
|
|
203
|
+
name: string;
|
|
204
|
+
score: number | null;
|
|
205
|
+
metadata?: Record<string, unknown>;
|
|
206
|
+
/**
|
|
207
|
+
* @deprecated
|
|
208
|
+
*/
|
|
209
|
+
error?: unknown;
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
declare const spanTypeAttributeValues: readonly ["llm", "score", "function", "eval", "task", "tool"];
|
|
213
|
+
type SpanType = (typeof spanTypeAttributeValues)[number];
|
|
3
214
|
|
|
4
215
|
declare const AnyModelParams: z.ZodObject<{
|
|
5
216
|
temperature: z.ZodOptional<z.ZodNumber>;
|
|
@@ -7073,6 +7284,8 @@ declare class LazyValue<T> {
|
|
|
7073
7284
|
get hasSucceeded(): boolean;
|
|
7074
7285
|
}
|
|
7075
7286
|
|
|
7287
|
+
/// <reference lib="dom" />
|
|
7288
|
+
|
|
7076
7289
|
type SetCurrentArg = {
|
|
7077
7290
|
setCurrent?: boolean;
|
|
7078
7291
|
};
|
|
@@ -7246,30 +7459,31 @@ declare class NoopSpan implements Span {
|
|
|
7246
7459
|
setAttributes(_args: Omit<StartSpanArgs, "event">): void;
|
|
7247
7460
|
startSpanWithParents(_spanId: string, _spanParents: string[], _args?: StartSpanArgs): Span;
|
|
7248
7461
|
state(): BraintrustState;
|
|
7462
|
+
toString(): string;
|
|
7249
7463
|
}
|
|
7250
7464
|
declare const NOOP_SPAN: NoopSpan;
|
|
7251
7465
|
declare global {
|
|
7252
7466
|
var __inherited_braintrust_state: BraintrustState;
|
|
7253
7467
|
}
|
|
7254
|
-
declare const loginSchema: z.ZodObject<{
|
|
7255
|
-
appUrl: z.ZodString;
|
|
7256
|
-
appPublicUrl: z.ZodString;
|
|
7257
|
-
orgName: z.ZodString;
|
|
7258
|
-
apiUrl: z.ZodString;
|
|
7259
|
-
proxyUrl: z.ZodString;
|
|
7260
|
-
loginToken: z.ZodString;
|
|
7261
|
-
orgId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
7262
|
-
gitMetadataSettings: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
7263
|
-
collect: z.ZodEnum<["all", "none", "some"]>;
|
|
7264
|
-
fields: z.ZodOptional<z.ZodArray<z.ZodEnum<["commit", "branch", "tag", "dirty", "author_name", "author_email", "commit_message", "commit_time", "git_diff"]>, "many">>;
|
|
7265
|
-
}, "strip", z.ZodTypeAny, {
|
|
7468
|
+
declare const loginSchema: z$1.ZodObject<{
|
|
7469
|
+
appUrl: z$1.ZodString;
|
|
7470
|
+
appPublicUrl: z$1.ZodString;
|
|
7471
|
+
orgName: z$1.ZodString;
|
|
7472
|
+
apiUrl: z$1.ZodString;
|
|
7473
|
+
proxyUrl: z$1.ZodString;
|
|
7474
|
+
loginToken: z$1.ZodString;
|
|
7475
|
+
orgId: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodString>>;
|
|
7476
|
+
gitMetadataSettings: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodObject<{
|
|
7477
|
+
collect: z$1.ZodEnum<["all", "none", "some"]>;
|
|
7478
|
+
fields: z$1.ZodOptional<z$1.ZodArray<z$1.ZodEnum<["commit", "branch", "tag", "dirty", "author_name", "author_email", "commit_message", "commit_time", "git_diff"]>, "many">>;
|
|
7479
|
+
}, "strip", z$1.ZodTypeAny, {
|
|
7266
7480
|
collect: "some" | "none" | "all";
|
|
7267
7481
|
fields?: ("dirty" | "commit" | "branch" | "tag" | "author_name" | "author_email" | "commit_message" | "commit_time" | "git_diff")[] | undefined;
|
|
7268
7482
|
}, {
|
|
7269
7483
|
collect: "some" | "none" | "all";
|
|
7270
7484
|
fields?: ("dirty" | "commit" | "branch" | "tag" | "author_name" | "author_email" | "commit_message" | "commit_time" | "git_diff")[] | undefined;
|
|
7271
7485
|
}>>>;
|
|
7272
|
-
}, "strict", z.ZodTypeAny, {
|
|
7486
|
+
}, "strict", z$1.ZodTypeAny, {
|
|
7273
7487
|
appUrl: string;
|
|
7274
7488
|
appPublicUrl: string;
|
|
7275
7489
|
orgName: string;
|
|
@@ -7294,7 +7508,7 @@ declare const loginSchema: z.ZodObject<{
|
|
|
7294
7508
|
fields?: ("dirty" | "commit" | "branch" | "tag" | "author_name" | "author_email" | "commit_message" | "commit_time" | "git_diff")[] | undefined;
|
|
7295
7509
|
} | null | undefined;
|
|
7296
7510
|
}>;
|
|
7297
|
-
type SerializedBraintrustState = z.infer<typeof loginSchema>;
|
|
7511
|
+
type SerializedBraintrustState = z$1.infer<typeof loginSchema>;
|
|
7298
7512
|
declare class BraintrustState {
|
|
7299
7513
|
private loginParams;
|
|
7300
7514
|
id: string;
|
|
@@ -7337,6 +7551,8 @@ declare class BraintrustState {
|
|
|
7337
7551
|
loginReplaceApiConn(apiConn: HTTPConnection): void;
|
|
7338
7552
|
disable(): void;
|
|
7339
7553
|
enforceQueueSizeLimit(enforce: boolean): void;
|
|
7554
|
+
toJSON(): Record<string, any>;
|
|
7555
|
+
toString(): string;
|
|
7340
7556
|
}
|
|
7341
7557
|
declare class HTTPConnection {
|
|
7342
7558
|
base_url: string;
|
|
@@ -7354,6 +7570,7 @@ declare class HTTPConnection {
|
|
|
7354
7570
|
post(path: string, params?: Record<string, unknown> | string, config?: RequestInit): Promise<Response>;
|
|
7355
7571
|
get_json(object_type: string, args?: Record<string, string | string[] | undefined> | undefined, retries?: number): Promise<any>;
|
|
7356
7572
|
post_json(object_type: string, args?: Record<string, unknown> | string | undefined): Promise<any>;
|
|
7573
|
+
toString(): string;
|
|
7357
7574
|
}
|
|
7358
7575
|
interface ObjectMetadata {
|
|
7359
7576
|
id: string;
|
|
@@ -10968,6 +11185,7 @@ declare global {
|
|
|
10968
11185
|
interface DevServerOpts {
|
|
10969
11186
|
host: string;
|
|
10970
11187
|
port: number;
|
|
11188
|
+
orgName?: string;
|
|
10971
11189
|
}
|
|
10972
11190
|
declare function runDevServer(evaluators: EvaluatorDef<any, any, any, any, any>[], opts: DevServerOpts): void;
|
|
10973
11191
|
|
package/dev/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,216 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { z } from 'zod';
|
|
1
|
+
import { z } from 'zod/v3';
|
|
2
|
+
import { z as z$1 } from 'zod';
|
|
3
|
+
|
|
4
|
+
declare const TRANSACTION_ID_FIELD = "_xact_id";
|
|
5
|
+
declare const IS_MERGE_FIELD = "_is_merge";
|
|
6
|
+
declare const MERGE_PATHS_FIELD = "_merge_paths";
|
|
7
|
+
declare const AUDIT_SOURCE_FIELD = "_audit_source";
|
|
8
|
+
declare const AUDIT_METADATA_FIELD = "_audit_metadata";
|
|
9
|
+
declare const VALID_SOURCES: readonly ["app", "api", "external"];
|
|
10
|
+
type Source = (typeof VALID_SOURCES)[number];
|
|
11
|
+
declare const ASYNC_SCORING_CONTROL_FIELD = "_async_scoring_control";
|
|
12
|
+
declare const SKIP_ASYNC_SCORING_FIELD = "_skip_async_scoring";
|
|
13
|
+
type TransactionId = string;
|
|
14
|
+
|
|
15
|
+
declare const AsyncScoringControl: z.ZodUnion<[z.ZodObject<{
|
|
16
|
+
kind: z.ZodLiteral<"score_update">;
|
|
17
|
+
token: z.ZodString;
|
|
18
|
+
}, "strip", z.ZodTypeAny, {
|
|
19
|
+
token: string;
|
|
20
|
+
kind: "score_update";
|
|
21
|
+
}, {
|
|
22
|
+
token: string;
|
|
23
|
+
kind: "score_update";
|
|
24
|
+
}>, z.ZodObject<{
|
|
25
|
+
kind: z.ZodLiteral<"state_override">;
|
|
26
|
+
state: z.ZodUnion<[z.ZodObject<{
|
|
27
|
+
status: z.ZodLiteral<"enabled">;
|
|
28
|
+
token: z.ZodString;
|
|
29
|
+
function_ids: z.ZodArray<z.ZodUnknown, "many">;
|
|
30
|
+
skip_logging: z.ZodOptional<z.ZodUnion<[z.ZodBoolean, z.ZodNull]>>;
|
|
31
|
+
}, "strip", z.ZodTypeAny, {
|
|
32
|
+
status: "enabled";
|
|
33
|
+
token: string;
|
|
34
|
+
function_ids: unknown[];
|
|
35
|
+
skip_logging?: boolean | null | undefined;
|
|
36
|
+
}, {
|
|
37
|
+
status: "enabled";
|
|
38
|
+
token: string;
|
|
39
|
+
function_ids: unknown[];
|
|
40
|
+
skip_logging?: boolean | null | undefined;
|
|
41
|
+
}>, z.ZodObject<{
|
|
42
|
+
status: z.ZodLiteral<"disabled">;
|
|
43
|
+
}, "strip", z.ZodTypeAny, {
|
|
44
|
+
status: "disabled";
|
|
45
|
+
}, {
|
|
46
|
+
status: "disabled";
|
|
47
|
+
}>, z.ZodNull, z.ZodNull]>;
|
|
48
|
+
}, "strip", z.ZodTypeAny, {
|
|
49
|
+
kind: "state_override";
|
|
50
|
+
state: {
|
|
51
|
+
status: "enabled";
|
|
52
|
+
token: string;
|
|
53
|
+
function_ids: unknown[];
|
|
54
|
+
skip_logging?: boolean | null | undefined;
|
|
55
|
+
} | {
|
|
56
|
+
status: "disabled";
|
|
57
|
+
} | null;
|
|
58
|
+
}, {
|
|
59
|
+
kind: "state_override";
|
|
60
|
+
state: {
|
|
61
|
+
status: "enabled";
|
|
62
|
+
token: string;
|
|
63
|
+
function_ids: unknown[];
|
|
64
|
+
skip_logging?: boolean | null | undefined;
|
|
65
|
+
} | {
|
|
66
|
+
status: "disabled";
|
|
67
|
+
} | null;
|
|
68
|
+
}>, z.ZodObject<{
|
|
69
|
+
kind: z.ZodLiteral<"state_force_reselect">;
|
|
70
|
+
}, "strip", z.ZodTypeAny, {
|
|
71
|
+
kind: "state_force_reselect";
|
|
72
|
+
}, {
|
|
73
|
+
kind: "state_force_reselect";
|
|
74
|
+
}>, z.ZodObject<{
|
|
75
|
+
kind: z.ZodLiteral<"state_enabled_force_rescore">;
|
|
76
|
+
}, "strip", z.ZodTypeAny, {
|
|
77
|
+
kind: "state_enabled_force_rescore";
|
|
78
|
+
}, {
|
|
79
|
+
kind: "state_enabled_force_rescore";
|
|
80
|
+
}>]>;
|
|
81
|
+
type AsyncScoringControlType = z.infer<typeof AsyncScoringControl>;
|
|
82
|
+
declare const ObjectReference$1: z.ZodObject<{
|
|
83
|
+
object_type: z.ZodEnum<["project_logs", "experiment", "dataset", "prompt", "function", "prompt_session"]>;
|
|
84
|
+
object_id: z.ZodString;
|
|
85
|
+
id: z.ZodString;
|
|
86
|
+
_xact_id: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodNull]>>;
|
|
87
|
+
created: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodNull]>>;
|
|
88
|
+
}, "strip", z.ZodTypeAny, {
|
|
89
|
+
id: string;
|
|
90
|
+
object_type: "function" | "experiment" | "dataset" | "prompt" | "prompt_session" | "project_logs";
|
|
91
|
+
object_id: string;
|
|
92
|
+
created?: string | null | undefined;
|
|
93
|
+
_xact_id?: string | null | undefined;
|
|
94
|
+
}, {
|
|
95
|
+
id: string;
|
|
96
|
+
object_type: "function" | "experiment" | "dataset" | "prompt" | "prompt_session" | "project_logs";
|
|
97
|
+
object_id: string;
|
|
98
|
+
created?: string | null | undefined;
|
|
99
|
+
_xact_id?: string | null | undefined;
|
|
100
|
+
}>;
|
|
101
|
+
|
|
102
|
+
type IdField = {
|
|
103
|
+
id: string;
|
|
104
|
+
};
|
|
105
|
+
type InputField = {
|
|
106
|
+
input: unknown;
|
|
107
|
+
};
|
|
108
|
+
type OtherExperimentLogFields = {
|
|
109
|
+
output: unknown;
|
|
110
|
+
expected: unknown;
|
|
111
|
+
error: unknown;
|
|
112
|
+
tags: string[];
|
|
113
|
+
scores: Record<string, number | null>;
|
|
114
|
+
metadata: Record<string, unknown>;
|
|
115
|
+
metrics: Record<string, unknown>;
|
|
116
|
+
datasetRecordId: string;
|
|
117
|
+
origin: z.infer<typeof ObjectReference$1>;
|
|
118
|
+
span_attributes: Record<string, unknown>;
|
|
119
|
+
[ASYNC_SCORING_CONTROL_FIELD]: AsyncScoringControlType;
|
|
120
|
+
[MERGE_PATHS_FIELD]: string[][];
|
|
121
|
+
[SKIP_ASYNC_SCORING_FIELD]: boolean;
|
|
122
|
+
};
|
|
123
|
+
type ExperimentLogPartialArgs = Partial<OtherExperimentLogFields> & Partial<InputField>;
|
|
124
|
+
type ExperimentLogFullArgs = Partial<Omit<OtherExperimentLogFields, "output" | "scores">> & Required<Pick<OtherExperimentLogFields, "output" | "scores">> & Partial<InputField> & Partial<IdField>;
|
|
125
|
+
type LogFeedbackFullArgs = IdField & Partial<Omit<OtherExperimentLogFields, "output" | "metrics" | "datasetRecordId"> & {
|
|
126
|
+
comment: string;
|
|
127
|
+
source: Source;
|
|
128
|
+
}>;
|
|
129
|
+
interface ParentExperimentIds {
|
|
130
|
+
experiment_id: string;
|
|
131
|
+
}
|
|
132
|
+
interface ParentProjectLogIds {
|
|
133
|
+
project_id: string;
|
|
134
|
+
log_id: "g";
|
|
135
|
+
}
|
|
136
|
+
interface ParentPlaygroundLogIds {
|
|
137
|
+
prompt_session_id: string;
|
|
138
|
+
log_id: "x";
|
|
139
|
+
}
|
|
140
|
+
type ExperimentEvent = Partial<InputField> & Partial<OtherExperimentLogFields> & {
|
|
141
|
+
id: string;
|
|
142
|
+
span_id?: string;
|
|
143
|
+
root_span_id?: string;
|
|
144
|
+
experiment_id: string;
|
|
145
|
+
[IS_MERGE_FIELD]: boolean;
|
|
146
|
+
} & Partial<{
|
|
147
|
+
created: string;
|
|
148
|
+
span_parents: string[];
|
|
149
|
+
span_attributes: Record<string, unknown>;
|
|
150
|
+
context: Record<string, unknown>;
|
|
151
|
+
[AUDIT_SOURCE_FIELD]: Source;
|
|
152
|
+
[AUDIT_METADATA_FIELD]?: Record<string, unknown>;
|
|
153
|
+
}>;
|
|
154
|
+
type DatasetEvent = {
|
|
155
|
+
input?: unknown;
|
|
156
|
+
tags?: string[];
|
|
157
|
+
metadata?: unknown;
|
|
158
|
+
created?: string;
|
|
159
|
+
id: string;
|
|
160
|
+
dataset_id: string;
|
|
161
|
+
} & ({
|
|
162
|
+
expected?: unknown;
|
|
163
|
+
} | {
|
|
164
|
+
output?: unknown;
|
|
165
|
+
});
|
|
166
|
+
type LoggingEvent = Omit<ExperimentEvent, "experiment_id"> & {
|
|
167
|
+
project_id: string;
|
|
168
|
+
log_id: "g";
|
|
169
|
+
};
|
|
170
|
+
type PlaygroundLogEvent = Omit<ExperimentEvent, "experiment_id"> & {
|
|
171
|
+
prompt_session_id: string;
|
|
172
|
+
log_id: "x";
|
|
173
|
+
};
|
|
174
|
+
type CommentEvent = IdField & {
|
|
175
|
+
created: string;
|
|
176
|
+
origin: {
|
|
177
|
+
id: string;
|
|
178
|
+
};
|
|
179
|
+
comment: {
|
|
180
|
+
text: string;
|
|
181
|
+
};
|
|
182
|
+
[AUDIT_SOURCE_FIELD]: Source;
|
|
183
|
+
[AUDIT_METADATA_FIELD]?: Record<string, unknown>;
|
|
184
|
+
} & (ParentExperimentIds | ParentProjectLogIds | ParentPlaygroundLogIds);
|
|
185
|
+
type BackgroundLogEvent = ExperimentEvent | DatasetEvent | LoggingEvent | PlaygroundLogEvent | CommentEvent;
|
|
186
|
+
declare const DEFAULT_IS_LEGACY_DATASET = false;
|
|
187
|
+
interface LegacyDatasetRecord {
|
|
188
|
+
id: string;
|
|
189
|
+
input: any;
|
|
190
|
+
output: any;
|
|
191
|
+
metadata: any;
|
|
192
|
+
}
|
|
193
|
+
interface NewDatasetRecord {
|
|
194
|
+
id: string;
|
|
195
|
+
input: any;
|
|
196
|
+
expected: any;
|
|
197
|
+
tags: any;
|
|
198
|
+
metadata: any;
|
|
199
|
+
}
|
|
200
|
+
type DatasetRecord<IsLegacyDataset extends boolean = typeof DEFAULT_IS_LEGACY_DATASET> = IsLegacyDataset extends true ? LegacyDatasetRecord : NewDatasetRecord;
|
|
201
|
+
|
|
202
|
+
interface Score {
|
|
203
|
+
name: string;
|
|
204
|
+
score: number | null;
|
|
205
|
+
metadata?: Record<string, unknown>;
|
|
206
|
+
/**
|
|
207
|
+
* @deprecated
|
|
208
|
+
*/
|
|
209
|
+
error?: unknown;
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
declare const spanTypeAttributeValues: readonly ["llm", "score", "function", "eval", "task", "tool"];
|
|
213
|
+
type SpanType = (typeof spanTypeAttributeValues)[number];
|
|
3
214
|
|
|
4
215
|
declare const AnyModelParams: z.ZodObject<{
|
|
5
216
|
temperature: z.ZodOptional<z.ZodNumber>;
|
|
@@ -7073,6 +7284,8 @@ declare class LazyValue<T> {
|
|
|
7073
7284
|
get hasSucceeded(): boolean;
|
|
7074
7285
|
}
|
|
7075
7286
|
|
|
7287
|
+
/// <reference lib="dom" />
|
|
7288
|
+
|
|
7076
7289
|
type SetCurrentArg = {
|
|
7077
7290
|
setCurrent?: boolean;
|
|
7078
7291
|
};
|
|
@@ -7246,30 +7459,31 @@ declare class NoopSpan implements Span {
|
|
|
7246
7459
|
setAttributes(_args: Omit<StartSpanArgs, "event">): void;
|
|
7247
7460
|
startSpanWithParents(_spanId: string, _spanParents: string[], _args?: StartSpanArgs): Span;
|
|
7248
7461
|
state(): BraintrustState;
|
|
7462
|
+
toString(): string;
|
|
7249
7463
|
}
|
|
7250
7464
|
declare const NOOP_SPAN: NoopSpan;
|
|
7251
7465
|
declare global {
|
|
7252
7466
|
var __inherited_braintrust_state: BraintrustState;
|
|
7253
7467
|
}
|
|
7254
|
-
declare const loginSchema: z.ZodObject<{
|
|
7255
|
-
appUrl: z.ZodString;
|
|
7256
|
-
appPublicUrl: z.ZodString;
|
|
7257
|
-
orgName: z.ZodString;
|
|
7258
|
-
apiUrl: z.ZodString;
|
|
7259
|
-
proxyUrl: z.ZodString;
|
|
7260
|
-
loginToken: z.ZodString;
|
|
7261
|
-
orgId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
7262
|
-
gitMetadataSettings: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
7263
|
-
collect: z.ZodEnum<["all", "none", "some"]>;
|
|
7264
|
-
fields: z.ZodOptional<z.ZodArray<z.ZodEnum<["commit", "branch", "tag", "dirty", "author_name", "author_email", "commit_message", "commit_time", "git_diff"]>, "many">>;
|
|
7265
|
-
}, "strip", z.ZodTypeAny, {
|
|
7468
|
+
declare const loginSchema: z$1.ZodObject<{
|
|
7469
|
+
appUrl: z$1.ZodString;
|
|
7470
|
+
appPublicUrl: z$1.ZodString;
|
|
7471
|
+
orgName: z$1.ZodString;
|
|
7472
|
+
apiUrl: z$1.ZodString;
|
|
7473
|
+
proxyUrl: z$1.ZodString;
|
|
7474
|
+
loginToken: z$1.ZodString;
|
|
7475
|
+
orgId: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodString>>;
|
|
7476
|
+
gitMetadataSettings: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodObject<{
|
|
7477
|
+
collect: z$1.ZodEnum<["all", "none", "some"]>;
|
|
7478
|
+
fields: z$1.ZodOptional<z$1.ZodArray<z$1.ZodEnum<["commit", "branch", "tag", "dirty", "author_name", "author_email", "commit_message", "commit_time", "git_diff"]>, "many">>;
|
|
7479
|
+
}, "strip", z$1.ZodTypeAny, {
|
|
7266
7480
|
collect: "some" | "none" | "all";
|
|
7267
7481
|
fields?: ("dirty" | "commit" | "branch" | "tag" | "author_name" | "author_email" | "commit_message" | "commit_time" | "git_diff")[] | undefined;
|
|
7268
7482
|
}, {
|
|
7269
7483
|
collect: "some" | "none" | "all";
|
|
7270
7484
|
fields?: ("dirty" | "commit" | "branch" | "tag" | "author_name" | "author_email" | "commit_message" | "commit_time" | "git_diff")[] | undefined;
|
|
7271
7485
|
}>>>;
|
|
7272
|
-
}, "strict", z.ZodTypeAny, {
|
|
7486
|
+
}, "strict", z$1.ZodTypeAny, {
|
|
7273
7487
|
appUrl: string;
|
|
7274
7488
|
appPublicUrl: string;
|
|
7275
7489
|
orgName: string;
|
|
@@ -7294,7 +7508,7 @@ declare const loginSchema: z.ZodObject<{
|
|
|
7294
7508
|
fields?: ("dirty" | "commit" | "branch" | "tag" | "author_name" | "author_email" | "commit_message" | "commit_time" | "git_diff")[] | undefined;
|
|
7295
7509
|
} | null | undefined;
|
|
7296
7510
|
}>;
|
|
7297
|
-
type SerializedBraintrustState = z.infer<typeof loginSchema>;
|
|
7511
|
+
type SerializedBraintrustState = z$1.infer<typeof loginSchema>;
|
|
7298
7512
|
declare class BraintrustState {
|
|
7299
7513
|
private loginParams;
|
|
7300
7514
|
id: string;
|
|
@@ -7337,6 +7551,8 @@ declare class BraintrustState {
|
|
|
7337
7551
|
loginReplaceApiConn(apiConn: HTTPConnection): void;
|
|
7338
7552
|
disable(): void;
|
|
7339
7553
|
enforceQueueSizeLimit(enforce: boolean): void;
|
|
7554
|
+
toJSON(): Record<string, any>;
|
|
7555
|
+
toString(): string;
|
|
7340
7556
|
}
|
|
7341
7557
|
declare class HTTPConnection {
|
|
7342
7558
|
base_url: string;
|
|
@@ -7354,6 +7570,7 @@ declare class HTTPConnection {
|
|
|
7354
7570
|
post(path: string, params?: Record<string, unknown> | string, config?: RequestInit): Promise<Response>;
|
|
7355
7571
|
get_json(object_type: string, args?: Record<string, string | string[] | undefined> | undefined, retries?: number): Promise<any>;
|
|
7356
7572
|
post_json(object_type: string, args?: Record<string, unknown> | string | undefined): Promise<any>;
|
|
7573
|
+
toString(): string;
|
|
7357
7574
|
}
|
|
7358
7575
|
interface ObjectMetadata {
|
|
7359
7576
|
id: string;
|
|
@@ -10968,6 +11185,7 @@ declare global {
|
|
|
10968
11185
|
interface DevServerOpts {
|
|
10969
11186
|
host: string;
|
|
10970
11187
|
port: number;
|
|
11188
|
+
orgName?: string;
|
|
10971
11189
|
}
|
|
10972
11190
|
declare function runDevServer(evaluators: EvaluatorDef<any, any, any, any, any>[], opts: DevServerOpts): void;
|
|
10973
11191
|
|