braintrust 0.2.6 → 0.3.7
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 +228 -16
- package/dev/dist/index.d.ts +228 -16
- package/dev/dist/index.js +2121 -1133
- package/dev/dist/index.mjs +2077 -1089
- package/dist/browser.d.mts +331 -39
- package/dist/browser.d.ts +331 -39
- package/dist/browser.js +2157 -1169
- package/dist/browser.mjs +2099 -1111
- package/dist/cli.js +2191 -1159
- package/dist/index.d.mts +356 -28
- package/dist/index.d.ts +356 -28
- package/dist/index.js +2642 -1286
- package/dist/index.mjs +2562 -1206
- package/package.json +13 -8
- 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>;
|
|
@@ -7251,25 +7462,25 @@ declare const NOOP_SPAN: NoopSpan;
|
|
|
7251
7462
|
declare global {
|
|
7252
7463
|
var __inherited_braintrust_state: BraintrustState;
|
|
7253
7464
|
}
|
|
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, {
|
|
7465
|
+
declare const loginSchema: z$1.ZodObject<{
|
|
7466
|
+
appUrl: z$1.ZodString;
|
|
7467
|
+
appPublicUrl: z$1.ZodString;
|
|
7468
|
+
orgName: z$1.ZodString;
|
|
7469
|
+
apiUrl: z$1.ZodString;
|
|
7470
|
+
proxyUrl: z$1.ZodString;
|
|
7471
|
+
loginToken: z$1.ZodString;
|
|
7472
|
+
orgId: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodString>>;
|
|
7473
|
+
gitMetadataSettings: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodObject<{
|
|
7474
|
+
collect: z$1.ZodEnum<["all", "none", "some"]>;
|
|
7475
|
+
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">>;
|
|
7476
|
+
}, "strip", z$1.ZodTypeAny, {
|
|
7266
7477
|
collect: "some" | "none" | "all";
|
|
7267
7478
|
fields?: ("dirty" | "commit" | "branch" | "tag" | "author_name" | "author_email" | "commit_message" | "commit_time" | "git_diff")[] | undefined;
|
|
7268
7479
|
}, {
|
|
7269
7480
|
collect: "some" | "none" | "all";
|
|
7270
7481
|
fields?: ("dirty" | "commit" | "branch" | "tag" | "author_name" | "author_email" | "commit_message" | "commit_time" | "git_diff")[] | undefined;
|
|
7271
7482
|
}>>>;
|
|
7272
|
-
}, "strict", z.ZodTypeAny, {
|
|
7483
|
+
}, "strict", z$1.ZodTypeAny, {
|
|
7273
7484
|
appUrl: string;
|
|
7274
7485
|
appPublicUrl: string;
|
|
7275
7486
|
orgName: string;
|
|
@@ -7294,7 +7505,7 @@ declare const loginSchema: z.ZodObject<{
|
|
|
7294
7505
|
fields?: ("dirty" | "commit" | "branch" | "tag" | "author_name" | "author_email" | "commit_message" | "commit_time" | "git_diff")[] | undefined;
|
|
7295
7506
|
} | null | undefined;
|
|
7296
7507
|
}>;
|
|
7297
|
-
type SerializedBraintrustState = z.infer<typeof loginSchema>;
|
|
7508
|
+
type SerializedBraintrustState = z$1.infer<typeof loginSchema>;
|
|
7298
7509
|
declare class BraintrustState {
|
|
7299
7510
|
private loginParams;
|
|
7300
7511
|
id: string;
|
|
@@ -10968,6 +11179,7 @@ declare global {
|
|
|
10968
11179
|
interface DevServerOpts {
|
|
10969
11180
|
host: string;
|
|
10970
11181
|
port: number;
|
|
11182
|
+
orgName?: string;
|
|
10971
11183
|
}
|
|
10972
11184
|
declare function runDevServer(evaluators: EvaluatorDef<any, any, any, any, any>[], opts: DevServerOpts): void;
|
|
10973
11185
|
|
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>;
|
|
@@ -7251,25 +7462,25 @@ declare const NOOP_SPAN: NoopSpan;
|
|
|
7251
7462
|
declare global {
|
|
7252
7463
|
var __inherited_braintrust_state: BraintrustState;
|
|
7253
7464
|
}
|
|
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, {
|
|
7465
|
+
declare const loginSchema: z$1.ZodObject<{
|
|
7466
|
+
appUrl: z$1.ZodString;
|
|
7467
|
+
appPublicUrl: z$1.ZodString;
|
|
7468
|
+
orgName: z$1.ZodString;
|
|
7469
|
+
apiUrl: z$1.ZodString;
|
|
7470
|
+
proxyUrl: z$1.ZodString;
|
|
7471
|
+
loginToken: z$1.ZodString;
|
|
7472
|
+
orgId: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodString>>;
|
|
7473
|
+
gitMetadataSettings: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodObject<{
|
|
7474
|
+
collect: z$1.ZodEnum<["all", "none", "some"]>;
|
|
7475
|
+
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">>;
|
|
7476
|
+
}, "strip", z$1.ZodTypeAny, {
|
|
7266
7477
|
collect: "some" | "none" | "all";
|
|
7267
7478
|
fields?: ("dirty" | "commit" | "branch" | "tag" | "author_name" | "author_email" | "commit_message" | "commit_time" | "git_diff")[] | undefined;
|
|
7268
7479
|
}, {
|
|
7269
7480
|
collect: "some" | "none" | "all";
|
|
7270
7481
|
fields?: ("dirty" | "commit" | "branch" | "tag" | "author_name" | "author_email" | "commit_message" | "commit_time" | "git_diff")[] | undefined;
|
|
7271
7482
|
}>>>;
|
|
7272
|
-
}, "strict", z.ZodTypeAny, {
|
|
7483
|
+
}, "strict", z$1.ZodTypeAny, {
|
|
7273
7484
|
appUrl: string;
|
|
7274
7485
|
appPublicUrl: string;
|
|
7275
7486
|
orgName: string;
|
|
@@ -7294,7 +7505,7 @@ declare const loginSchema: z.ZodObject<{
|
|
|
7294
7505
|
fields?: ("dirty" | "commit" | "branch" | "tag" | "author_name" | "author_email" | "commit_message" | "commit_time" | "git_diff")[] | undefined;
|
|
7295
7506
|
} | null | undefined;
|
|
7296
7507
|
}>;
|
|
7297
|
-
type SerializedBraintrustState = z.infer<typeof loginSchema>;
|
|
7508
|
+
type SerializedBraintrustState = z$1.infer<typeof loginSchema>;
|
|
7298
7509
|
declare class BraintrustState {
|
|
7299
7510
|
private loginParams;
|
|
7300
7511
|
id: string;
|
|
@@ -10968,6 +11179,7 @@ declare global {
|
|
|
10968
11179
|
interface DevServerOpts {
|
|
10969
11180
|
host: string;
|
|
10970
11181
|
port: number;
|
|
11182
|
+
orgName?: string;
|
|
10971
11183
|
}
|
|
10972
11184
|
declare function runDevServer(evaluators: EvaluatorDef<any, any, any, any, any>[], opts: DevServerOpts): void;
|
|
10973
11185
|
|