braintrust 0.0.205 → 0.0.206
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 +177 -15
- package/dev/dist/index.d.ts +177 -15
- package/dev/dist/index.js +157 -25
- package/dev/dist/index.mjs +159 -26
- package/dist/browser.d.mts +563 -66
- package/dist/browser.d.ts +563 -66
- package/dist/browser.js +41 -12
- package/dist/browser.mjs +39 -12
- package/dist/cli.js +152 -111
- package/dist/index.d.mts +680 -66
- package/dist/index.d.ts +680 -66
- package/dist/index.js +154 -33
- package/dist/index.mjs +154 -34
- package/package.json +6 -5
package/dev/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { TRANSACTION_ID_FIELD, TransactionId, ExperimentEvent, DEFAULT_IS_LEGACY_DATASET, DatasetRecord, ExperimentLogFullArgs, ExperimentLogPartialArgs, LogFeedbackFullArgs, SpanType, IdField, BackgroundLogEvent, Score } from '@braintrust/core';
|
|
2
|
-
import { GitMetadataSettings, Prompt as Prompt$1, PromptSessionEvent, PromptData, AnyModelParam, OpenAIMessage, Tools, Message, PromptBlockData, IfExists, SavedFunctionId, ToolFunctionDefinition, FunctionType, SSEProgressEventData, RepoInfo, ObjectReference } from '@braintrust/core/typespecs';
|
|
2
|
+
import { GitMetadataSettings, Prompt as Prompt$1, PromptSessionEvent, PromptData, AnyModelParam, OpenAIMessage, Tools, Message, PromptBlockData, IfExists, SavedFunctionId, ToolFunctionDefinition, FunctionType, functionDataSchema, SSEProgressEventData, RepoInfo, ObjectReference } from '@braintrust/core/typespecs';
|
|
3
3
|
import { z } from 'zod';
|
|
4
4
|
|
|
5
5
|
type GenericFunction<Input, Output> = ((input: Input) => Output) | ((input: Input) => Promise<Output>);
|
|
@@ -73,6 +73,10 @@ interface DiskCacheOptions {
|
|
|
73
73
|
*/
|
|
74
74
|
max?: number;
|
|
75
75
|
logWarnings?: boolean;
|
|
76
|
+
/**
|
|
77
|
+
* Whether to create the cache directory if it doesn't exist.
|
|
78
|
+
*/
|
|
79
|
+
mkdir?: boolean;
|
|
76
80
|
}
|
|
77
81
|
/**
|
|
78
82
|
* A persistent filesystem-based cache implementation.
|
|
@@ -90,13 +94,14 @@ interface DiskCacheOptions {
|
|
|
90
94
|
declare class DiskCache<T> {
|
|
91
95
|
private readonly dir;
|
|
92
96
|
private readonly max?;
|
|
97
|
+
private readonly mkdir;
|
|
93
98
|
private readonly logWarnings;
|
|
94
99
|
/**
|
|
95
100
|
* Creates a new DiskCache instance.
|
|
96
101
|
* @param options - Configuration options for the cache.
|
|
97
102
|
*/
|
|
98
103
|
constructor(options: DiskCacheOptions);
|
|
99
|
-
|
|
104
|
+
getEntryPath(key: string): string;
|
|
100
105
|
/**
|
|
101
106
|
* Retrieves a value from the cache.
|
|
102
107
|
* Updates the entry's access time when read.
|
|
@@ -304,7 +309,7 @@ interface Span extends Exportable {
|
|
|
304
309
|
* Links can be generated at any time, but they will only become viewable
|
|
305
310
|
* after the span and its root have been flushed to the server and ingested.
|
|
306
311
|
*
|
|
307
|
-
* There are
|
|
312
|
+
* There are some conditions when a Span doesn't have enough information
|
|
308
313
|
* to return a stable link (e.g. during an unresolved experiment). In this case
|
|
309
314
|
* or if there's an error generating link, we'll return a placeholder link.
|
|
310
315
|
*
|
|
@@ -1044,7 +1049,12 @@ declare class Project {
|
|
|
1044
1049
|
tools: ToolBuilder;
|
|
1045
1050
|
prompts: PromptBuilder;
|
|
1046
1051
|
scorers: ScorerBuilder;
|
|
1052
|
+
private _publishableCodeFunctions;
|
|
1053
|
+
private _publishablePrompts;
|
|
1047
1054
|
constructor(args: CreateProjectOpts);
|
|
1055
|
+
addPrompt(prompt: CodePrompt): void;
|
|
1056
|
+
addCodeFunction(fn: CodeFunction<any, any, GenericFunction<any, any>>): void;
|
|
1057
|
+
publish(): Promise<void>;
|
|
1048
1058
|
}
|
|
1049
1059
|
declare class ToolBuilder {
|
|
1050
1060
|
private readonly project;
|
|
@@ -1115,6 +1125,7 @@ declare class CodePrompt {
|
|
|
1115
1125
|
name: string;
|
|
1116
1126
|
slug: string;
|
|
1117
1127
|
}, functionType?: FunctionType);
|
|
1128
|
+
toFunctionDefinition(projectNameToId: ProjectNameIdMap): Promise<FunctionEvent>;
|
|
1118
1129
|
}
|
|
1119
1130
|
interface PromptId {
|
|
1120
1131
|
id: string;
|
|
@@ -1434,16 +1445,56 @@ declare const promptDefinitionSchema: z.ZodIntersection<z.ZodUnion<[z.ZodObject<
|
|
|
1434
1445
|
content?: string | null | undefined;
|
|
1435
1446
|
}[] | null | undefined;
|
|
1436
1447
|
}>, z.ZodObject<{
|
|
1437
|
-
content: z.ZodDefault<z.ZodString
|
|
1448
|
+
content: z.ZodUnion<[z.ZodDefault<z.ZodString>, z.ZodArray<z.ZodObject<{
|
|
1449
|
+
text: z.ZodDefault<z.ZodString>;
|
|
1450
|
+
type: z.ZodLiteral<"text">;
|
|
1451
|
+
cache_control: z.ZodOptional<z.ZodObject<{
|
|
1452
|
+
type: z.ZodEnum<["ephemeral"]>;
|
|
1453
|
+
}, "strip", z.ZodTypeAny, {
|
|
1454
|
+
type: "ephemeral";
|
|
1455
|
+
}, {
|
|
1456
|
+
type: "ephemeral";
|
|
1457
|
+
}>>;
|
|
1458
|
+
}, "strip", z.ZodTypeAny, {
|
|
1459
|
+
type: "text";
|
|
1460
|
+
text: string;
|
|
1461
|
+
cache_control?: {
|
|
1462
|
+
type: "ephemeral";
|
|
1463
|
+
} | undefined;
|
|
1464
|
+
}, {
|
|
1465
|
+
type: "text";
|
|
1466
|
+
text?: string | undefined;
|
|
1467
|
+
cache_control?: {
|
|
1468
|
+
type: "ephemeral";
|
|
1469
|
+
} | undefined;
|
|
1470
|
+
}>, "many">]>;
|
|
1438
1471
|
role: z.ZodLiteral<"tool">;
|
|
1439
1472
|
tool_call_id: z.ZodDefault<z.ZodString>;
|
|
1440
1473
|
}, "strip", z.ZodTypeAny, {
|
|
1441
|
-
content: string
|
|
1474
|
+
content: (string | {
|
|
1475
|
+
type: "text";
|
|
1476
|
+
text: string;
|
|
1477
|
+
cache_control?: {
|
|
1478
|
+
type: "ephemeral";
|
|
1479
|
+
} | undefined;
|
|
1480
|
+
}[]) & (string | {
|
|
1481
|
+
type: "text";
|
|
1482
|
+
text: string;
|
|
1483
|
+
cache_control?: {
|
|
1484
|
+
type: "ephemeral";
|
|
1485
|
+
} | undefined;
|
|
1486
|
+
}[] | undefined);
|
|
1442
1487
|
role: "tool";
|
|
1443
1488
|
tool_call_id: string;
|
|
1444
1489
|
}, {
|
|
1445
1490
|
role: "tool";
|
|
1446
|
-
content?: string |
|
|
1491
|
+
content?: string | {
|
|
1492
|
+
type: "text";
|
|
1493
|
+
text?: string | undefined;
|
|
1494
|
+
cache_control?: {
|
|
1495
|
+
type: "ephemeral";
|
|
1496
|
+
} | undefined;
|
|
1497
|
+
}[] | undefined;
|
|
1447
1498
|
tool_call_id?: string | undefined;
|
|
1448
1499
|
}>, z.ZodObject<{
|
|
1449
1500
|
content: z.ZodNullable<z.ZodString>;
|
|
@@ -1539,7 +1590,19 @@ declare const promptDefinitionSchema: z.ZodIntersection<z.ZodUnion<[z.ZodObject<
|
|
|
1539
1590
|
content?: string | undefined;
|
|
1540
1591
|
}[] | undefined;
|
|
1541
1592
|
} | {
|
|
1542
|
-
content: string
|
|
1593
|
+
content: (string | {
|
|
1594
|
+
type: "text";
|
|
1595
|
+
text: string;
|
|
1596
|
+
cache_control?: {
|
|
1597
|
+
type: "ephemeral";
|
|
1598
|
+
} | undefined;
|
|
1599
|
+
}[]) & (string | {
|
|
1600
|
+
type: "text";
|
|
1601
|
+
text: string;
|
|
1602
|
+
cache_control?: {
|
|
1603
|
+
type: "ephemeral";
|
|
1604
|
+
} | undefined;
|
|
1605
|
+
}[] | undefined);
|
|
1543
1606
|
role: "tool";
|
|
1544
1607
|
tool_call_id: string;
|
|
1545
1608
|
} | {
|
|
@@ -1605,7 +1668,13 @@ declare const promptDefinitionSchema: z.ZodIntersection<z.ZodUnion<[z.ZodObject<
|
|
|
1605
1668
|
}[] | null | undefined;
|
|
1606
1669
|
} | {
|
|
1607
1670
|
role: "tool";
|
|
1608
|
-
content?: string |
|
|
1671
|
+
content?: string | {
|
|
1672
|
+
type: "text";
|
|
1673
|
+
text?: string | undefined;
|
|
1674
|
+
cache_control?: {
|
|
1675
|
+
type: "ephemeral";
|
|
1676
|
+
} | undefined;
|
|
1677
|
+
}[] | undefined;
|
|
1609
1678
|
tool_call_id?: string | undefined;
|
|
1610
1679
|
} | {
|
|
1611
1680
|
name: string;
|
|
@@ -2159,6 +2228,23 @@ declare class PromptBuilder {
|
|
|
2159
2228
|
constructor(project: Project);
|
|
2160
2229
|
create<HasId extends boolean = false, HasVersion extends boolean = false>(opts: PromptOpts<HasId, HasVersion>): Prompt<HasId, HasVersion>;
|
|
2161
2230
|
}
|
|
2231
|
+
interface FunctionEvent {
|
|
2232
|
+
project_id: string;
|
|
2233
|
+
slug: string;
|
|
2234
|
+
name: string;
|
|
2235
|
+
description: string;
|
|
2236
|
+
prompt_data?: PromptData;
|
|
2237
|
+
function_data: z.infer<typeof functionDataSchema>;
|
|
2238
|
+
function_type?: FunctionType;
|
|
2239
|
+
if_exists?: IfExists;
|
|
2240
|
+
}
|
|
2241
|
+
declare class ProjectNameIdMap {
|
|
2242
|
+
private nameToId;
|
|
2243
|
+
private idToName;
|
|
2244
|
+
getId(projectName: string): Promise<string>;
|
|
2245
|
+
getName(projectId: string): Promise<string>;
|
|
2246
|
+
resolve(project: Project): Promise<string>;
|
|
2247
|
+
}
|
|
2162
2248
|
|
|
2163
2249
|
declare const evalParametersSchema: z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodObject<{
|
|
2164
2250
|
type: z.ZodLiteral<"prompt">;
|
|
@@ -2468,16 +2554,56 @@ declare const evalParametersSchema: z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodOb
|
|
|
2468
2554
|
content?: string | null | undefined;
|
|
2469
2555
|
}[] | null | undefined;
|
|
2470
2556
|
}>, z.ZodObject<{
|
|
2471
|
-
content: z.ZodDefault<z.ZodString
|
|
2557
|
+
content: z.ZodUnion<[z.ZodDefault<z.ZodString>, z.ZodArray<z.ZodObject<{
|
|
2558
|
+
text: z.ZodDefault<z.ZodString>;
|
|
2559
|
+
type: z.ZodLiteral<"text">;
|
|
2560
|
+
cache_control: z.ZodOptional<z.ZodObject<{
|
|
2561
|
+
type: z.ZodEnum<["ephemeral"]>;
|
|
2562
|
+
}, "strip", z.ZodTypeAny, {
|
|
2563
|
+
type: "ephemeral";
|
|
2564
|
+
}, {
|
|
2565
|
+
type: "ephemeral";
|
|
2566
|
+
}>>;
|
|
2567
|
+
}, "strip", z.ZodTypeAny, {
|
|
2568
|
+
type: "text";
|
|
2569
|
+
text: string;
|
|
2570
|
+
cache_control?: {
|
|
2571
|
+
type: "ephemeral";
|
|
2572
|
+
} | undefined;
|
|
2573
|
+
}, {
|
|
2574
|
+
type: "text";
|
|
2575
|
+
text?: string | undefined;
|
|
2576
|
+
cache_control?: {
|
|
2577
|
+
type: "ephemeral";
|
|
2578
|
+
} | undefined;
|
|
2579
|
+
}>, "many">]>;
|
|
2472
2580
|
role: z.ZodLiteral<"tool">;
|
|
2473
2581
|
tool_call_id: z.ZodDefault<z.ZodString>;
|
|
2474
2582
|
}, "strip", z.ZodTypeAny, {
|
|
2475
|
-
content: string
|
|
2583
|
+
content: (string | {
|
|
2584
|
+
type: "text";
|
|
2585
|
+
text: string;
|
|
2586
|
+
cache_control?: {
|
|
2587
|
+
type: "ephemeral";
|
|
2588
|
+
} | undefined;
|
|
2589
|
+
}[]) & (string | {
|
|
2590
|
+
type: "text";
|
|
2591
|
+
text: string;
|
|
2592
|
+
cache_control?: {
|
|
2593
|
+
type: "ephemeral";
|
|
2594
|
+
} | undefined;
|
|
2595
|
+
}[] | undefined);
|
|
2476
2596
|
role: "tool";
|
|
2477
2597
|
tool_call_id: string;
|
|
2478
2598
|
}, {
|
|
2479
2599
|
role: "tool";
|
|
2480
|
-
content?: string |
|
|
2600
|
+
content?: string | {
|
|
2601
|
+
type: "text";
|
|
2602
|
+
text?: string | undefined;
|
|
2603
|
+
cache_control?: {
|
|
2604
|
+
type: "ephemeral";
|
|
2605
|
+
} | undefined;
|
|
2606
|
+
}[] | undefined;
|
|
2481
2607
|
tool_call_id?: string | undefined;
|
|
2482
2608
|
}>, z.ZodObject<{
|
|
2483
2609
|
content: z.ZodNullable<z.ZodString>;
|
|
@@ -2573,7 +2699,19 @@ declare const evalParametersSchema: z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodOb
|
|
|
2573
2699
|
content?: string | undefined;
|
|
2574
2700
|
}[] | undefined;
|
|
2575
2701
|
} | {
|
|
2576
|
-
content: string
|
|
2702
|
+
content: (string | {
|
|
2703
|
+
type: "text";
|
|
2704
|
+
text: string;
|
|
2705
|
+
cache_control?: {
|
|
2706
|
+
type: "ephemeral";
|
|
2707
|
+
} | undefined;
|
|
2708
|
+
}[]) & (string | {
|
|
2709
|
+
type: "text";
|
|
2710
|
+
text: string;
|
|
2711
|
+
cache_control?: {
|
|
2712
|
+
type: "ephemeral";
|
|
2713
|
+
} | undefined;
|
|
2714
|
+
}[] | undefined);
|
|
2577
2715
|
role: "tool";
|
|
2578
2716
|
tool_call_id: string;
|
|
2579
2717
|
} | {
|
|
@@ -2639,7 +2777,13 @@ declare const evalParametersSchema: z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodOb
|
|
|
2639
2777
|
}[] | null | undefined;
|
|
2640
2778
|
} | {
|
|
2641
2779
|
role: "tool";
|
|
2642
|
-
content?: string |
|
|
2780
|
+
content?: string | {
|
|
2781
|
+
type: "text";
|
|
2782
|
+
text?: string | undefined;
|
|
2783
|
+
cache_control?: {
|
|
2784
|
+
type: "ephemeral";
|
|
2785
|
+
} | undefined;
|
|
2786
|
+
}[] | undefined;
|
|
2643
2787
|
tool_call_id?: string | undefined;
|
|
2644
2788
|
} | {
|
|
2645
2789
|
name: string;
|
|
@@ -3317,7 +3461,19 @@ declare const evalParametersSchema: z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodOb
|
|
|
3317
3461
|
content?: string | undefined;
|
|
3318
3462
|
}[] | undefined;
|
|
3319
3463
|
} | {
|
|
3320
|
-
content: string
|
|
3464
|
+
content: (string | {
|
|
3465
|
+
type: "text";
|
|
3466
|
+
text: string;
|
|
3467
|
+
cache_control?: {
|
|
3468
|
+
type: "ephemeral";
|
|
3469
|
+
} | undefined;
|
|
3470
|
+
}[]) & (string | {
|
|
3471
|
+
type: "text";
|
|
3472
|
+
text: string;
|
|
3473
|
+
cache_control?: {
|
|
3474
|
+
type: "ephemeral";
|
|
3475
|
+
} | undefined;
|
|
3476
|
+
}[] | undefined);
|
|
3321
3477
|
role: "tool";
|
|
3322
3478
|
tool_call_id: string;
|
|
3323
3479
|
} | {
|
|
@@ -3507,7 +3663,13 @@ declare const evalParametersSchema: z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodOb
|
|
|
3507
3663
|
}[] | null | undefined;
|
|
3508
3664
|
} | {
|
|
3509
3665
|
role: "tool";
|
|
3510
|
-
content?: string |
|
|
3666
|
+
content?: string | {
|
|
3667
|
+
type: "text";
|
|
3668
|
+
text?: string | undefined;
|
|
3669
|
+
cache_control?: {
|
|
3670
|
+
type: "ephemeral";
|
|
3671
|
+
} | undefined;
|
|
3672
|
+
}[] | undefined;
|
|
3511
3673
|
tool_call_id?: string | undefined;
|
|
3512
3674
|
} | {
|
|
3513
3675
|
name: string;
|
package/dev/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { TRANSACTION_ID_FIELD, TransactionId, ExperimentEvent, DEFAULT_IS_LEGACY_DATASET, DatasetRecord, ExperimentLogFullArgs, ExperimentLogPartialArgs, LogFeedbackFullArgs, SpanType, IdField, BackgroundLogEvent, Score } from '@braintrust/core';
|
|
2
|
-
import { GitMetadataSettings, Prompt as Prompt$1, PromptSessionEvent, PromptData, AnyModelParam, OpenAIMessage, Tools, Message, PromptBlockData, IfExists, SavedFunctionId, ToolFunctionDefinition, FunctionType, SSEProgressEventData, RepoInfo, ObjectReference } from '@braintrust/core/typespecs';
|
|
2
|
+
import { GitMetadataSettings, Prompt as Prompt$1, PromptSessionEvent, PromptData, AnyModelParam, OpenAIMessage, Tools, Message, PromptBlockData, IfExists, SavedFunctionId, ToolFunctionDefinition, FunctionType, functionDataSchema, SSEProgressEventData, RepoInfo, ObjectReference } from '@braintrust/core/typespecs';
|
|
3
3
|
import { z } from 'zod';
|
|
4
4
|
|
|
5
5
|
type GenericFunction<Input, Output> = ((input: Input) => Output) | ((input: Input) => Promise<Output>);
|
|
@@ -73,6 +73,10 @@ interface DiskCacheOptions {
|
|
|
73
73
|
*/
|
|
74
74
|
max?: number;
|
|
75
75
|
logWarnings?: boolean;
|
|
76
|
+
/**
|
|
77
|
+
* Whether to create the cache directory if it doesn't exist.
|
|
78
|
+
*/
|
|
79
|
+
mkdir?: boolean;
|
|
76
80
|
}
|
|
77
81
|
/**
|
|
78
82
|
* A persistent filesystem-based cache implementation.
|
|
@@ -90,13 +94,14 @@ interface DiskCacheOptions {
|
|
|
90
94
|
declare class DiskCache<T> {
|
|
91
95
|
private readonly dir;
|
|
92
96
|
private readonly max?;
|
|
97
|
+
private readonly mkdir;
|
|
93
98
|
private readonly logWarnings;
|
|
94
99
|
/**
|
|
95
100
|
* Creates a new DiskCache instance.
|
|
96
101
|
* @param options - Configuration options for the cache.
|
|
97
102
|
*/
|
|
98
103
|
constructor(options: DiskCacheOptions);
|
|
99
|
-
|
|
104
|
+
getEntryPath(key: string): string;
|
|
100
105
|
/**
|
|
101
106
|
* Retrieves a value from the cache.
|
|
102
107
|
* Updates the entry's access time when read.
|
|
@@ -304,7 +309,7 @@ interface Span extends Exportable {
|
|
|
304
309
|
* Links can be generated at any time, but they will only become viewable
|
|
305
310
|
* after the span and its root have been flushed to the server and ingested.
|
|
306
311
|
*
|
|
307
|
-
* There are
|
|
312
|
+
* There are some conditions when a Span doesn't have enough information
|
|
308
313
|
* to return a stable link (e.g. during an unresolved experiment). In this case
|
|
309
314
|
* or if there's an error generating link, we'll return a placeholder link.
|
|
310
315
|
*
|
|
@@ -1044,7 +1049,12 @@ declare class Project {
|
|
|
1044
1049
|
tools: ToolBuilder;
|
|
1045
1050
|
prompts: PromptBuilder;
|
|
1046
1051
|
scorers: ScorerBuilder;
|
|
1052
|
+
private _publishableCodeFunctions;
|
|
1053
|
+
private _publishablePrompts;
|
|
1047
1054
|
constructor(args: CreateProjectOpts);
|
|
1055
|
+
addPrompt(prompt: CodePrompt): void;
|
|
1056
|
+
addCodeFunction(fn: CodeFunction<any, any, GenericFunction<any, any>>): void;
|
|
1057
|
+
publish(): Promise<void>;
|
|
1048
1058
|
}
|
|
1049
1059
|
declare class ToolBuilder {
|
|
1050
1060
|
private readonly project;
|
|
@@ -1115,6 +1125,7 @@ declare class CodePrompt {
|
|
|
1115
1125
|
name: string;
|
|
1116
1126
|
slug: string;
|
|
1117
1127
|
}, functionType?: FunctionType);
|
|
1128
|
+
toFunctionDefinition(projectNameToId: ProjectNameIdMap): Promise<FunctionEvent>;
|
|
1118
1129
|
}
|
|
1119
1130
|
interface PromptId {
|
|
1120
1131
|
id: string;
|
|
@@ -1434,16 +1445,56 @@ declare const promptDefinitionSchema: z.ZodIntersection<z.ZodUnion<[z.ZodObject<
|
|
|
1434
1445
|
content?: string | null | undefined;
|
|
1435
1446
|
}[] | null | undefined;
|
|
1436
1447
|
}>, z.ZodObject<{
|
|
1437
|
-
content: z.ZodDefault<z.ZodString
|
|
1448
|
+
content: z.ZodUnion<[z.ZodDefault<z.ZodString>, z.ZodArray<z.ZodObject<{
|
|
1449
|
+
text: z.ZodDefault<z.ZodString>;
|
|
1450
|
+
type: z.ZodLiteral<"text">;
|
|
1451
|
+
cache_control: z.ZodOptional<z.ZodObject<{
|
|
1452
|
+
type: z.ZodEnum<["ephemeral"]>;
|
|
1453
|
+
}, "strip", z.ZodTypeAny, {
|
|
1454
|
+
type: "ephemeral";
|
|
1455
|
+
}, {
|
|
1456
|
+
type: "ephemeral";
|
|
1457
|
+
}>>;
|
|
1458
|
+
}, "strip", z.ZodTypeAny, {
|
|
1459
|
+
type: "text";
|
|
1460
|
+
text: string;
|
|
1461
|
+
cache_control?: {
|
|
1462
|
+
type: "ephemeral";
|
|
1463
|
+
} | undefined;
|
|
1464
|
+
}, {
|
|
1465
|
+
type: "text";
|
|
1466
|
+
text?: string | undefined;
|
|
1467
|
+
cache_control?: {
|
|
1468
|
+
type: "ephemeral";
|
|
1469
|
+
} | undefined;
|
|
1470
|
+
}>, "many">]>;
|
|
1438
1471
|
role: z.ZodLiteral<"tool">;
|
|
1439
1472
|
tool_call_id: z.ZodDefault<z.ZodString>;
|
|
1440
1473
|
}, "strip", z.ZodTypeAny, {
|
|
1441
|
-
content: string
|
|
1474
|
+
content: (string | {
|
|
1475
|
+
type: "text";
|
|
1476
|
+
text: string;
|
|
1477
|
+
cache_control?: {
|
|
1478
|
+
type: "ephemeral";
|
|
1479
|
+
} | undefined;
|
|
1480
|
+
}[]) & (string | {
|
|
1481
|
+
type: "text";
|
|
1482
|
+
text: string;
|
|
1483
|
+
cache_control?: {
|
|
1484
|
+
type: "ephemeral";
|
|
1485
|
+
} | undefined;
|
|
1486
|
+
}[] | undefined);
|
|
1442
1487
|
role: "tool";
|
|
1443
1488
|
tool_call_id: string;
|
|
1444
1489
|
}, {
|
|
1445
1490
|
role: "tool";
|
|
1446
|
-
content?: string |
|
|
1491
|
+
content?: string | {
|
|
1492
|
+
type: "text";
|
|
1493
|
+
text?: string | undefined;
|
|
1494
|
+
cache_control?: {
|
|
1495
|
+
type: "ephemeral";
|
|
1496
|
+
} | undefined;
|
|
1497
|
+
}[] | undefined;
|
|
1447
1498
|
tool_call_id?: string | undefined;
|
|
1448
1499
|
}>, z.ZodObject<{
|
|
1449
1500
|
content: z.ZodNullable<z.ZodString>;
|
|
@@ -1539,7 +1590,19 @@ declare const promptDefinitionSchema: z.ZodIntersection<z.ZodUnion<[z.ZodObject<
|
|
|
1539
1590
|
content?: string | undefined;
|
|
1540
1591
|
}[] | undefined;
|
|
1541
1592
|
} | {
|
|
1542
|
-
content: string
|
|
1593
|
+
content: (string | {
|
|
1594
|
+
type: "text";
|
|
1595
|
+
text: string;
|
|
1596
|
+
cache_control?: {
|
|
1597
|
+
type: "ephemeral";
|
|
1598
|
+
} | undefined;
|
|
1599
|
+
}[]) & (string | {
|
|
1600
|
+
type: "text";
|
|
1601
|
+
text: string;
|
|
1602
|
+
cache_control?: {
|
|
1603
|
+
type: "ephemeral";
|
|
1604
|
+
} | undefined;
|
|
1605
|
+
}[] | undefined);
|
|
1543
1606
|
role: "tool";
|
|
1544
1607
|
tool_call_id: string;
|
|
1545
1608
|
} | {
|
|
@@ -1605,7 +1668,13 @@ declare const promptDefinitionSchema: z.ZodIntersection<z.ZodUnion<[z.ZodObject<
|
|
|
1605
1668
|
}[] | null | undefined;
|
|
1606
1669
|
} | {
|
|
1607
1670
|
role: "tool";
|
|
1608
|
-
content?: string |
|
|
1671
|
+
content?: string | {
|
|
1672
|
+
type: "text";
|
|
1673
|
+
text?: string | undefined;
|
|
1674
|
+
cache_control?: {
|
|
1675
|
+
type: "ephemeral";
|
|
1676
|
+
} | undefined;
|
|
1677
|
+
}[] | undefined;
|
|
1609
1678
|
tool_call_id?: string | undefined;
|
|
1610
1679
|
} | {
|
|
1611
1680
|
name: string;
|
|
@@ -2159,6 +2228,23 @@ declare class PromptBuilder {
|
|
|
2159
2228
|
constructor(project: Project);
|
|
2160
2229
|
create<HasId extends boolean = false, HasVersion extends boolean = false>(opts: PromptOpts<HasId, HasVersion>): Prompt<HasId, HasVersion>;
|
|
2161
2230
|
}
|
|
2231
|
+
interface FunctionEvent {
|
|
2232
|
+
project_id: string;
|
|
2233
|
+
slug: string;
|
|
2234
|
+
name: string;
|
|
2235
|
+
description: string;
|
|
2236
|
+
prompt_data?: PromptData;
|
|
2237
|
+
function_data: z.infer<typeof functionDataSchema>;
|
|
2238
|
+
function_type?: FunctionType;
|
|
2239
|
+
if_exists?: IfExists;
|
|
2240
|
+
}
|
|
2241
|
+
declare class ProjectNameIdMap {
|
|
2242
|
+
private nameToId;
|
|
2243
|
+
private idToName;
|
|
2244
|
+
getId(projectName: string): Promise<string>;
|
|
2245
|
+
getName(projectId: string): Promise<string>;
|
|
2246
|
+
resolve(project: Project): Promise<string>;
|
|
2247
|
+
}
|
|
2162
2248
|
|
|
2163
2249
|
declare const evalParametersSchema: z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodObject<{
|
|
2164
2250
|
type: z.ZodLiteral<"prompt">;
|
|
@@ -2468,16 +2554,56 @@ declare const evalParametersSchema: z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodOb
|
|
|
2468
2554
|
content?: string | null | undefined;
|
|
2469
2555
|
}[] | null | undefined;
|
|
2470
2556
|
}>, z.ZodObject<{
|
|
2471
|
-
content: z.ZodDefault<z.ZodString
|
|
2557
|
+
content: z.ZodUnion<[z.ZodDefault<z.ZodString>, z.ZodArray<z.ZodObject<{
|
|
2558
|
+
text: z.ZodDefault<z.ZodString>;
|
|
2559
|
+
type: z.ZodLiteral<"text">;
|
|
2560
|
+
cache_control: z.ZodOptional<z.ZodObject<{
|
|
2561
|
+
type: z.ZodEnum<["ephemeral"]>;
|
|
2562
|
+
}, "strip", z.ZodTypeAny, {
|
|
2563
|
+
type: "ephemeral";
|
|
2564
|
+
}, {
|
|
2565
|
+
type: "ephemeral";
|
|
2566
|
+
}>>;
|
|
2567
|
+
}, "strip", z.ZodTypeAny, {
|
|
2568
|
+
type: "text";
|
|
2569
|
+
text: string;
|
|
2570
|
+
cache_control?: {
|
|
2571
|
+
type: "ephemeral";
|
|
2572
|
+
} | undefined;
|
|
2573
|
+
}, {
|
|
2574
|
+
type: "text";
|
|
2575
|
+
text?: string | undefined;
|
|
2576
|
+
cache_control?: {
|
|
2577
|
+
type: "ephemeral";
|
|
2578
|
+
} | undefined;
|
|
2579
|
+
}>, "many">]>;
|
|
2472
2580
|
role: z.ZodLiteral<"tool">;
|
|
2473
2581
|
tool_call_id: z.ZodDefault<z.ZodString>;
|
|
2474
2582
|
}, "strip", z.ZodTypeAny, {
|
|
2475
|
-
content: string
|
|
2583
|
+
content: (string | {
|
|
2584
|
+
type: "text";
|
|
2585
|
+
text: string;
|
|
2586
|
+
cache_control?: {
|
|
2587
|
+
type: "ephemeral";
|
|
2588
|
+
} | undefined;
|
|
2589
|
+
}[]) & (string | {
|
|
2590
|
+
type: "text";
|
|
2591
|
+
text: string;
|
|
2592
|
+
cache_control?: {
|
|
2593
|
+
type: "ephemeral";
|
|
2594
|
+
} | undefined;
|
|
2595
|
+
}[] | undefined);
|
|
2476
2596
|
role: "tool";
|
|
2477
2597
|
tool_call_id: string;
|
|
2478
2598
|
}, {
|
|
2479
2599
|
role: "tool";
|
|
2480
|
-
content?: string |
|
|
2600
|
+
content?: string | {
|
|
2601
|
+
type: "text";
|
|
2602
|
+
text?: string | undefined;
|
|
2603
|
+
cache_control?: {
|
|
2604
|
+
type: "ephemeral";
|
|
2605
|
+
} | undefined;
|
|
2606
|
+
}[] | undefined;
|
|
2481
2607
|
tool_call_id?: string | undefined;
|
|
2482
2608
|
}>, z.ZodObject<{
|
|
2483
2609
|
content: z.ZodNullable<z.ZodString>;
|
|
@@ -2573,7 +2699,19 @@ declare const evalParametersSchema: z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodOb
|
|
|
2573
2699
|
content?: string | undefined;
|
|
2574
2700
|
}[] | undefined;
|
|
2575
2701
|
} | {
|
|
2576
|
-
content: string
|
|
2702
|
+
content: (string | {
|
|
2703
|
+
type: "text";
|
|
2704
|
+
text: string;
|
|
2705
|
+
cache_control?: {
|
|
2706
|
+
type: "ephemeral";
|
|
2707
|
+
} | undefined;
|
|
2708
|
+
}[]) & (string | {
|
|
2709
|
+
type: "text";
|
|
2710
|
+
text: string;
|
|
2711
|
+
cache_control?: {
|
|
2712
|
+
type: "ephemeral";
|
|
2713
|
+
} | undefined;
|
|
2714
|
+
}[] | undefined);
|
|
2577
2715
|
role: "tool";
|
|
2578
2716
|
tool_call_id: string;
|
|
2579
2717
|
} | {
|
|
@@ -2639,7 +2777,13 @@ declare const evalParametersSchema: z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodOb
|
|
|
2639
2777
|
}[] | null | undefined;
|
|
2640
2778
|
} | {
|
|
2641
2779
|
role: "tool";
|
|
2642
|
-
content?: string |
|
|
2780
|
+
content?: string | {
|
|
2781
|
+
type: "text";
|
|
2782
|
+
text?: string | undefined;
|
|
2783
|
+
cache_control?: {
|
|
2784
|
+
type: "ephemeral";
|
|
2785
|
+
} | undefined;
|
|
2786
|
+
}[] | undefined;
|
|
2643
2787
|
tool_call_id?: string | undefined;
|
|
2644
2788
|
} | {
|
|
2645
2789
|
name: string;
|
|
@@ -3317,7 +3461,19 @@ declare const evalParametersSchema: z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodOb
|
|
|
3317
3461
|
content?: string | undefined;
|
|
3318
3462
|
}[] | undefined;
|
|
3319
3463
|
} | {
|
|
3320
|
-
content: string
|
|
3464
|
+
content: (string | {
|
|
3465
|
+
type: "text";
|
|
3466
|
+
text: string;
|
|
3467
|
+
cache_control?: {
|
|
3468
|
+
type: "ephemeral";
|
|
3469
|
+
} | undefined;
|
|
3470
|
+
}[]) & (string | {
|
|
3471
|
+
type: "text";
|
|
3472
|
+
text: string;
|
|
3473
|
+
cache_control?: {
|
|
3474
|
+
type: "ephemeral";
|
|
3475
|
+
} | undefined;
|
|
3476
|
+
}[] | undefined);
|
|
3321
3477
|
role: "tool";
|
|
3322
3478
|
tool_call_id: string;
|
|
3323
3479
|
} | {
|
|
@@ -3507,7 +3663,13 @@ declare const evalParametersSchema: z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodOb
|
|
|
3507
3663
|
}[] | null | undefined;
|
|
3508
3664
|
} | {
|
|
3509
3665
|
role: "tool";
|
|
3510
|
-
content?: string |
|
|
3666
|
+
content?: string | {
|
|
3667
|
+
type: "text";
|
|
3668
|
+
text?: string | undefined;
|
|
3669
|
+
cache_control?: {
|
|
3670
|
+
type: "ephemeral";
|
|
3671
|
+
} | undefined;
|
|
3672
|
+
}[] | undefined;
|
|
3511
3673
|
tool_call_id?: string | undefined;
|
|
3512
3674
|
} | {
|
|
3513
3675
|
name: string;
|