@runtypelabs/sdk 1.15.3 → 1.16.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/index.cjs +33 -11
- package/dist/index.d.cts +100 -20
- package/dist/index.d.ts +100 -20
- package/dist/index.mjs +33 -11
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -991,18 +991,19 @@ var RuntypeFlowBuilder = class {
|
|
|
991
991
|
const { streamEvents: streamEvents2 } = await Promise.resolve().then(() => (init_stream_utils(), stream_utils_exports));
|
|
992
992
|
try {
|
|
993
993
|
for await (const event of streamEvents2(response)) {
|
|
994
|
-
|
|
994
|
+
const awaitEvent = event;
|
|
995
|
+
if (awaitEvent.type === "flow_await") {
|
|
995
996
|
pausedState = {
|
|
996
|
-
toolName:
|
|
997
|
-
parameters:
|
|
998
|
-
executionId:
|
|
997
|
+
toolName: awaitEvent.toolName || "",
|
|
998
|
+
parameters: awaitEvent.parameters,
|
|
999
|
+
executionId: awaitEvent.executionId || ""
|
|
999
1000
|
};
|
|
1000
1001
|
}
|
|
1001
|
-
if (
|
|
1002
|
+
if (awaitEvent.type === "step_await") {
|
|
1002
1003
|
pausedState = {
|
|
1003
|
-
toolName:
|
|
1004
|
-
parameters:
|
|
1005
|
-
executionId:
|
|
1004
|
+
toolName: awaitEvent.toolName || "",
|
|
1005
|
+
parameters: awaitEvent.parameters,
|
|
1006
|
+
executionId: awaitEvent.executionId || ""
|
|
1006
1007
|
};
|
|
1007
1008
|
}
|
|
1008
1009
|
switch (event.type) {
|
|
@@ -1013,7 +1014,7 @@ var RuntypeFlowBuilder = class {
|
|
|
1013
1014
|
wrappedCallbacks.onStepStart?.(event);
|
|
1014
1015
|
break;
|
|
1015
1016
|
case "step_delta": {
|
|
1016
|
-
const chunkText =
|
|
1017
|
+
const chunkText = awaitEvent.chunk || awaitEvent.text || "";
|
|
1017
1018
|
wrappedCallbacks.onStepChunk?.(chunkText, event);
|
|
1018
1019
|
break;
|
|
1019
1020
|
}
|
|
@@ -1071,8 +1072,9 @@ var RuntypeFlowBuilder = class {
|
|
|
1071
1072
|
new Response(JSON.stringify(result), { headers: { "content-type": "application/json" } })
|
|
1072
1073
|
);
|
|
1073
1074
|
}
|
|
1074
|
-
|
|
1075
|
-
|
|
1075
|
+
const pausedResult = result;
|
|
1076
|
+
if (pausedResult.status === "paused" && pausedResult.pausedReason?.type === "local_action") {
|
|
1077
|
+
const { toolName, parameters, executionId } = pausedResult.pausedReason;
|
|
1076
1078
|
if (!localTools[toolName]) {
|
|
1077
1079
|
throw new Error(`Local tool "${toolName}" required but not provided in localTools map`);
|
|
1078
1080
|
}
|
|
@@ -1527,6 +1529,21 @@ var PromptRunner = class {
|
|
|
1527
1529
|
if (this.options.temperature !== void 0) {
|
|
1528
1530
|
payload.temperature = this.options.temperature;
|
|
1529
1531
|
}
|
|
1532
|
+
if (this.options.topP !== void 0) {
|
|
1533
|
+
payload.topP = this.options.topP;
|
|
1534
|
+
}
|
|
1535
|
+
if (this.options.topK !== void 0) {
|
|
1536
|
+
payload.topK = this.options.topK;
|
|
1537
|
+
}
|
|
1538
|
+
if (this.options.frequencyPenalty !== void 0) {
|
|
1539
|
+
payload.frequencyPenalty = this.options.frequencyPenalty;
|
|
1540
|
+
}
|
|
1541
|
+
if (this.options.presencePenalty !== void 0) {
|
|
1542
|
+
payload.presencePenalty = this.options.presencePenalty;
|
|
1543
|
+
}
|
|
1544
|
+
if (this.options.seed !== void 0) {
|
|
1545
|
+
payload.seed = this.options.seed;
|
|
1546
|
+
}
|
|
1530
1547
|
if (this.options.maxTokens !== void 0) {
|
|
1531
1548
|
payload.maxTokens = this.options.maxTokens;
|
|
1532
1549
|
}
|
|
@@ -7103,6 +7120,11 @@ var FlowBuilder = class {
|
|
|
7103
7120
|
outputVariable: config.outputVariable,
|
|
7104
7121
|
responseFormat: config.responseFormat,
|
|
7105
7122
|
temperature: config.temperature,
|
|
7123
|
+
topP: config.topP,
|
|
7124
|
+
topK: config.topK,
|
|
7125
|
+
frequencyPenalty: config.frequencyPenalty,
|
|
7126
|
+
presencePenalty: config.presencePenalty,
|
|
7127
|
+
seed: config.seed,
|
|
7106
7128
|
maxTokens: config.maxTokens,
|
|
7107
7129
|
reasoning: config.reasoning,
|
|
7108
7130
|
streamOutput: config.streamOutput,
|
package/dist/index.d.cts
CHANGED
|
@@ -788,6 +788,11 @@ interface ModelFallback extends BaseFallback {
|
|
|
788
788
|
model: string;
|
|
789
789
|
temperature?: number;
|
|
790
790
|
maxTokens?: number;
|
|
791
|
+
topP?: number;
|
|
792
|
+
topK?: number;
|
|
793
|
+
frequencyPenalty?: number;
|
|
794
|
+
presencePenalty?: number;
|
|
795
|
+
seed?: number;
|
|
791
796
|
}
|
|
792
797
|
/**
|
|
793
798
|
* Step fallback for context steps - run a different step type
|
|
@@ -795,7 +800,7 @@ interface ModelFallback extends BaseFallback {
|
|
|
795
800
|
interface StepFallback extends BaseFallback {
|
|
796
801
|
type: 'step';
|
|
797
802
|
stepType: string;
|
|
798
|
-
stepConfig: Record<string,
|
|
803
|
+
stepConfig: Record<string, unknown>;
|
|
799
804
|
}
|
|
800
805
|
/**
|
|
801
806
|
* Flow fallback - call another flow
|
|
@@ -803,7 +808,7 @@ interface StepFallback extends BaseFallback {
|
|
|
803
808
|
interface FlowFallback extends BaseFallback {
|
|
804
809
|
type: 'flow';
|
|
805
810
|
flowId: string;
|
|
806
|
-
inputs?: Record<string,
|
|
811
|
+
inputs?: Record<string, unknown>;
|
|
807
812
|
}
|
|
808
813
|
/**
|
|
809
814
|
* Union of all prompt fallback types
|
|
@@ -860,6 +865,11 @@ interface PromptStepConfig$1 {
|
|
|
860
865
|
outputVariable?: string;
|
|
861
866
|
responseFormat?: 'text' | 'json';
|
|
862
867
|
temperature?: number;
|
|
868
|
+
topP?: number;
|
|
869
|
+
topK?: number;
|
|
870
|
+
frequencyPenalty?: number;
|
|
871
|
+
presencePenalty?: number;
|
|
872
|
+
seed?: number;
|
|
863
873
|
maxTokens?: number;
|
|
864
874
|
/**
|
|
865
875
|
* Enable reasoning/extended thinking for models that support it.
|
|
@@ -1702,7 +1712,7 @@ declare class FlowResult {
|
|
|
1702
1712
|
*/
|
|
1703
1713
|
|
|
1704
1714
|
interface LocalToolsOptions {
|
|
1705
|
-
localTools?: Record<string, (args:
|
|
1715
|
+
localTools?: Record<string, (args: unknown) => Promise<unknown>>;
|
|
1706
1716
|
}
|
|
1707
1717
|
interface FlowConfig {
|
|
1708
1718
|
name: string;
|
|
@@ -1718,7 +1728,7 @@ interface RecordConfig {
|
|
|
1718
1728
|
id?: number | string;
|
|
1719
1729
|
name?: string;
|
|
1720
1730
|
type?: string;
|
|
1721
|
-
metadata?:
|
|
1731
|
+
metadata?: JsonObject;
|
|
1722
1732
|
}
|
|
1723
1733
|
interface Message {
|
|
1724
1734
|
role: 'system' | 'user' | 'assistant';
|
|
@@ -1736,13 +1746,18 @@ interface PromptStepConfig {
|
|
|
1736
1746
|
outputVariable?: string;
|
|
1737
1747
|
responseFormat?: 'text' | 'json';
|
|
1738
1748
|
temperature?: number;
|
|
1749
|
+
topP?: number;
|
|
1750
|
+
topK?: number;
|
|
1751
|
+
frequencyPenalty?: number;
|
|
1752
|
+
presencePenalty?: number;
|
|
1753
|
+
seed?: number;
|
|
1739
1754
|
maxTokens?: number;
|
|
1740
1755
|
/** Enable reasoning/extended thinking. Use `true` for defaults or `ReasoningConfig` for fine-grained control */
|
|
1741
1756
|
reasoning?: boolean | ReasoningConfig;
|
|
1742
1757
|
streamOutput?: boolean;
|
|
1743
1758
|
tools?: {
|
|
1744
1759
|
toolIds?: string[];
|
|
1745
|
-
[key: string]:
|
|
1760
|
+
[key: string]: unknown;
|
|
1746
1761
|
};
|
|
1747
1762
|
/** Error handling configuration - supports simple mode or fallback chains */
|
|
1748
1763
|
errorHandling?: ErrorHandlingMode | PromptErrorHandling;
|
|
@@ -1760,7 +1775,7 @@ interface FetchUrlStepConfig {
|
|
|
1760
1775
|
fetchMethod?: 'http' | 'firecrawl';
|
|
1761
1776
|
firecrawl?: {
|
|
1762
1777
|
formats?: string[];
|
|
1763
|
-
[key: string]:
|
|
1778
|
+
[key: string]: unknown;
|
|
1764
1779
|
};
|
|
1765
1780
|
/** Error handling configuration - supports simple mode or fallback chains */
|
|
1766
1781
|
errorHandling?: ErrorHandlingMode | ContextErrorHandling;
|
|
@@ -1783,8 +1798,8 @@ interface SetVariableStepConfig {
|
|
|
1783
1798
|
interface ConditionalStepConfig {
|
|
1784
1799
|
name: string;
|
|
1785
1800
|
condition: string;
|
|
1786
|
-
trueSteps?:
|
|
1787
|
-
falseSteps?:
|
|
1801
|
+
trueSteps?: unknown[];
|
|
1802
|
+
falseSteps?: unknown[];
|
|
1788
1803
|
enabled?: boolean;
|
|
1789
1804
|
}
|
|
1790
1805
|
interface SearchStepConfig {
|
|
@@ -1878,7 +1893,7 @@ interface SendEventStepConfig {
|
|
|
1878
1893
|
name: string;
|
|
1879
1894
|
provider: string;
|
|
1880
1895
|
eventName: string;
|
|
1881
|
-
properties?: Record<string,
|
|
1896
|
+
properties?: Record<string, unknown>;
|
|
1882
1897
|
outputVariable?: string;
|
|
1883
1898
|
/** Error handling configuration - supports simple mode or fallback chains */
|
|
1884
1899
|
errorHandling?: ErrorHandlingMode | ContextErrorHandling;
|
|
@@ -2124,7 +2139,7 @@ declare class RuntypeFlowBuilder {
|
|
|
2124
2139
|
* @param localTools - Map of tool names to async functions that execute the tool logic
|
|
2125
2140
|
* @returns The final result of the flow execution
|
|
2126
2141
|
*/
|
|
2127
|
-
runWithLocalTools(localTools: Record<string, (args:
|
|
2142
|
+
runWithLocalTools(localTools: Record<string, (args: unknown) => Promise<unknown>>, callbacks?: StreamCallbacks): Promise<FlowResult>;
|
|
2128
2143
|
build(): DispatchRequest;
|
|
2129
2144
|
private addStep;
|
|
2130
2145
|
}
|
|
@@ -2275,6 +2290,16 @@ interface ModelOverride$1 {
|
|
|
2275
2290
|
model: string;
|
|
2276
2291
|
/** Optional temperature override */
|
|
2277
2292
|
temperature?: number;
|
|
2293
|
+
/** Optional top-p (nucleus sampling) override */
|
|
2294
|
+
topP?: number;
|
|
2295
|
+
/** Optional top-k override */
|
|
2296
|
+
topK?: number;
|
|
2297
|
+
/** Optional frequency penalty override */
|
|
2298
|
+
frequencyPenalty?: number;
|
|
2299
|
+
/** Optional presence penalty override */
|
|
2300
|
+
presencePenalty?: number;
|
|
2301
|
+
/** Optional seed override */
|
|
2302
|
+
seed?: number;
|
|
2278
2303
|
/** Optional max tokens override */
|
|
2279
2304
|
maxTokens?: number;
|
|
2280
2305
|
}
|
|
@@ -2284,7 +2309,7 @@ interface EvalRunConfig {
|
|
|
2284
2309
|
/** Virtual flow definition (alternative to flowId) */
|
|
2285
2310
|
flow?: {
|
|
2286
2311
|
name: string;
|
|
2287
|
-
steps:
|
|
2312
|
+
steps: unknown[];
|
|
2288
2313
|
};
|
|
2289
2314
|
/** Record type to evaluate against */
|
|
2290
2315
|
recordType?: string;
|
|
@@ -2292,7 +2317,7 @@ interface EvalRunConfig {
|
|
|
2292
2317
|
records?: Array<{
|
|
2293
2318
|
name: string;
|
|
2294
2319
|
type: string;
|
|
2295
|
-
metadata: Record<string,
|
|
2320
|
+
metadata: Record<string, unknown>;
|
|
2296
2321
|
}>;
|
|
2297
2322
|
/** Model overrides for single-model evaluation */
|
|
2298
2323
|
models?: ModelOverride$1[];
|
|
@@ -2307,7 +2332,7 @@ interface EvalRunConfig {
|
|
|
2307
2332
|
/** Continue on individual record failures */
|
|
2308
2333
|
continueOnError?: boolean;
|
|
2309
2334
|
/** Optional filter for records */
|
|
2310
|
-
filter?: Record<string,
|
|
2335
|
+
filter?: Record<string, unknown>;
|
|
2311
2336
|
/** Optional limit on number of records */
|
|
2312
2337
|
limit?: number;
|
|
2313
2338
|
}
|
|
@@ -2322,7 +2347,7 @@ interface EvalStatus {
|
|
|
2322
2347
|
records: Array<{
|
|
2323
2348
|
recordId: string;
|
|
2324
2349
|
status: 'success' | 'error';
|
|
2325
|
-
result?:
|
|
2350
|
+
result?: unknown;
|
|
2326
2351
|
error?: string;
|
|
2327
2352
|
executionTime: number;
|
|
2328
2353
|
}>;
|
|
@@ -2486,6 +2511,16 @@ interface CreatePromptData {
|
|
|
2486
2511
|
responseFormat?: 'text' | 'json' | 'markdown';
|
|
2487
2512
|
/** Temperature */
|
|
2488
2513
|
temperature?: number;
|
|
2514
|
+
/** Top-p (nucleus) sampling */
|
|
2515
|
+
topP?: number;
|
|
2516
|
+
/** Top-k sampling */
|
|
2517
|
+
topK?: number;
|
|
2518
|
+
/** Frequency penalty */
|
|
2519
|
+
frequencyPenalty?: number;
|
|
2520
|
+
/** Presence penalty */
|
|
2521
|
+
presencePenalty?: number;
|
|
2522
|
+
/** Seed for reproducible sampling */
|
|
2523
|
+
seed?: number;
|
|
2489
2524
|
/** Max tokens */
|
|
2490
2525
|
maxTokens?: number;
|
|
2491
2526
|
/** Enable reasoning/extended thinking. Use `true` for defaults or `ReasoningConfig` for fine-grained control */
|
|
@@ -2508,6 +2543,16 @@ interface UpdatePromptData {
|
|
|
2508
2543
|
responseFormat?: 'text' | 'json' | 'markdown';
|
|
2509
2544
|
/** Temperature */
|
|
2510
2545
|
temperature?: number;
|
|
2546
|
+
/** Top-p (nucleus) sampling */
|
|
2547
|
+
topP?: number;
|
|
2548
|
+
/** Top-k sampling */
|
|
2549
|
+
topK?: number;
|
|
2550
|
+
/** Frequency penalty */
|
|
2551
|
+
frequencyPenalty?: number;
|
|
2552
|
+
/** Presence penalty */
|
|
2553
|
+
presencePenalty?: number;
|
|
2554
|
+
/** Seed for reproducible sampling */
|
|
2555
|
+
seed?: number;
|
|
2511
2556
|
/** Max tokens */
|
|
2512
2557
|
maxTokens?: number;
|
|
2513
2558
|
/** Enable reasoning/extended thinking. Use `true` for defaults or `ReasoningConfig` for fine-grained control */
|
|
@@ -2523,6 +2568,11 @@ interface Prompt {
|
|
|
2523
2568
|
userPrompt: string;
|
|
2524
2569
|
responseFormat?: string;
|
|
2525
2570
|
temperature?: number;
|
|
2571
|
+
topP?: number;
|
|
2572
|
+
topK?: number;
|
|
2573
|
+
frequencyPenalty?: number;
|
|
2574
|
+
presencePenalty?: number;
|
|
2575
|
+
seed?: number;
|
|
2526
2576
|
maxTokens?: number;
|
|
2527
2577
|
reasoning?: boolean | ReasoningConfig;
|
|
2528
2578
|
createdAt: string;
|
|
@@ -2535,12 +2585,22 @@ interface PromptRunOptions {
|
|
|
2535
2585
|
record?: {
|
|
2536
2586
|
name?: string;
|
|
2537
2587
|
type?: string;
|
|
2538
|
-
metadata?: Record<string,
|
|
2588
|
+
metadata?: Record<string, unknown>;
|
|
2539
2589
|
};
|
|
2540
2590
|
/** Model override */
|
|
2541
2591
|
modelOverride?: string;
|
|
2542
2592
|
/** Temperature override */
|
|
2543
2593
|
temperature?: number;
|
|
2594
|
+
/** Top-p (nucleus) sampling override */
|
|
2595
|
+
topP?: number;
|
|
2596
|
+
/** Top-k sampling override */
|
|
2597
|
+
topK?: number;
|
|
2598
|
+
/** Frequency penalty override */
|
|
2599
|
+
frequencyPenalty?: number;
|
|
2600
|
+
/** Presence penalty override */
|
|
2601
|
+
presencePenalty?: number;
|
|
2602
|
+
/** Seed override */
|
|
2603
|
+
seed?: number;
|
|
2544
2604
|
/** Max tokens override */
|
|
2545
2605
|
maxTokens?: number;
|
|
2546
2606
|
/** Store the result */
|
|
@@ -4241,6 +4301,16 @@ interface AgentExecuteRequest {
|
|
|
4241
4301
|
debugMode?: boolean;
|
|
4242
4302
|
/** Model ID to use for this session (overrides agent config) */
|
|
4243
4303
|
model?: string;
|
|
4304
|
+
/** Nucleus sampling override */
|
|
4305
|
+
topP?: number;
|
|
4306
|
+
/** Top-k sampling override */
|
|
4307
|
+
topK?: number;
|
|
4308
|
+
/** Frequency penalty override */
|
|
4309
|
+
frequencyPenalty?: number;
|
|
4310
|
+
/** Presence penalty override */
|
|
4311
|
+
presencePenalty?: number;
|
|
4312
|
+
/** Deterministic seed override */
|
|
4313
|
+
seed?: number;
|
|
4244
4314
|
/** Enable reasoning/thinking for models that support it (e.g. Gemini 3, o-series) */
|
|
4245
4315
|
reasoning?: boolean;
|
|
4246
4316
|
/** Runtime tools to make available during execution */
|
|
@@ -5196,6 +5266,16 @@ interface ModelOverride {
|
|
|
5196
5266
|
model: string;
|
|
5197
5267
|
/** Optional temperature override */
|
|
5198
5268
|
temperature?: number;
|
|
5269
|
+
/** Optional top-p override */
|
|
5270
|
+
topP?: number;
|
|
5271
|
+
/** Optional top-k override */
|
|
5272
|
+
topK?: number;
|
|
5273
|
+
/** Optional frequency penalty override */
|
|
5274
|
+
frequencyPenalty?: number;
|
|
5275
|
+
/** Optional presence penalty override */
|
|
5276
|
+
presencePenalty?: number;
|
|
5277
|
+
/** Optional seed override */
|
|
5278
|
+
seed?: number;
|
|
5199
5279
|
/** Optional max tokens override */
|
|
5200
5280
|
maxTokens?: number;
|
|
5201
5281
|
}
|
|
@@ -5215,7 +5295,7 @@ interface EvalRecord {
|
|
|
5215
5295
|
/** Record type */
|
|
5216
5296
|
type: string;
|
|
5217
5297
|
/** Record metadata */
|
|
5218
|
-
metadata: Record<string,
|
|
5298
|
+
metadata: Record<string, unknown>;
|
|
5219
5299
|
}
|
|
5220
5300
|
interface EvalRequest {
|
|
5221
5301
|
/** Flow ID (for existing flow) */
|
|
@@ -5223,7 +5303,7 @@ interface EvalRequest {
|
|
|
5223
5303
|
/** Virtual flow definition */
|
|
5224
5304
|
flow?: {
|
|
5225
5305
|
name: string;
|
|
5226
|
-
steps:
|
|
5306
|
+
steps: unknown[];
|
|
5227
5307
|
};
|
|
5228
5308
|
/** Record type to evaluate against */
|
|
5229
5309
|
recordType?: string;
|
|
@@ -5236,7 +5316,7 @@ interface EvalRequest {
|
|
|
5236
5316
|
/** Eval options */
|
|
5237
5317
|
options?: EvalOptions;
|
|
5238
5318
|
/** Optional filter for records */
|
|
5239
|
-
filter?: Record<string,
|
|
5319
|
+
filter?: Record<string, unknown>;
|
|
5240
5320
|
/** Optional limit on number of records */
|
|
5241
5321
|
limit?: number;
|
|
5242
5322
|
}
|
|
@@ -5252,7 +5332,7 @@ interface EvalResult {
|
|
|
5252
5332
|
records: Array<{
|
|
5253
5333
|
recordId: string;
|
|
5254
5334
|
status: 'success' | 'error';
|
|
5255
|
-
result?:
|
|
5335
|
+
result?: unknown;
|
|
5256
5336
|
error?: string;
|
|
5257
5337
|
executionTime: number;
|
|
5258
5338
|
}>;
|
|
@@ -5335,7 +5415,7 @@ declare class EvalBuilder {
|
|
|
5335
5415
|
/**
|
|
5336
5416
|
* Filter records to evaluate
|
|
5337
5417
|
*/
|
|
5338
|
-
withFilter(filter: Record<string,
|
|
5418
|
+
withFilter(filter: Record<string, unknown>): this;
|
|
5339
5419
|
/**
|
|
5340
5420
|
* Limit the number of records to evaluate
|
|
5341
5421
|
*/
|
package/dist/index.d.ts
CHANGED
|
@@ -788,6 +788,11 @@ interface ModelFallback extends BaseFallback {
|
|
|
788
788
|
model: string;
|
|
789
789
|
temperature?: number;
|
|
790
790
|
maxTokens?: number;
|
|
791
|
+
topP?: number;
|
|
792
|
+
topK?: number;
|
|
793
|
+
frequencyPenalty?: number;
|
|
794
|
+
presencePenalty?: number;
|
|
795
|
+
seed?: number;
|
|
791
796
|
}
|
|
792
797
|
/**
|
|
793
798
|
* Step fallback for context steps - run a different step type
|
|
@@ -795,7 +800,7 @@ interface ModelFallback extends BaseFallback {
|
|
|
795
800
|
interface StepFallback extends BaseFallback {
|
|
796
801
|
type: 'step';
|
|
797
802
|
stepType: string;
|
|
798
|
-
stepConfig: Record<string,
|
|
803
|
+
stepConfig: Record<string, unknown>;
|
|
799
804
|
}
|
|
800
805
|
/**
|
|
801
806
|
* Flow fallback - call another flow
|
|
@@ -803,7 +808,7 @@ interface StepFallback extends BaseFallback {
|
|
|
803
808
|
interface FlowFallback extends BaseFallback {
|
|
804
809
|
type: 'flow';
|
|
805
810
|
flowId: string;
|
|
806
|
-
inputs?: Record<string,
|
|
811
|
+
inputs?: Record<string, unknown>;
|
|
807
812
|
}
|
|
808
813
|
/**
|
|
809
814
|
* Union of all prompt fallback types
|
|
@@ -860,6 +865,11 @@ interface PromptStepConfig$1 {
|
|
|
860
865
|
outputVariable?: string;
|
|
861
866
|
responseFormat?: 'text' | 'json';
|
|
862
867
|
temperature?: number;
|
|
868
|
+
topP?: number;
|
|
869
|
+
topK?: number;
|
|
870
|
+
frequencyPenalty?: number;
|
|
871
|
+
presencePenalty?: number;
|
|
872
|
+
seed?: number;
|
|
863
873
|
maxTokens?: number;
|
|
864
874
|
/**
|
|
865
875
|
* Enable reasoning/extended thinking for models that support it.
|
|
@@ -1702,7 +1712,7 @@ declare class FlowResult {
|
|
|
1702
1712
|
*/
|
|
1703
1713
|
|
|
1704
1714
|
interface LocalToolsOptions {
|
|
1705
|
-
localTools?: Record<string, (args:
|
|
1715
|
+
localTools?: Record<string, (args: unknown) => Promise<unknown>>;
|
|
1706
1716
|
}
|
|
1707
1717
|
interface FlowConfig {
|
|
1708
1718
|
name: string;
|
|
@@ -1718,7 +1728,7 @@ interface RecordConfig {
|
|
|
1718
1728
|
id?: number | string;
|
|
1719
1729
|
name?: string;
|
|
1720
1730
|
type?: string;
|
|
1721
|
-
metadata?:
|
|
1731
|
+
metadata?: JsonObject;
|
|
1722
1732
|
}
|
|
1723
1733
|
interface Message {
|
|
1724
1734
|
role: 'system' | 'user' | 'assistant';
|
|
@@ -1736,13 +1746,18 @@ interface PromptStepConfig {
|
|
|
1736
1746
|
outputVariable?: string;
|
|
1737
1747
|
responseFormat?: 'text' | 'json';
|
|
1738
1748
|
temperature?: number;
|
|
1749
|
+
topP?: number;
|
|
1750
|
+
topK?: number;
|
|
1751
|
+
frequencyPenalty?: number;
|
|
1752
|
+
presencePenalty?: number;
|
|
1753
|
+
seed?: number;
|
|
1739
1754
|
maxTokens?: number;
|
|
1740
1755
|
/** Enable reasoning/extended thinking. Use `true` for defaults or `ReasoningConfig` for fine-grained control */
|
|
1741
1756
|
reasoning?: boolean | ReasoningConfig;
|
|
1742
1757
|
streamOutput?: boolean;
|
|
1743
1758
|
tools?: {
|
|
1744
1759
|
toolIds?: string[];
|
|
1745
|
-
[key: string]:
|
|
1760
|
+
[key: string]: unknown;
|
|
1746
1761
|
};
|
|
1747
1762
|
/** Error handling configuration - supports simple mode or fallback chains */
|
|
1748
1763
|
errorHandling?: ErrorHandlingMode | PromptErrorHandling;
|
|
@@ -1760,7 +1775,7 @@ interface FetchUrlStepConfig {
|
|
|
1760
1775
|
fetchMethod?: 'http' | 'firecrawl';
|
|
1761
1776
|
firecrawl?: {
|
|
1762
1777
|
formats?: string[];
|
|
1763
|
-
[key: string]:
|
|
1778
|
+
[key: string]: unknown;
|
|
1764
1779
|
};
|
|
1765
1780
|
/** Error handling configuration - supports simple mode or fallback chains */
|
|
1766
1781
|
errorHandling?: ErrorHandlingMode | ContextErrorHandling;
|
|
@@ -1783,8 +1798,8 @@ interface SetVariableStepConfig {
|
|
|
1783
1798
|
interface ConditionalStepConfig {
|
|
1784
1799
|
name: string;
|
|
1785
1800
|
condition: string;
|
|
1786
|
-
trueSteps?:
|
|
1787
|
-
falseSteps?:
|
|
1801
|
+
trueSteps?: unknown[];
|
|
1802
|
+
falseSteps?: unknown[];
|
|
1788
1803
|
enabled?: boolean;
|
|
1789
1804
|
}
|
|
1790
1805
|
interface SearchStepConfig {
|
|
@@ -1878,7 +1893,7 @@ interface SendEventStepConfig {
|
|
|
1878
1893
|
name: string;
|
|
1879
1894
|
provider: string;
|
|
1880
1895
|
eventName: string;
|
|
1881
|
-
properties?: Record<string,
|
|
1896
|
+
properties?: Record<string, unknown>;
|
|
1882
1897
|
outputVariable?: string;
|
|
1883
1898
|
/** Error handling configuration - supports simple mode or fallback chains */
|
|
1884
1899
|
errorHandling?: ErrorHandlingMode | ContextErrorHandling;
|
|
@@ -2124,7 +2139,7 @@ declare class RuntypeFlowBuilder {
|
|
|
2124
2139
|
* @param localTools - Map of tool names to async functions that execute the tool logic
|
|
2125
2140
|
* @returns The final result of the flow execution
|
|
2126
2141
|
*/
|
|
2127
|
-
runWithLocalTools(localTools: Record<string, (args:
|
|
2142
|
+
runWithLocalTools(localTools: Record<string, (args: unknown) => Promise<unknown>>, callbacks?: StreamCallbacks): Promise<FlowResult>;
|
|
2128
2143
|
build(): DispatchRequest;
|
|
2129
2144
|
private addStep;
|
|
2130
2145
|
}
|
|
@@ -2275,6 +2290,16 @@ interface ModelOverride$1 {
|
|
|
2275
2290
|
model: string;
|
|
2276
2291
|
/** Optional temperature override */
|
|
2277
2292
|
temperature?: number;
|
|
2293
|
+
/** Optional top-p (nucleus sampling) override */
|
|
2294
|
+
topP?: number;
|
|
2295
|
+
/** Optional top-k override */
|
|
2296
|
+
topK?: number;
|
|
2297
|
+
/** Optional frequency penalty override */
|
|
2298
|
+
frequencyPenalty?: number;
|
|
2299
|
+
/** Optional presence penalty override */
|
|
2300
|
+
presencePenalty?: number;
|
|
2301
|
+
/** Optional seed override */
|
|
2302
|
+
seed?: number;
|
|
2278
2303
|
/** Optional max tokens override */
|
|
2279
2304
|
maxTokens?: number;
|
|
2280
2305
|
}
|
|
@@ -2284,7 +2309,7 @@ interface EvalRunConfig {
|
|
|
2284
2309
|
/** Virtual flow definition (alternative to flowId) */
|
|
2285
2310
|
flow?: {
|
|
2286
2311
|
name: string;
|
|
2287
|
-
steps:
|
|
2312
|
+
steps: unknown[];
|
|
2288
2313
|
};
|
|
2289
2314
|
/** Record type to evaluate against */
|
|
2290
2315
|
recordType?: string;
|
|
@@ -2292,7 +2317,7 @@ interface EvalRunConfig {
|
|
|
2292
2317
|
records?: Array<{
|
|
2293
2318
|
name: string;
|
|
2294
2319
|
type: string;
|
|
2295
|
-
metadata: Record<string,
|
|
2320
|
+
metadata: Record<string, unknown>;
|
|
2296
2321
|
}>;
|
|
2297
2322
|
/** Model overrides for single-model evaluation */
|
|
2298
2323
|
models?: ModelOverride$1[];
|
|
@@ -2307,7 +2332,7 @@ interface EvalRunConfig {
|
|
|
2307
2332
|
/** Continue on individual record failures */
|
|
2308
2333
|
continueOnError?: boolean;
|
|
2309
2334
|
/** Optional filter for records */
|
|
2310
|
-
filter?: Record<string,
|
|
2335
|
+
filter?: Record<string, unknown>;
|
|
2311
2336
|
/** Optional limit on number of records */
|
|
2312
2337
|
limit?: number;
|
|
2313
2338
|
}
|
|
@@ -2322,7 +2347,7 @@ interface EvalStatus {
|
|
|
2322
2347
|
records: Array<{
|
|
2323
2348
|
recordId: string;
|
|
2324
2349
|
status: 'success' | 'error';
|
|
2325
|
-
result?:
|
|
2350
|
+
result?: unknown;
|
|
2326
2351
|
error?: string;
|
|
2327
2352
|
executionTime: number;
|
|
2328
2353
|
}>;
|
|
@@ -2486,6 +2511,16 @@ interface CreatePromptData {
|
|
|
2486
2511
|
responseFormat?: 'text' | 'json' | 'markdown';
|
|
2487
2512
|
/** Temperature */
|
|
2488
2513
|
temperature?: number;
|
|
2514
|
+
/** Top-p (nucleus) sampling */
|
|
2515
|
+
topP?: number;
|
|
2516
|
+
/** Top-k sampling */
|
|
2517
|
+
topK?: number;
|
|
2518
|
+
/** Frequency penalty */
|
|
2519
|
+
frequencyPenalty?: number;
|
|
2520
|
+
/** Presence penalty */
|
|
2521
|
+
presencePenalty?: number;
|
|
2522
|
+
/** Seed for reproducible sampling */
|
|
2523
|
+
seed?: number;
|
|
2489
2524
|
/** Max tokens */
|
|
2490
2525
|
maxTokens?: number;
|
|
2491
2526
|
/** Enable reasoning/extended thinking. Use `true` for defaults or `ReasoningConfig` for fine-grained control */
|
|
@@ -2508,6 +2543,16 @@ interface UpdatePromptData {
|
|
|
2508
2543
|
responseFormat?: 'text' | 'json' | 'markdown';
|
|
2509
2544
|
/** Temperature */
|
|
2510
2545
|
temperature?: number;
|
|
2546
|
+
/** Top-p (nucleus) sampling */
|
|
2547
|
+
topP?: number;
|
|
2548
|
+
/** Top-k sampling */
|
|
2549
|
+
topK?: number;
|
|
2550
|
+
/** Frequency penalty */
|
|
2551
|
+
frequencyPenalty?: number;
|
|
2552
|
+
/** Presence penalty */
|
|
2553
|
+
presencePenalty?: number;
|
|
2554
|
+
/** Seed for reproducible sampling */
|
|
2555
|
+
seed?: number;
|
|
2511
2556
|
/** Max tokens */
|
|
2512
2557
|
maxTokens?: number;
|
|
2513
2558
|
/** Enable reasoning/extended thinking. Use `true` for defaults or `ReasoningConfig` for fine-grained control */
|
|
@@ -2523,6 +2568,11 @@ interface Prompt {
|
|
|
2523
2568
|
userPrompt: string;
|
|
2524
2569
|
responseFormat?: string;
|
|
2525
2570
|
temperature?: number;
|
|
2571
|
+
topP?: number;
|
|
2572
|
+
topK?: number;
|
|
2573
|
+
frequencyPenalty?: number;
|
|
2574
|
+
presencePenalty?: number;
|
|
2575
|
+
seed?: number;
|
|
2526
2576
|
maxTokens?: number;
|
|
2527
2577
|
reasoning?: boolean | ReasoningConfig;
|
|
2528
2578
|
createdAt: string;
|
|
@@ -2535,12 +2585,22 @@ interface PromptRunOptions {
|
|
|
2535
2585
|
record?: {
|
|
2536
2586
|
name?: string;
|
|
2537
2587
|
type?: string;
|
|
2538
|
-
metadata?: Record<string,
|
|
2588
|
+
metadata?: Record<string, unknown>;
|
|
2539
2589
|
};
|
|
2540
2590
|
/** Model override */
|
|
2541
2591
|
modelOverride?: string;
|
|
2542
2592
|
/** Temperature override */
|
|
2543
2593
|
temperature?: number;
|
|
2594
|
+
/** Top-p (nucleus) sampling override */
|
|
2595
|
+
topP?: number;
|
|
2596
|
+
/** Top-k sampling override */
|
|
2597
|
+
topK?: number;
|
|
2598
|
+
/** Frequency penalty override */
|
|
2599
|
+
frequencyPenalty?: number;
|
|
2600
|
+
/** Presence penalty override */
|
|
2601
|
+
presencePenalty?: number;
|
|
2602
|
+
/** Seed override */
|
|
2603
|
+
seed?: number;
|
|
2544
2604
|
/** Max tokens override */
|
|
2545
2605
|
maxTokens?: number;
|
|
2546
2606
|
/** Store the result */
|
|
@@ -4241,6 +4301,16 @@ interface AgentExecuteRequest {
|
|
|
4241
4301
|
debugMode?: boolean;
|
|
4242
4302
|
/** Model ID to use for this session (overrides agent config) */
|
|
4243
4303
|
model?: string;
|
|
4304
|
+
/** Nucleus sampling override */
|
|
4305
|
+
topP?: number;
|
|
4306
|
+
/** Top-k sampling override */
|
|
4307
|
+
topK?: number;
|
|
4308
|
+
/** Frequency penalty override */
|
|
4309
|
+
frequencyPenalty?: number;
|
|
4310
|
+
/** Presence penalty override */
|
|
4311
|
+
presencePenalty?: number;
|
|
4312
|
+
/** Deterministic seed override */
|
|
4313
|
+
seed?: number;
|
|
4244
4314
|
/** Enable reasoning/thinking for models that support it (e.g. Gemini 3, o-series) */
|
|
4245
4315
|
reasoning?: boolean;
|
|
4246
4316
|
/** Runtime tools to make available during execution */
|
|
@@ -5196,6 +5266,16 @@ interface ModelOverride {
|
|
|
5196
5266
|
model: string;
|
|
5197
5267
|
/** Optional temperature override */
|
|
5198
5268
|
temperature?: number;
|
|
5269
|
+
/** Optional top-p override */
|
|
5270
|
+
topP?: number;
|
|
5271
|
+
/** Optional top-k override */
|
|
5272
|
+
topK?: number;
|
|
5273
|
+
/** Optional frequency penalty override */
|
|
5274
|
+
frequencyPenalty?: number;
|
|
5275
|
+
/** Optional presence penalty override */
|
|
5276
|
+
presencePenalty?: number;
|
|
5277
|
+
/** Optional seed override */
|
|
5278
|
+
seed?: number;
|
|
5199
5279
|
/** Optional max tokens override */
|
|
5200
5280
|
maxTokens?: number;
|
|
5201
5281
|
}
|
|
@@ -5215,7 +5295,7 @@ interface EvalRecord {
|
|
|
5215
5295
|
/** Record type */
|
|
5216
5296
|
type: string;
|
|
5217
5297
|
/** Record metadata */
|
|
5218
|
-
metadata: Record<string,
|
|
5298
|
+
metadata: Record<string, unknown>;
|
|
5219
5299
|
}
|
|
5220
5300
|
interface EvalRequest {
|
|
5221
5301
|
/** Flow ID (for existing flow) */
|
|
@@ -5223,7 +5303,7 @@ interface EvalRequest {
|
|
|
5223
5303
|
/** Virtual flow definition */
|
|
5224
5304
|
flow?: {
|
|
5225
5305
|
name: string;
|
|
5226
|
-
steps:
|
|
5306
|
+
steps: unknown[];
|
|
5227
5307
|
};
|
|
5228
5308
|
/** Record type to evaluate against */
|
|
5229
5309
|
recordType?: string;
|
|
@@ -5236,7 +5316,7 @@ interface EvalRequest {
|
|
|
5236
5316
|
/** Eval options */
|
|
5237
5317
|
options?: EvalOptions;
|
|
5238
5318
|
/** Optional filter for records */
|
|
5239
|
-
filter?: Record<string,
|
|
5319
|
+
filter?: Record<string, unknown>;
|
|
5240
5320
|
/** Optional limit on number of records */
|
|
5241
5321
|
limit?: number;
|
|
5242
5322
|
}
|
|
@@ -5252,7 +5332,7 @@ interface EvalResult {
|
|
|
5252
5332
|
records: Array<{
|
|
5253
5333
|
recordId: string;
|
|
5254
5334
|
status: 'success' | 'error';
|
|
5255
|
-
result?:
|
|
5335
|
+
result?: unknown;
|
|
5256
5336
|
error?: string;
|
|
5257
5337
|
executionTime: number;
|
|
5258
5338
|
}>;
|
|
@@ -5335,7 +5415,7 @@ declare class EvalBuilder {
|
|
|
5335
5415
|
/**
|
|
5336
5416
|
* Filter records to evaluate
|
|
5337
5417
|
*/
|
|
5338
|
-
withFilter(filter: Record<string,
|
|
5418
|
+
withFilter(filter: Record<string, unknown>): this;
|
|
5339
5419
|
/**
|
|
5340
5420
|
* Limit the number of records to evaluate
|
|
5341
5421
|
*/
|
package/dist/index.mjs
CHANGED
|
@@ -921,18 +921,19 @@ var RuntypeFlowBuilder = class {
|
|
|
921
921
|
const { streamEvents: streamEvents2 } = await Promise.resolve().then(() => (init_stream_utils(), stream_utils_exports));
|
|
922
922
|
try {
|
|
923
923
|
for await (const event of streamEvents2(response)) {
|
|
924
|
-
|
|
924
|
+
const awaitEvent = event;
|
|
925
|
+
if (awaitEvent.type === "flow_await") {
|
|
925
926
|
pausedState = {
|
|
926
|
-
toolName:
|
|
927
|
-
parameters:
|
|
928
|
-
executionId:
|
|
927
|
+
toolName: awaitEvent.toolName || "",
|
|
928
|
+
parameters: awaitEvent.parameters,
|
|
929
|
+
executionId: awaitEvent.executionId || ""
|
|
929
930
|
};
|
|
930
931
|
}
|
|
931
|
-
if (
|
|
932
|
+
if (awaitEvent.type === "step_await") {
|
|
932
933
|
pausedState = {
|
|
933
|
-
toolName:
|
|
934
|
-
parameters:
|
|
935
|
-
executionId:
|
|
934
|
+
toolName: awaitEvent.toolName || "",
|
|
935
|
+
parameters: awaitEvent.parameters,
|
|
936
|
+
executionId: awaitEvent.executionId || ""
|
|
936
937
|
};
|
|
937
938
|
}
|
|
938
939
|
switch (event.type) {
|
|
@@ -943,7 +944,7 @@ var RuntypeFlowBuilder = class {
|
|
|
943
944
|
wrappedCallbacks.onStepStart?.(event);
|
|
944
945
|
break;
|
|
945
946
|
case "step_delta": {
|
|
946
|
-
const chunkText =
|
|
947
|
+
const chunkText = awaitEvent.chunk || awaitEvent.text || "";
|
|
947
948
|
wrappedCallbacks.onStepChunk?.(chunkText, event);
|
|
948
949
|
break;
|
|
949
950
|
}
|
|
@@ -1001,8 +1002,9 @@ var RuntypeFlowBuilder = class {
|
|
|
1001
1002
|
new Response(JSON.stringify(result), { headers: { "content-type": "application/json" } })
|
|
1002
1003
|
);
|
|
1003
1004
|
}
|
|
1004
|
-
|
|
1005
|
-
|
|
1005
|
+
const pausedResult = result;
|
|
1006
|
+
if (pausedResult.status === "paused" && pausedResult.pausedReason?.type === "local_action") {
|
|
1007
|
+
const { toolName, parameters, executionId } = pausedResult.pausedReason;
|
|
1006
1008
|
if (!localTools[toolName]) {
|
|
1007
1009
|
throw new Error(`Local tool "${toolName}" required but not provided in localTools map`);
|
|
1008
1010
|
}
|
|
@@ -1457,6 +1459,21 @@ var PromptRunner = class {
|
|
|
1457
1459
|
if (this.options.temperature !== void 0) {
|
|
1458
1460
|
payload.temperature = this.options.temperature;
|
|
1459
1461
|
}
|
|
1462
|
+
if (this.options.topP !== void 0) {
|
|
1463
|
+
payload.topP = this.options.topP;
|
|
1464
|
+
}
|
|
1465
|
+
if (this.options.topK !== void 0) {
|
|
1466
|
+
payload.topK = this.options.topK;
|
|
1467
|
+
}
|
|
1468
|
+
if (this.options.frequencyPenalty !== void 0) {
|
|
1469
|
+
payload.frequencyPenalty = this.options.frequencyPenalty;
|
|
1470
|
+
}
|
|
1471
|
+
if (this.options.presencePenalty !== void 0) {
|
|
1472
|
+
payload.presencePenalty = this.options.presencePenalty;
|
|
1473
|
+
}
|
|
1474
|
+
if (this.options.seed !== void 0) {
|
|
1475
|
+
payload.seed = this.options.seed;
|
|
1476
|
+
}
|
|
1460
1477
|
if (this.options.maxTokens !== void 0) {
|
|
1461
1478
|
payload.maxTokens = this.options.maxTokens;
|
|
1462
1479
|
}
|
|
@@ -7033,6 +7050,11 @@ var FlowBuilder = class {
|
|
|
7033
7050
|
outputVariable: config.outputVariable,
|
|
7034
7051
|
responseFormat: config.responseFormat,
|
|
7035
7052
|
temperature: config.temperature,
|
|
7053
|
+
topP: config.topP,
|
|
7054
|
+
topK: config.topK,
|
|
7055
|
+
frequencyPenalty: config.frequencyPenalty,
|
|
7056
|
+
presencePenalty: config.presencePenalty,
|
|
7057
|
+
seed: config.seed,
|
|
7036
7058
|
maxTokens: config.maxTokens,
|
|
7037
7059
|
reasoning: config.reasoning,
|
|
7038
7060
|
streamOutput: config.streamOutput,
|
package/package.json
CHANGED