@modelrelay/sdk 4.0.0 → 5.3.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/README.md +19 -64
- package/dist/api-7TVb2cnl.d.cts +5319 -0
- package/dist/api-7TVb2cnl.d.ts +5319 -0
- package/dist/{api-CzFaWgs_.d.cts → api-B9x3HA3Z.d.cts} +10 -13
- package/dist/{api-CzFaWgs_.d.ts → api-B9x3HA3Z.d.ts} +10 -13
- package/dist/api-BRAJe_xm.d.cts +5315 -0
- package/dist/api-BRAJe_xm.d.ts +5315 -0
- package/dist/{api-jqOwvH6O.d.cts → api-HVh8Lusf.d.cts} +2650 -2111
- package/dist/{api-jqOwvH6O.d.ts → api-HVh8Lusf.d.ts} +2650 -2111
- package/dist/billing/index.d.cts +1 -1
- package/dist/billing/index.d.ts +1 -1
- package/dist/{chunk-EMQKOEF3.js → chunk-BL7GWXRZ.js} +1 -1
- package/dist/{chunk-ADQ74R7T.js → chunk-G5H7EY4F.js} +16 -14
- package/dist/{chunk-LW6SC7NQ.js → chunk-HLJAMT7F.js} +1 -1
- package/dist/{chunk-ZBQKY2W2.js → chunk-LZDGY24E.js} +2 -63
- package/dist/chunk-OJFVI3QJ.js +1133 -0
- package/dist/chunk-Z6R4G2TU.js +1133 -0
- package/dist/index.cjs +192 -504
- package/dist/index.d.cts +179 -623
- package/dist/index.d.ts +179 -623
- package/dist/index.js +185 -496
- package/dist/node.cjs +155 -2
- package/dist/node.d.cts +9 -0
- package/dist/node.d.ts +9 -0
- package/dist/node.js +155 -2
- package/dist/{tools-DAqAFZ8F.d.ts → tools-Db-F5rIL.d.cts} +6 -9
- package/dist/{tools-DAqAFZ8F.d.cts → tools-Db-F5rIL.d.ts} +6 -9
- package/package.json +1 -1
- package/dist/tools-Cnl2MgVa.d.cts +0 -1174
- package/dist/tools-Cnl2MgVa.d.ts +0 -1174
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { A as ApiKey, R as RetryConfig, M as MetricsCallbacks, T as TraceCallbacks, a as RequestContext, b as TokenProvider, C as CustomerTokenRequest, c as CustomerToken, G as GetOrCreateCustomerTokenRequest, P as ProviderId, d as ModelId, I as InputItem, O as OutputFormat, e as Tool, f as ToolChoice, Z as ZodLikeSchema, g as ResponseEvent, h as Response$1, S as StructuredJSONEvent, F as FieldError, i as RetryMetadata, j as TransportErrorKind, k as ToolRegistry, l as ToolExecutionResult, m as TierCode, n as SecretKey, o as ModelRelayKeyOptions, p as ModelRelayOptions } from './tools-bCt1QwNk.js';
|
|
2
2
|
export { ba as APICheckoutSession, b9 as APICustomerRef, bd as APIKey, bc as APIResponsesResponse, bb as APIUsage, ak as BillingProvider, aj as BillingProviders, aT as Citation, aL as CodeExecConfig, ay as ContentPart, ax as ContentPartType, aw as ContentPartTypes, al as CustomerMetadata, D as DEFAULT_BASE_URL, a7 as DEFAULT_CLIENT_HEADER, a8 as DEFAULT_CONNECT_TIMEOUT_MS, a9 as DEFAULT_REQUEST_TIMEOUT_MS, b8 as DeepPartial, aO as FunctionCall, b6 as FunctionCallDelta, aI as FunctionTool, aU as HttpRequestMetrics, aA as InputItemType, az as InputItemTypes, aS as JSONSchemaFormat, a2 as JsonSchemaOptions, ac as KnownStopReason, b3 as MessageDeltaData, av as MessageRole, au as MessageRoles, b2 as MessageStartData, b4 as MessageStopData, am as ModelRelayBaseOptions, an as ModelRelayTokenOptions, ao as ModelRelayTokenProviderOptions, aa as NonEmptyArray, aR as OutputFormatType, aQ as OutputFormatTypes, aD as OutputItem, aC as OutputItemType, aB as OutputItemTypes, at as Project, b1 as ResponseEventType, a5 as RetryOptions, a6 as SDK_VERSION, a3 as Schema, ad as StopReason, ab as StopReasons, aV as StreamFirstTokenMetrics, b7 as StructuredJSONRecordType, ai as SubscriptionStatusKind, ah as SubscriptionStatuses, ap as TokenType, aW as TokenUsageMetrics, X as ToolArgsError, aP as ToolCall, N as ToolCallAccumulator, b5 as ToolCallDelta, aN as ToolChoiceType, aM as ToolChoiceTypes, a4 as ToolHandler, aF as ToolType, aE as ToolTypes, aq as Usage, as as UsageSummary, aJ as WebSearchConfig, aH as WebToolIntent, aG as WebToolIntents, aK as XSearchConfig, af as asModelId, ae as asProviderId, ag as asTierCode, J as assistantMessageWithToolCalls, z as createAssistantMessage, L as createFunctionCall, q as createFunctionTool, r as createFunctionToolFromSchema, a0 as createRetryMessages, B as createSystemMessage, K as createToolCall, ar as createUsage, y as createUserMessage, s as createWebTool, a1 as executeWithRetry, x as firstToolCall, Y as formatToolErrorForModel, $ as getRetryableErrors, _ as hasRetryableErrors, w as hasToolCalls, aX as mergeMetrics, aY as mergeTrace, b0 as modelToString, a$ as normalizeModelId, aZ as normalizeStopReason, U as parseToolArgs, W as parseToolArgsRaw, H as respondToToolCall, a_ as stopReasonToString, t as toolChoiceAuto, v as toolChoiceNone, u as toolChoiceRequired, E as toolResultMessage, V as tryParseToolArgs, Q as zodToJsonSchema } from './tools-bCt1QwNk.js';
|
|
3
|
-
import { c as components, $ as $defs, o as operations, p as paths, w as webhooks } from './api-
|
|
3
|
+
import { c as components, $ as $defs, o as operations, p as paths, w as webhooks } from './api-7TVb2cnl.js';
|
|
4
4
|
|
|
5
5
|
interface RequestOptions {
|
|
6
6
|
method?: string;
|
|
@@ -652,146 +652,67 @@ declare function parsePlanHash(raw: string): PlanHash$1;
|
|
|
652
652
|
declare function parseOutputName(raw: string): OutputName$1;
|
|
653
653
|
|
|
654
654
|
declare const WorkflowKinds: {
|
|
655
|
-
readonly
|
|
655
|
+
readonly WorkflowIntent: "workflow";
|
|
656
656
|
};
|
|
657
|
-
type
|
|
658
|
-
type WorkflowKind =
|
|
659
|
-
declare const
|
|
660
|
-
readonly
|
|
661
|
-
readonly RouteSwitch: "route.switch";
|
|
657
|
+
type WorkflowKindIntent = (typeof WorkflowKinds)["WorkflowIntent"];
|
|
658
|
+
type WorkflowKind = WorkflowKindIntent;
|
|
659
|
+
declare const WorkflowNodeTypesLite: {
|
|
660
|
+
readonly LLM: "llm";
|
|
662
661
|
readonly JoinAll: "join.all";
|
|
663
662
|
readonly JoinAny: "join.any";
|
|
664
663
|
readonly JoinCollect: "join.collect";
|
|
665
664
|
readonly TransformJSON: "transform.json";
|
|
666
665
|
readonly MapFanout: "map.fanout";
|
|
667
666
|
};
|
|
668
|
-
type
|
|
669
|
-
type
|
|
670
|
-
type
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
667
|
+
type WorkflowNodeTypeLite = (typeof WorkflowNodeTypesLite)[keyof typeof WorkflowNodeTypesLite];
|
|
668
|
+
type WorkflowIntentConditionSource = "node_output" | "node_status";
|
|
669
|
+
type WorkflowIntentConditionOp = "equals" | "matches" | "exists";
|
|
670
|
+
type WorkflowIntentCondition = {
|
|
671
|
+
source: WorkflowIntentConditionSource;
|
|
672
|
+
op: WorkflowIntentConditionOp;
|
|
673
|
+
path?: string;
|
|
674
674
|
value?: unknown;
|
|
675
675
|
};
|
|
676
|
-
type
|
|
677
|
-
from: NodeId$1;
|
|
678
|
-
to: NodeId$1;
|
|
679
|
-
when?: ConditionV1$1;
|
|
680
|
-
};
|
|
681
|
-
type WorkflowOutputRefV1 = {
|
|
682
|
-
name: OutputName$1;
|
|
683
|
-
from: NodeId$1;
|
|
684
|
-
pointer?: string;
|
|
685
|
-
};
|
|
686
|
-
type WorkflowSpecV1 = {
|
|
687
|
-
kind: WorkflowKindV1;
|
|
688
|
-
name?: string;
|
|
689
|
-
execution?: {
|
|
690
|
-
max_parallelism?: number;
|
|
691
|
-
node_timeout_ms?: number;
|
|
692
|
-
run_timeout_ms?: number;
|
|
693
|
-
};
|
|
694
|
-
nodes: ReadonlyArray<WorkflowNodeV1>;
|
|
695
|
-
edges?: ReadonlyArray<WorkflowEdgeV1>;
|
|
696
|
-
outputs: ReadonlyArray<WorkflowOutputRefV1>;
|
|
697
|
-
};
|
|
698
|
-
type ToolExecutionModeV1$1 = "server" | "client";
|
|
699
|
-
type ToolExecutionV1$1 = {
|
|
700
|
-
mode: ToolExecutionModeV1$1;
|
|
701
|
-
};
|
|
702
|
-
type LLMResponsesToolLimitsV1 = {
|
|
703
|
-
max_llm_calls?: number;
|
|
704
|
-
max_tool_calls_per_step?: number;
|
|
705
|
-
wait_ttl_ms?: number;
|
|
706
|
-
};
|
|
707
|
-
type LLMResponsesBindingEncodingV1 = "json" | "json_string";
|
|
708
|
-
type LLMResponsesBindingV1 = {
|
|
676
|
+
type WorkflowIntentTransformValue = {
|
|
709
677
|
from: NodeId$1;
|
|
710
678
|
pointer?: string;
|
|
711
|
-
to?: string;
|
|
712
|
-
to_placeholder?: string;
|
|
713
|
-
encoding?: LLMResponsesBindingEncodingV1;
|
|
714
679
|
};
|
|
715
|
-
type
|
|
716
|
-
|
|
680
|
+
type WorkflowIntentNode = {
|
|
681
|
+
id: NodeId$1;
|
|
682
|
+
type: WorkflowNodeTypeLite;
|
|
683
|
+
depends_on?: ReadonlyArray<NodeId$1>;
|
|
684
|
+
model?: string;
|
|
685
|
+
system?: string;
|
|
686
|
+
user?: string;
|
|
687
|
+
input?: ReadonlyArray<InputItem>;
|
|
717
688
|
stream?: boolean;
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
};
|
|
722
|
-
type TransformJSONValueV1$1 = {
|
|
723
|
-
from: NodeId$1;
|
|
724
|
-
pointer?: string;
|
|
725
|
-
};
|
|
726
|
-
type TransformJSONNodeInputV1 = {
|
|
727
|
-
object?: Record<string, TransformJSONValueV1$1>;
|
|
728
|
-
merge?: Array<TransformJSONValueV1$1>;
|
|
729
|
-
};
|
|
730
|
-
type JoinAnyNodeInputV1 = {
|
|
731
|
-
predicate?: ConditionV1$1;
|
|
732
|
-
};
|
|
733
|
-
type JoinCollectNodeInputV1 = {
|
|
734
|
-
predicate?: ConditionV1$1;
|
|
689
|
+
tools?: ReadonlyArray<string | Tool>;
|
|
690
|
+
tool_execution?: {
|
|
691
|
+
mode: "server" | "client" | "agentic";
|
|
692
|
+
};
|
|
735
693
|
limit?: number;
|
|
736
694
|
timeout_ms?: number;
|
|
695
|
+
predicate?: WorkflowIntentCondition;
|
|
696
|
+
items_from?: NodeId$1;
|
|
697
|
+
items_from_input?: string;
|
|
698
|
+
items_pointer?: string;
|
|
699
|
+
items_path?: string;
|
|
700
|
+
subnode?: WorkflowIntentNode;
|
|
701
|
+
max_parallelism?: number;
|
|
702
|
+
object?: Record<string, WorkflowIntentTransformValue>;
|
|
703
|
+
merge?: Array<WorkflowIntentTransformValue>;
|
|
737
704
|
};
|
|
738
|
-
type
|
|
705
|
+
type WorkflowOutputRefLiteV1 = {
|
|
706
|
+
name: OutputName$1;
|
|
739
707
|
from: NodeId$1;
|
|
740
|
-
|
|
741
|
-
};
|
|
742
|
-
type MapFanoutItemBindingV1 = {
|
|
743
|
-
path?: string;
|
|
744
|
-
to?: string;
|
|
745
|
-
to_placeholder?: string;
|
|
746
|
-
encoding?: LLMResponsesBindingEncodingV1;
|
|
747
|
-
};
|
|
748
|
-
type MapFanoutSubNodeV1 = {
|
|
749
|
-
id: NodeId$1;
|
|
750
|
-
type: typeof WorkflowNodeTypesV1.LLMResponses;
|
|
751
|
-
input: LLMResponsesNodeInputV1;
|
|
752
|
-
} | {
|
|
753
|
-
id: NodeId$1;
|
|
754
|
-
type: typeof WorkflowNodeTypesV1.RouteSwitch;
|
|
755
|
-
input: LLMResponsesNodeInputV1;
|
|
756
|
-
} | {
|
|
757
|
-
id: NodeId$1;
|
|
758
|
-
type: typeof WorkflowNodeTypesV1.TransformJSON;
|
|
759
|
-
input: TransformJSONNodeInputV1;
|
|
760
|
-
};
|
|
761
|
-
type MapFanoutNodeInputV1 = {
|
|
762
|
-
items: MapFanoutItemsV1;
|
|
763
|
-
item_bindings?: ReadonlyArray<MapFanoutItemBindingV1>;
|
|
764
|
-
subnode: MapFanoutSubNodeV1;
|
|
765
|
-
max_parallelism?: number;
|
|
708
|
+
pointer?: string;
|
|
766
709
|
};
|
|
767
|
-
type
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
type: typeof WorkflowNodeTypesV1.RouteSwitch;
|
|
774
|
-
input: LLMResponsesNodeInputV1;
|
|
775
|
-
} | {
|
|
776
|
-
id: NodeId$1;
|
|
777
|
-
type: typeof WorkflowNodeTypesV1.JoinAll;
|
|
778
|
-
input?: Record<string, unknown>;
|
|
779
|
-
} | {
|
|
780
|
-
id: NodeId$1;
|
|
781
|
-
type: typeof WorkflowNodeTypesV1.JoinAny;
|
|
782
|
-
input?: JoinAnyNodeInputV1;
|
|
783
|
-
} | {
|
|
784
|
-
id: NodeId$1;
|
|
785
|
-
type: typeof WorkflowNodeTypesV1.JoinCollect;
|
|
786
|
-
input: JoinCollectNodeInputV1;
|
|
787
|
-
} | {
|
|
788
|
-
id: NodeId$1;
|
|
789
|
-
type: typeof WorkflowNodeTypesV1.TransformJSON;
|
|
790
|
-
input: TransformJSONNodeInputV1;
|
|
791
|
-
} | {
|
|
792
|
-
id: NodeId$1;
|
|
793
|
-
type: typeof WorkflowNodeTypesV1.MapFanout;
|
|
794
|
-
input: MapFanoutNodeInputV1;
|
|
710
|
+
type WorkflowSpecLiteV1 = {
|
|
711
|
+
kind: WorkflowKindIntent;
|
|
712
|
+
name?: string;
|
|
713
|
+
model?: string;
|
|
714
|
+
nodes: ReadonlyArray<WorkflowIntentNode>;
|
|
715
|
+
outputs: ReadonlyArray<WorkflowOutputRefLiteV1>;
|
|
795
716
|
};
|
|
796
717
|
type RunStatusV0 = "running" | "waiting" | "succeeded" | "failed" | "canceled";
|
|
797
718
|
type PayloadInfoV0$1 = {
|
|
@@ -1033,6 +954,7 @@ type RunsCreateOptions = {
|
|
|
1033
954
|
customerId?: string;
|
|
1034
955
|
sessionId?: string;
|
|
1035
956
|
idempotencyKey?: string;
|
|
957
|
+
input?: Record<string, unknown>;
|
|
1036
958
|
signal?: AbortSignal;
|
|
1037
959
|
headers?: Record<string, string>;
|
|
1038
960
|
timeoutMs?: number;
|
|
@@ -1093,7 +1015,7 @@ declare class RunsClient {
|
|
|
1093
1015
|
trace?: TraceCallbacks;
|
|
1094
1016
|
});
|
|
1095
1017
|
private applyCustomerHeader;
|
|
1096
|
-
create(spec:
|
|
1018
|
+
create(spec: WorkflowSpecLiteV1, options?: RunsCreateOptions): Promise<RunsCreateResponse>;
|
|
1097
1019
|
runEventSchemaV0(options?: {
|
|
1098
1020
|
signal?: AbortSignal;
|
|
1099
1021
|
headers?: Record<string, string>;
|
|
@@ -1258,13 +1180,13 @@ type WorkflowsCompileOptions = {
|
|
|
1258
1180
|
metrics?: MetricsCallbacks;
|
|
1259
1181
|
trace?: TraceCallbacks;
|
|
1260
1182
|
};
|
|
1261
|
-
type
|
|
1183
|
+
type WorkflowsCompileResponse = {
|
|
1262
1184
|
plan_json: unknown;
|
|
1263
1185
|
plan_hash: PlanHash$1;
|
|
1264
1186
|
};
|
|
1265
|
-
type
|
|
1187
|
+
type WorkflowsCompileResult = ({
|
|
1266
1188
|
ok: true;
|
|
1267
|
-
} &
|
|
1189
|
+
} & WorkflowsCompileResponse) | {
|
|
1268
1190
|
ok: false;
|
|
1269
1191
|
error_type: "validation_error";
|
|
1270
1192
|
issues: ReadonlyArray<WorkflowValidationIssue>;
|
|
@@ -1285,7 +1207,7 @@ declare class WorkflowsClient {
|
|
|
1285
1207
|
metrics?: MetricsCallbacks;
|
|
1286
1208
|
trace?: TraceCallbacks;
|
|
1287
1209
|
});
|
|
1288
|
-
|
|
1210
|
+
compile(spec: WorkflowSpecLiteV1, options?: WorkflowsCompileOptions): Promise<WorkflowsCompileResult>;
|
|
1289
1211
|
}
|
|
1290
1212
|
|
|
1291
1213
|
/**
|
|
@@ -2322,78 +2244,118 @@ declare class JoinOutputPath {
|
|
|
2322
2244
|
*/
|
|
2323
2245
|
declare function JoinOutput(nodeId: string): JoinOutputPath;
|
|
2324
2246
|
|
|
2325
|
-
/** JSON pointer to extract text content from an LLM response output. */
|
|
2326
2247
|
declare const LLM_TEXT_OUTPUT: string;
|
|
2327
|
-
/** JSON pointer to inject text into the user message of an LLM request.
|
|
2328
|
-
* The pointer is relative to the request object (not the full node input). */
|
|
2329
2248
|
declare const LLM_USER_MESSAGE_TEXT: string;
|
|
2330
|
-
type
|
|
2249
|
+
type WorkflowIntentEdge = {
|
|
2331
2250
|
from: NodeId$1;
|
|
2332
|
-
|
|
2251
|
+
to: NodeId$1;
|
|
2333
2252
|
};
|
|
2334
|
-
|
|
2335
|
-
|
|
2336
|
-
|
|
2253
|
+
type WorkflowIntentBuilderState = {
|
|
2254
|
+
readonly name?: string;
|
|
2255
|
+
readonly model?: string;
|
|
2256
|
+
readonly nodes: ReadonlyArray<WorkflowIntentNode>;
|
|
2257
|
+
readonly edges: ReadonlyArray<WorkflowIntentEdge>;
|
|
2258
|
+
readonly outputs: ReadonlyArray<WorkflowOutputRefLiteV1>;
|
|
2337
2259
|
};
|
|
2338
|
-
declare
|
|
2339
|
-
|
|
2260
|
+
declare class WorkflowIntentBuilder {
|
|
2261
|
+
private readonly state;
|
|
2262
|
+
constructor(state?: WorkflowIntentBuilderState);
|
|
2263
|
+
private with;
|
|
2264
|
+
name(name: string): WorkflowIntentBuilder;
|
|
2265
|
+
model(model: string): WorkflowIntentBuilder;
|
|
2266
|
+
node(node: WorkflowIntentNode): WorkflowIntentBuilder;
|
|
2267
|
+
llm(id: NodeId$1, configure?: (node: LLMNodeBuilder) => LLMNodeBuilder): WorkflowIntentBuilder;
|
|
2268
|
+
joinAll(id: NodeId$1): WorkflowIntentBuilder;
|
|
2269
|
+
joinAny(id: NodeId$1, predicate?: WorkflowIntentCondition): WorkflowIntentBuilder;
|
|
2270
|
+
joinCollect(id: NodeId$1, options: {
|
|
2271
|
+
limit?: number;
|
|
2272
|
+
timeoutMs?: number;
|
|
2273
|
+
predicate?: WorkflowIntentCondition;
|
|
2274
|
+
}): WorkflowIntentBuilder;
|
|
2275
|
+
transformJSON(id: NodeId$1, object?: Record<string, WorkflowIntentTransformValue>, merge?: WorkflowIntentTransformValue[]): WorkflowIntentBuilder;
|
|
2276
|
+
mapFanout(id: NodeId$1, options: {
|
|
2277
|
+
itemsFrom?: NodeId$1;
|
|
2278
|
+
itemsFromInput?: string;
|
|
2279
|
+
itemsPath?: string;
|
|
2280
|
+
subnode: WorkflowIntentNode;
|
|
2281
|
+
maxParallelism?: number;
|
|
2282
|
+
}): WorkflowIntentBuilder;
|
|
2283
|
+
edge(from: NodeId$1, to: NodeId$1): WorkflowIntentBuilder;
|
|
2284
|
+
output(name: OutputName$1, from: NodeId$1, pointer?: string): WorkflowIntentBuilder;
|
|
2285
|
+
build(): WorkflowSpecLiteV1;
|
|
2286
|
+
}
|
|
2287
|
+
declare class LLMNodeBuilder {
|
|
2288
|
+
private readonly node;
|
|
2289
|
+
constructor(id: NodeId$1);
|
|
2290
|
+
system(text: string): LLMNodeBuilder;
|
|
2291
|
+
user(text: string): LLMNodeBuilder;
|
|
2292
|
+
input(items: InputItem[]): LLMNodeBuilder;
|
|
2293
|
+
model(model: string): LLMNodeBuilder;
|
|
2294
|
+
stream(enabled: boolean): LLMNodeBuilder;
|
|
2295
|
+
toolExecution(mode: "server" | "client" | "agentic"): LLMNodeBuilder;
|
|
2296
|
+
tools(tools: Array<string | Tool>): LLMNodeBuilder;
|
|
2297
|
+
build(): WorkflowIntentNode;
|
|
2298
|
+
}
|
|
2299
|
+
declare function workflowIntent(): WorkflowIntentBuilder;
|
|
2300
|
+
/**
|
|
2301
|
+
* Standalone LLM node builder for use with chain() and parallel().
|
|
2302
|
+
*/
|
|
2303
|
+
declare function llm(id: string, configure?: (node: LLMNodeBuilder) => LLMNodeBuilder): WorkflowIntentNode;
|
|
2304
|
+
/**
|
|
2305
|
+
* Options for chain() helper.
|
|
2306
|
+
*/
|
|
2307
|
+
type ChainOptions = {
|
|
2308
|
+
/** Workflow name */
|
|
2309
|
+
name?: string;
|
|
2310
|
+
/** Default model for all nodes */
|
|
2311
|
+
model?: string;
|
|
2340
2312
|
};
|
|
2341
2313
|
/**
|
|
2342
|
-
*
|
|
2314
|
+
* Creates a sequential workflow where each step depends on the previous one.
|
|
2315
|
+
* Edges are automatically wired based on order.
|
|
2316
|
+
*
|
|
2317
|
+
* @example
|
|
2318
|
+
* ```typescript
|
|
2319
|
+
* const spec = chain([
|
|
2320
|
+
* llm("summarize", n => n.system("Summarize.").user("{{task}}")),
|
|
2321
|
+
* llm("translate", n => n.system("Translate to French.").user("{{summarize}}")),
|
|
2322
|
+
* ], { name: "summarize-translate" })
|
|
2323
|
+
* .output("result", "translate")
|
|
2324
|
+
* .build();
|
|
2325
|
+
* ```
|
|
2343
2326
|
*/
|
|
2344
|
-
declare
|
|
2345
|
-
readonly nodeId: NodeId$1;
|
|
2346
|
-
readonly bindingIndex: number;
|
|
2347
|
-
readonly pointer: string;
|
|
2348
|
-
constructor(nodeId: NodeId$1, bindingIndex: number, pointer: string, message: string);
|
|
2349
|
-
}
|
|
2327
|
+
declare function chain(steps: WorkflowIntentNode[], options?: ChainOptions): WorkflowIntentBuilder;
|
|
2350
2328
|
/**
|
|
2351
|
-
*
|
|
2329
|
+
* Options for parallel() helper.
|
|
2352
2330
|
*/
|
|
2353
|
-
|
|
2354
|
-
|
|
2355
|
-
|
|
2356
|
-
|
|
2357
|
-
|
|
2358
|
-
|
|
2359
|
-
|
|
2360
|
-
readonly nodes: ReadonlyArray<WorkflowNodeV1>;
|
|
2361
|
-
readonly edges: ReadonlyArray<WorkflowEdgeV1>;
|
|
2362
|
-
readonly outputs: ReadonlyArray<WorkflowOutputRefV1>;
|
|
2331
|
+
type ParallelOptions = {
|
|
2332
|
+
/** Workflow name */
|
|
2333
|
+
name?: string;
|
|
2334
|
+
/** Default model for all nodes */
|
|
2335
|
+
model?: string;
|
|
2336
|
+
/** ID for the join node (default: "join") */
|
|
2337
|
+
joinId?: string;
|
|
2363
2338
|
};
|
|
2364
|
-
|
|
2365
|
-
|
|
2366
|
-
|
|
2367
|
-
|
|
2368
|
-
|
|
2369
|
-
|
|
2370
|
-
|
|
2371
|
-
|
|
2372
|
-
|
|
2373
|
-
|
|
2374
|
-
|
|
2375
|
-
|
|
2376
|
-
|
|
2377
|
-
|
|
2378
|
-
|
|
2379
|
-
|
|
2380
|
-
|
|
2381
|
-
toolLimits?: LLMResponsesToolLimitsV1;
|
|
2382
|
-
bindings?: ReadonlyArray<LLMResponsesBindingV1>;
|
|
2383
|
-
}): WorkflowBuilderV1;
|
|
2384
|
-
joinAll(id: NodeId$1): WorkflowBuilderV1;
|
|
2385
|
-
joinAny(id: NodeId$1, input?: JoinAnyNodeInputV1): WorkflowBuilderV1;
|
|
2386
|
-
joinCollect(id: NodeId$1, input: JoinCollectNodeInputV1): WorkflowBuilderV1;
|
|
2387
|
-
transformJSON(id: NodeId$1, input: TransformJSONNodeInputV1): WorkflowBuilderV1;
|
|
2388
|
-
mapFanout(id: NodeId$1, input: MapFanoutNodeInputV1): WorkflowBuilderV1;
|
|
2389
|
-
edge(from: NodeId$1, to: NodeId$1, when?: ConditionV1$1): WorkflowBuilderV1;
|
|
2390
|
-
output(name: OutputName$1, from: NodeId$1, pointer?: string): WorkflowBuilderV1;
|
|
2391
|
-
build(): WorkflowSpecV1;
|
|
2392
|
-
}
|
|
2393
|
-
declare function workflowV1(): WorkflowBuilderV1;
|
|
2339
|
+
/**
|
|
2340
|
+
* Creates a parallel workflow where all steps run concurrently, then join.
|
|
2341
|
+
* Edges are automatically wired to a join.all node.
|
|
2342
|
+
*
|
|
2343
|
+
* @example
|
|
2344
|
+
* ```typescript
|
|
2345
|
+
* const spec = parallel([
|
|
2346
|
+
* llm("agent_a", n => n.user("Write 3 ideas for {{task}}")),
|
|
2347
|
+
* llm("agent_b", n => n.user("Write 3 objections for {{task}}")),
|
|
2348
|
+
* ], { name: "multi-agent" })
|
|
2349
|
+
* .llm("aggregate", n => n.system("Synthesize.").user("{{join}}"))
|
|
2350
|
+
* .edge("join", "aggregate")
|
|
2351
|
+
* .output("result", "aggregate")
|
|
2352
|
+
* .build();
|
|
2353
|
+
* ```
|
|
2354
|
+
*/
|
|
2355
|
+
declare function parallel(steps: WorkflowIntentNode[], options?: ParallelOptions): WorkflowIntentBuilder;
|
|
2394
2356
|
|
|
2395
2357
|
declare const WORKFLOWS_COMPILE_PATH = "/workflows/compile";
|
|
2396
|
-
type
|
|
2358
|
+
type WorkflowsCompileRequest = WorkflowSpecLiteV1;
|
|
2397
2359
|
|
|
2398
2360
|
type NDJSONDelayStep = {
|
|
2399
2361
|
delayMs: number;
|
|
@@ -2575,381 +2537,15 @@ declare namespace index$1 {
|
|
|
2575
2537
|
}
|
|
2576
2538
|
|
|
2577
2539
|
/**
|
|
2578
|
-
*
|
|
2579
|
-
*
|
|
2580
|
-
* These factory functions reduce boilerplate when building conditional edges
|
|
2581
|
-
* and node bindings.
|
|
2582
|
-
*
|
|
2583
|
-
* @example
|
|
2584
|
-
* ```typescript
|
|
2585
|
-
* import { workflow, workflowV1 } from "@modelrelay/sdk";
|
|
2586
|
-
* import { whenOutputEquals, bindToPlaceholder } from "@modelrelay/sdk/workflow";
|
|
2587
|
-
*
|
|
2588
|
-
* const spec = workflowV1()
|
|
2589
|
-
* .routeSwitch("router", request)
|
|
2590
|
-
* .llmResponses("billing", billingReq, {
|
|
2591
|
-
* bindings: [bindToPlaceholder("router", "route_data")]
|
|
2592
|
-
* })
|
|
2593
|
-
* .edge("router", "billing", whenOutputEquals("$.route", "billing"))
|
|
2594
|
-
* .build();
|
|
2595
|
-
* ```
|
|
2596
|
-
*/
|
|
2597
|
-
|
|
2598
|
-
/**
|
|
2599
|
-
* Create a condition that matches when a node's output equals a specific value.
|
|
2600
|
-
*
|
|
2601
|
-
* @param path - JSONPath expression to extract the value (must start with $)
|
|
2602
|
-
* @param value - The value to compare against
|
|
2603
|
-
* @returns A condition for use in edge `when` clauses
|
|
2604
|
-
*
|
|
2605
|
-
* @example
|
|
2606
|
-
* ```typescript
|
|
2607
|
-
* builder.edge("router", "billing", whenOutputEquals("$.route", "billing"))
|
|
2608
|
-
* ```
|
|
2609
|
-
*/
|
|
2610
|
-
declare function whenOutputEquals(path: string, value: unknown): ConditionV1$1;
|
|
2611
|
-
/**
|
|
2612
|
-
* Create a condition that matches when a node's output matches a regex pattern.
|
|
2613
|
-
*
|
|
2614
|
-
* @param path - JSONPath expression to extract the value (must start with $)
|
|
2615
|
-
* @param pattern - Regular expression pattern to match
|
|
2616
|
-
* @returns A condition for use in edge `when` clauses
|
|
2617
|
-
*
|
|
2618
|
-
* @example
|
|
2619
|
-
* ```typescript
|
|
2620
|
-
* builder.edge("router", "handler", whenOutputMatches("$.category", "billing|support"))
|
|
2621
|
-
* ```
|
|
2622
|
-
*/
|
|
2623
|
-
declare function whenOutputMatches(path: string, pattern: string): ConditionV1$1;
|
|
2624
|
-
/**
|
|
2625
|
-
* Create a condition that matches when a path exists in the node's output.
|
|
2626
|
-
*
|
|
2627
|
-
* @param path - JSONPath expression to check for existence (must start with $)
|
|
2628
|
-
* @returns A condition for use in edge `when` clauses
|
|
2629
|
-
*
|
|
2630
|
-
* @example
|
|
2631
|
-
* ```typescript
|
|
2632
|
-
* builder.edge("router", "handler", whenOutputExists("$.special_case"))
|
|
2633
|
-
* ```
|
|
2634
|
-
*/
|
|
2635
|
-
declare function whenOutputExists(path: string): ConditionV1$1;
|
|
2636
|
-
/**
|
|
2637
|
-
* Create a condition that matches when a node's status equals a specific value.
|
|
2638
|
-
*
|
|
2639
|
-
* @param path - JSONPath expression to extract the status value (must start with $)
|
|
2640
|
-
* @param value - The status value to compare against
|
|
2641
|
-
* @returns A condition for use in edge `when` clauses
|
|
2642
|
-
*
|
|
2643
|
-
* @example
|
|
2644
|
-
* ```typescript
|
|
2645
|
-
* builder.edge("node", "handler", whenStatusEquals("$.status", "succeeded"))
|
|
2646
|
-
* ```
|
|
2647
|
-
*/
|
|
2648
|
-
declare function whenStatusEquals(path: string, value: unknown): ConditionV1$1;
|
|
2649
|
-
/**
|
|
2650
|
-
* Create a condition that matches when a node's status matches a regex pattern.
|
|
2651
|
-
*
|
|
2652
|
-
* @param path - JSONPath expression to extract the status value (must start with $)
|
|
2653
|
-
* @param pattern - Regular expression pattern to match
|
|
2654
|
-
* @returns A condition for use in edge `when` clauses
|
|
2655
|
-
*/
|
|
2656
|
-
declare function whenStatusMatches(path: string, pattern: string): ConditionV1$1;
|
|
2657
|
-
/**
|
|
2658
|
-
* Create a condition that matches when a path exists in the node's status.
|
|
2659
|
-
*
|
|
2660
|
-
* @param path - JSONPath expression to check for existence (must start with $)
|
|
2661
|
-
* @returns A condition for use in edge `when` clauses
|
|
2662
|
-
*/
|
|
2663
|
-
declare function whenStatusExists(path: string): ConditionV1$1;
|
|
2664
|
-
/**
|
|
2665
|
-
* Options for binding factory functions.
|
|
2666
|
-
*/
|
|
2667
|
-
interface BindingOptions {
|
|
2668
|
-
/** JSON pointer to extract from the source node's output */
|
|
2669
|
-
pointer?: string;
|
|
2670
|
-
/** Encoding to use (defaults to "json_string") */
|
|
2671
|
-
encoding?: LLMResponsesBindingEncodingV1;
|
|
2672
|
-
}
|
|
2673
|
-
/**
|
|
2674
|
-
* Create a binding that injects a value into a {{placeholder}} in the prompt.
|
|
2675
|
-
*
|
|
2676
|
-
* @param from - Source node ID
|
|
2677
|
-
* @param placeholder - Placeholder name (without the {{ }} delimiters)
|
|
2678
|
-
* @param opts - Optional pointer and encoding settings
|
|
2679
|
-
* @returns A binding for use in node input
|
|
2680
|
-
*
|
|
2681
|
-
* @example
|
|
2682
|
-
* ```typescript
|
|
2683
|
-
* builder.llmResponses("aggregate", request, {
|
|
2684
|
-
* bindings: [
|
|
2685
|
-
* bindToPlaceholder("join", "route_output"),
|
|
2686
|
-
* bindToPlaceholder("data", "user_data", { pointer: "/results" })
|
|
2687
|
-
* ]
|
|
2688
|
-
* })
|
|
2689
|
-
* ```
|
|
2690
|
-
*/
|
|
2691
|
-
declare function bindToPlaceholder(from: NodeId$1, placeholder: string, opts?: BindingOptions): LLMResponsesBindingV1;
|
|
2692
|
-
/**
|
|
2693
|
-
* Create a binding that injects a value at a specific JSON pointer in the request.
|
|
2694
|
-
*
|
|
2695
|
-
* @param from - Source node ID
|
|
2696
|
-
* @param to - JSON pointer in the request to inject the value
|
|
2697
|
-
* @param opts - Optional pointer and encoding settings
|
|
2698
|
-
* @returns A binding for use in node input
|
|
2699
|
-
*
|
|
2700
|
-
* @example
|
|
2701
|
-
* ```typescript
|
|
2702
|
-
* builder.llmResponses("processor", request, {
|
|
2703
|
-
* bindings: [
|
|
2704
|
-
* bindToPointer("source", "/input/0/content/0/text")
|
|
2705
|
-
* ]
|
|
2706
|
-
* })
|
|
2707
|
-
* ```
|
|
2708
|
-
*/
|
|
2709
|
-
declare function bindToPointer(from: NodeId$1, to: string, opts?: BindingOptions): LLMResponsesBindingV1;
|
|
2710
|
-
/**
|
|
2711
|
-
* Create a binding from a source node with full control over all fields.
|
|
2712
|
-
*
|
|
2713
|
-
* @param from - Source node ID
|
|
2714
|
-
* @returns A builder for fluent binding construction
|
|
2715
|
-
*
|
|
2716
|
-
* @example
|
|
2717
|
-
* ```typescript
|
|
2718
|
-
* const binding = bindFrom("source")
|
|
2719
|
-
* .pointer("/output/text")
|
|
2720
|
-
* .toPlaceholder("data")
|
|
2721
|
-
* .encoding("json")
|
|
2722
|
-
* .build();
|
|
2723
|
-
* ```
|
|
2724
|
-
*/
|
|
2725
|
-
declare function bindFrom(from: NodeId$1): BindingBuilder;
|
|
2726
|
-
/**
|
|
2727
|
-
* Fluent builder for constructing bindings.
|
|
2728
|
-
*/
|
|
2729
|
-
declare class BindingBuilder {
|
|
2730
|
-
private _from;
|
|
2731
|
-
private _pointer?;
|
|
2732
|
-
private _to?;
|
|
2733
|
-
private _toPlaceholder?;
|
|
2734
|
-
private _encoding;
|
|
2735
|
-
constructor(from: NodeId$1);
|
|
2736
|
-
/**
|
|
2737
|
-
* Set the source pointer to extract from the node's output.
|
|
2738
|
-
*/
|
|
2739
|
-
pointer(ptr: string): BindingBuilder;
|
|
2740
|
-
/**
|
|
2741
|
-
* Set the destination JSON pointer in the request.
|
|
2742
|
-
*/
|
|
2743
|
-
to(ptr: string): BindingBuilder;
|
|
2744
|
-
/**
|
|
2745
|
-
* Set the destination placeholder name.
|
|
2746
|
-
*/
|
|
2747
|
-
toPlaceholder(name: string): BindingBuilder;
|
|
2748
|
-
/**
|
|
2749
|
-
* Set the encoding for the binding value.
|
|
2750
|
-
*/
|
|
2751
|
-
encoding(enc: LLMResponsesBindingEncodingV1): BindingBuilder;
|
|
2752
|
-
/**
|
|
2753
|
-
* Build the binding object.
|
|
2754
|
-
*/
|
|
2755
|
-
build(): LLMResponsesBindingV1;
|
|
2756
|
-
}
|
|
2757
|
-
|
|
2758
|
-
/**
|
|
2759
|
-
* High-level pattern builders for workflow.v1.
|
|
2760
|
-
*
|
|
2761
|
-
* These builders provide ergonomic construction of common workflow patterns
|
|
2762
|
-
* like routing and fan-out/reduce, similar to the v0 Chain/Parallel/MapReduce patterns.
|
|
2763
|
-
*
|
|
2764
|
-
* @example
|
|
2765
|
-
* ```typescript
|
|
2766
|
-
* import { RouterV1, FanoutReduceV1 } from "@modelrelay/sdk/workflow";
|
|
2767
|
-
*
|
|
2768
|
-
* // Router pattern: classify input and route to specialized handlers
|
|
2769
|
-
* const routerSpec = new RouterV1({
|
|
2770
|
-
* classifier: { model: "gpt-4o-mini", input: [...] },
|
|
2771
|
-
* routes: [
|
|
2772
|
-
* { value: "billing", handler: { model: "gpt-4o", input: [...] } },
|
|
2773
|
-
* { value: "support", handler: { model: "gpt-4o", input: [...] } },
|
|
2774
|
-
* ]
|
|
2775
|
-
* }).build();
|
|
2776
|
-
*
|
|
2777
|
-
* // FanoutReduce pattern: generate items, process each, aggregate
|
|
2778
|
-
* const fanoutSpec = new FanoutReduceV1({
|
|
2779
|
-
* generator: { model: "gpt-4o-mini", input: [...] },
|
|
2780
|
-
* itemsPath: "/questions",
|
|
2781
|
-
* mapperPlaceholder: "question",
|
|
2782
|
-
* mapper: { model: "gpt-4o", input: [...] },
|
|
2783
|
-
* reducer: { model: "gpt-4o", input: [...] },
|
|
2784
|
-
* }).build();
|
|
2785
|
-
* ```
|
|
2786
|
-
*/
|
|
2787
|
-
|
|
2788
|
-
/**
|
|
2789
|
-
* A route definition for the router pattern.
|
|
2790
|
-
*/
|
|
2791
|
-
interface RouterRouteV1 {
|
|
2792
|
-
/** The value to match in the router output (at routePath) */
|
|
2793
|
-
value: string;
|
|
2794
|
-
/** The handler node ID (auto-generated if not provided) */
|
|
2795
|
-
id?: NodeId$1;
|
|
2796
|
-
/** The LLM request for this route's handler */
|
|
2797
|
-
handler: WireResponsesRequest | ResponsesRequest;
|
|
2798
|
-
/** Optional bindings for the handler */
|
|
2799
|
-
bindings?: ReadonlyArray<LLMResponsesBindingV1>;
|
|
2800
|
-
}
|
|
2801
|
-
/**
|
|
2802
|
-
* Configuration for the RouterV1 pattern builder.
|
|
2803
|
-
*/
|
|
2804
|
-
interface RouterConfigV1 {
|
|
2805
|
-
/** Optional workflow name */
|
|
2806
|
-
name?: string;
|
|
2807
|
-
/** The classifier/router node configuration */
|
|
2808
|
-
classifier: WireResponsesRequest | ResponsesRequest;
|
|
2809
|
-
/** Optional classifier node ID (defaults to "router") */
|
|
2810
|
-
classifierId?: NodeId$1;
|
|
2811
|
-
/** JSONPath to extract the route value from classifier output (defaults to "$.route") */
|
|
2812
|
-
routePath?: string;
|
|
2813
|
-
/** Route definitions mapping values to handlers */
|
|
2814
|
-
routes: RouterRouteV1[];
|
|
2815
|
-
/** Optional aggregator node to combine results */
|
|
2816
|
-
aggregator?: {
|
|
2817
|
-
/** Aggregator node ID (defaults to "aggregate") */
|
|
2818
|
-
id?: NodeId$1;
|
|
2819
|
-
/** The LLM request for aggregation */
|
|
2820
|
-
request: WireResponsesRequest | ResponsesRequest;
|
|
2821
|
-
/** Placeholder name for injecting the routed result (defaults to "route_output") */
|
|
2822
|
-
placeholder?: string;
|
|
2823
|
-
};
|
|
2824
|
-
/** Output name (defaults to "final") */
|
|
2825
|
-
outputName?: OutputName$1;
|
|
2826
|
-
}
|
|
2827
|
-
/**
|
|
2828
|
-
* Builder for the Router pattern in workflow.v1.
|
|
2829
|
-
*
|
|
2830
|
-
* The router pattern classifies input and routes to specialized handlers
|
|
2831
|
-
* based on the classification result. A join.any node collects the first
|
|
2832
|
-
* successful handler response.
|
|
2833
|
-
*
|
|
2834
|
-
* Topology:
|
|
2835
|
-
* ```
|
|
2836
|
-
* classifier --[when=billing]--> billing_handler --\
|
|
2837
|
-
* --[when=support]--> support_handler --> join.any --> [aggregator]
|
|
2838
|
-
* --[when=sales]--> sales_handler ----/
|
|
2839
|
-
* ```
|
|
2840
|
-
*
|
|
2841
|
-
* @example
|
|
2842
|
-
* ```typescript
|
|
2843
|
-
* const spec = new RouterV1({
|
|
2844
|
-
* classifier: {
|
|
2845
|
-
* model: "gpt-4o-mini",
|
|
2846
|
-
* input: [{ role: "user", content: "Classify: {{query}}" }]
|
|
2847
|
-
* },
|
|
2848
|
-
* routes: [
|
|
2849
|
-
* { value: "billing", handler: { model: "gpt-4o", input: [...] } },
|
|
2850
|
-
* { value: "support", handler: { model: "gpt-4o", input: [...] } },
|
|
2851
|
-
* ],
|
|
2852
|
-
* aggregator: {
|
|
2853
|
-
* request: { model: "gpt-4o", input: [...] },
|
|
2854
|
-
* placeholder: "route_output"
|
|
2855
|
-
* }
|
|
2856
|
-
* }).build();
|
|
2857
|
-
* ```
|
|
2858
|
-
*/
|
|
2859
|
-
declare class RouterV1 {
|
|
2860
|
-
private readonly config;
|
|
2861
|
-
constructor(config: RouterConfigV1);
|
|
2862
|
-
/**
|
|
2863
|
-
* Build the workflow specification.
|
|
2864
|
-
*/
|
|
2865
|
-
build(): WorkflowSpecV1;
|
|
2866
|
-
}
|
|
2867
|
-
/**
|
|
2868
|
-
* Configuration for the FanoutReduceV1 pattern builder.
|
|
2869
|
-
*/
|
|
2870
|
-
interface FanoutReduceConfigV1 {
|
|
2871
|
-
/** Optional workflow name */
|
|
2872
|
-
name?: string;
|
|
2873
|
-
/** The generator node that produces items to process */
|
|
2874
|
-
generator: WireResponsesRequest | ResponsesRequest;
|
|
2875
|
-
/** Generator node ID (defaults to "generator") */
|
|
2876
|
-
generatorId?: NodeId$1;
|
|
2877
|
-
/** JSON Pointer to extract items array from generator output (defaults to "/items") */
|
|
2878
|
-
itemsPath?: string;
|
|
2879
|
-
/** The mapper subnode template (processes each item) */
|
|
2880
|
-
mapper: WireResponsesRequest | ResponsesRequest;
|
|
2881
|
-
/** Placeholder name for item injection in mapper (defaults to "item") */
|
|
2882
|
-
mapperPlaceholder?: string;
|
|
2883
|
-
/** Maximum parallel mapper executions (defaults to 4) */
|
|
2884
|
-
maxParallelism?: number;
|
|
2885
|
-
/** The reducer node that aggregates results */
|
|
2886
|
-
reducer: WireResponsesRequest | ResponsesRequest;
|
|
2887
|
-
/** Reducer node ID (defaults to "reducer") */
|
|
2888
|
-
reducerId?: NodeId$1;
|
|
2889
|
-
/** How to inject fanout results into reducer */
|
|
2890
|
-
reducerBinding?: {
|
|
2891
|
-
/** Pointer to extract from fanout output (defaults to "/results") */
|
|
2892
|
-
pointer?: string;
|
|
2893
|
-
/** Placeholder name for injection (uses to_placeholder if set) */
|
|
2894
|
-
placeholder?: string;
|
|
2895
|
-
/** JSON pointer for injection (uses to if set, defaults to user message text) */
|
|
2896
|
-
to?: string;
|
|
2897
|
-
};
|
|
2898
|
-
/** Output name (defaults to "final") */
|
|
2899
|
-
outputName?: OutputName$1;
|
|
2900
|
-
}
|
|
2901
|
-
/**
|
|
2902
|
-
* Builder for the FanoutReduce pattern in workflow.v1.
|
|
2903
|
-
*
|
|
2904
|
-
* The fanout/reduce pattern generates a list of items, processes each item
|
|
2905
|
-
* in parallel using a mapper node, then aggregates all results.
|
|
2906
|
-
*
|
|
2907
|
-
* Topology:
|
|
2908
|
-
* ```
|
|
2909
|
-
* generator --> map.fanout(mapper) --> reducer
|
|
2910
|
-
* ```
|
|
2911
|
-
*
|
|
2912
|
-
* @example
|
|
2913
|
-
* ```typescript
|
|
2914
|
-
* const spec = new FanoutReduceV1({
|
|
2915
|
-
* generator: {
|
|
2916
|
-
* model: "gpt-4o-mini",
|
|
2917
|
-
* input: [{ role: "user", content: "Generate 3 questions about {{topic}}" }]
|
|
2918
|
-
* },
|
|
2919
|
-
* itemsPath: "/questions",
|
|
2920
|
-
* mapperPlaceholder: "question",
|
|
2921
|
-
* mapper: {
|
|
2922
|
-
* model: "gpt-4o",
|
|
2923
|
-
* input: [{ role: "system", content: "Answer: {{question}}" }]
|
|
2924
|
-
* },
|
|
2925
|
-
* reducer: {
|
|
2926
|
-
* model: "gpt-4o",
|
|
2927
|
-
* input: [{ role: "system", content: "Combine answers: {{results}}" }]
|
|
2928
|
-
* },
|
|
2929
|
-
* reducerBinding: { placeholder: "results" },
|
|
2930
|
-
* maxParallelism: 4,
|
|
2931
|
-
* }).build();
|
|
2932
|
-
* ```
|
|
2933
|
-
*/
|
|
2934
|
-
declare class FanoutReduceV1 {
|
|
2935
|
-
private readonly config;
|
|
2936
|
-
constructor(config: FanoutReduceConfigV1);
|
|
2937
|
-
/**
|
|
2938
|
-
* Build the workflow specification.
|
|
2939
|
-
*/
|
|
2940
|
-
build(): WorkflowSpecV1;
|
|
2941
|
-
}
|
|
2942
|
-
|
|
2943
|
-
/**
|
|
2944
|
-
* Workflow types with clean naming (no Workflow prefix).
|
|
2540
|
+
* Workflow.lite.v1 types with clean naming (no Workflow prefix).
|
|
2945
2541
|
*
|
|
2946
2542
|
* @example
|
|
2947
2543
|
* ```typescript
|
|
2948
2544
|
* import { workflow } from "@modelrelay/sdk";
|
|
2949
2545
|
*
|
|
2950
|
-
* const spec: workflow.
|
|
2951
|
-
* kind: workflow.
|
|
2952
|
-
* nodes: [{ id: "my_node", type: workflow.
|
|
2546
|
+
* const spec: workflow.SpecLiteV1 = {
|
|
2547
|
+
* kind: workflow.KindIntent,
|
|
2548
|
+
* nodes: [{ id: "my_node", type: workflow.NodeTypesLite.LLM, user: "hello" }],
|
|
2953
2549
|
* outputs: [],
|
|
2954
2550
|
* };
|
|
2955
2551
|
* ```
|
|
@@ -2961,18 +2557,12 @@ type RunId = RunId$1;
|
|
|
2961
2557
|
type PlanHash = PlanHash$1;
|
|
2962
2558
|
|
|
2963
2559
|
type Kind = WorkflowKind;
|
|
2964
|
-
type
|
|
2965
|
-
type
|
|
2966
|
-
type
|
|
2967
|
-
type
|
|
2968
|
-
type
|
|
2969
|
-
type
|
|
2970
|
-
type ToolLimitsV1 = LLMResponsesToolLimitsV1;
|
|
2971
|
-
type ToolExecutionV1 = ToolExecutionV1$1;
|
|
2972
|
-
type ToolExecutionModeV1 = ToolExecutionModeV1$1;
|
|
2973
|
-
type ConditionV1 = ConditionV1$1;
|
|
2974
|
-
type ConditionOpV1 = ConditionOpV1$1;
|
|
2975
|
-
type ConditionSourceV1 = ConditionSourceV1$1;
|
|
2560
|
+
type SpecLiteV1 = WorkflowSpecLiteV1;
|
|
2561
|
+
type IntentNode = WorkflowIntentNode;
|
|
2562
|
+
type OutputRefLiteV1 = WorkflowOutputRefLiteV1;
|
|
2563
|
+
type Condition = WorkflowIntentCondition;
|
|
2564
|
+
type ConditionOp = WorkflowIntentConditionOp;
|
|
2565
|
+
type ConditionSource = WorkflowIntentConditionSource;
|
|
2976
2566
|
type StatusV0 = RunStatusV0;
|
|
2977
2567
|
type EventTypeV0 = RunEventTypeV0;
|
|
2978
2568
|
type EventV0 = RunEventV0;
|
|
@@ -3004,36 +2594,20 @@ type TokenUsageV0 = TokenUsageV0$1;
|
|
|
3004
2594
|
type PayloadInfoV0 = PayloadInfoV0$1;
|
|
3005
2595
|
type PayloadArtifactV0 = PayloadArtifactV0$1;
|
|
3006
2596
|
type StreamEventKind = StreamEventKind$1;
|
|
3007
|
-
declare const
|
|
3008
|
-
declare const
|
|
3009
|
-
readonly
|
|
3010
|
-
readonly RouteSwitch: "route.switch";
|
|
2597
|
+
declare const KindIntent: "workflow";
|
|
2598
|
+
declare const NodeTypesLite: {
|
|
2599
|
+
readonly LLM: "llm";
|
|
3011
2600
|
readonly JoinAll: "join.all";
|
|
3012
2601
|
readonly JoinAny: "join.any";
|
|
3013
2602
|
readonly JoinCollect: "join.collect";
|
|
3014
2603
|
readonly TransformJSON: "transform.json";
|
|
3015
2604
|
readonly MapFanout: "map.fanout";
|
|
3016
2605
|
};
|
|
3017
|
-
type
|
|
3018
|
-
declare const BindingEncodings: {
|
|
3019
|
-
readonly JSON: "json";
|
|
3020
|
-
readonly JSONString: "json_string";
|
|
3021
|
-
};
|
|
3022
|
-
declare const ToolExecutionModes: {
|
|
3023
|
-
readonly Server: "server";
|
|
3024
|
-
readonly Client: "client";
|
|
3025
|
-
};
|
|
2606
|
+
type NodeTypeLite = (typeof NodeTypesLite)[keyof typeof NodeTypesLite];
|
|
3026
2607
|
|
|
3027
|
-
type
|
|
3028
|
-
|
|
3029
|
-
type
|
|
3030
|
-
declare const index_BindingEncodings: typeof BindingEncodings;
|
|
3031
|
-
type index_BindingOptions = BindingOptions;
|
|
3032
|
-
type index_BindingV1 = BindingV1;
|
|
3033
|
-
type index_ConditionOpV1 = ConditionOpV1;
|
|
3034
|
-
type index_ConditionSourceV1 = ConditionSourceV1;
|
|
3035
|
-
type index_ConditionV1 = ConditionV1;
|
|
3036
|
-
type index_EdgeV1 = EdgeV1;
|
|
2608
|
+
type index_Condition = Condition;
|
|
2609
|
+
type index_ConditionOp = ConditionOp;
|
|
2610
|
+
type index_ConditionSource = ConditionSource;
|
|
3037
2611
|
type index_EventBaseV0 = EventBaseV0;
|
|
3038
2612
|
type index_EventNodeFailedV0 = EventNodeFailedV0;
|
|
3039
2613
|
type index_EventNodeLLMCallV0 = EventNodeLLMCallV0;
|
|
@@ -3051,11 +2625,11 @@ type index_EventRunFailedV0 = EventRunFailedV0;
|
|
|
3051
2625
|
type index_EventRunStartedV0 = EventRunStartedV0;
|
|
3052
2626
|
type index_EventTypeV0 = EventTypeV0;
|
|
3053
2627
|
type index_EventV0 = EventV0;
|
|
3054
|
-
type
|
|
3055
|
-
type index_FanoutReduceV1 = FanoutReduceV1;
|
|
3056
|
-
declare const index_FanoutReduceV1: typeof FanoutReduceV1;
|
|
2628
|
+
type index_IntentNode = IntentNode;
|
|
3057
2629
|
type index_Kind = Kind;
|
|
3058
|
-
declare const
|
|
2630
|
+
declare const index_KindIntent: typeof KindIntent;
|
|
2631
|
+
type index_LLMNodeBuilder = LLMNodeBuilder;
|
|
2632
|
+
declare const index_LLMNodeBuilder: typeof LLMNodeBuilder;
|
|
3059
2633
|
declare const index_LLM_TEXT_OUTPUT: typeof LLM_TEXT_OUTPUT;
|
|
3060
2634
|
declare const index_LLM_USER_MESSAGE_TEXT: typeof LLM_USER_MESSAGE_TEXT;
|
|
3061
2635
|
type index_NodeErrorV0 = NodeErrorV0;
|
|
@@ -3064,49 +2638,31 @@ type index_NodeLLMCallV0 = NodeLLMCallV0;
|
|
|
3064
2638
|
type index_NodeOutputDeltaV0 = NodeOutputDeltaV0;
|
|
3065
2639
|
type index_NodeToolCallV0 = NodeToolCallV0;
|
|
3066
2640
|
type index_NodeToolResultV0 = NodeToolResultV0;
|
|
3067
|
-
type
|
|
3068
|
-
declare const
|
|
3069
|
-
type index_NodeV1 = NodeV1;
|
|
2641
|
+
type index_NodeTypeLite = NodeTypeLite;
|
|
2642
|
+
declare const index_NodeTypesLite: typeof NodeTypesLite;
|
|
3070
2643
|
type index_NodeWaitingV0 = NodeWaitingV0;
|
|
3071
2644
|
type index_OutputName = OutputName;
|
|
3072
|
-
type
|
|
2645
|
+
type index_OutputRefLiteV1 = OutputRefLiteV1;
|
|
3073
2646
|
type index_PayloadArtifactV0 = PayloadArtifactV0;
|
|
3074
2647
|
type index_PayloadInfoV0 = PayloadInfoV0;
|
|
3075
2648
|
type index_PendingToolCallV0 = PendingToolCallV0;
|
|
3076
2649
|
type index_PlanHash = PlanHash;
|
|
3077
|
-
type index_RouterConfigV1 = RouterConfigV1;
|
|
3078
|
-
type index_RouterRouteV1 = RouterRouteV1;
|
|
3079
|
-
type index_RouterV1 = RouterV1;
|
|
3080
|
-
declare const index_RouterV1: typeof RouterV1;
|
|
3081
2650
|
type index_RunId = RunId;
|
|
3082
|
-
type
|
|
2651
|
+
type index_SpecLiteV1 = SpecLiteV1;
|
|
3083
2652
|
type index_StatusV0 = StatusV0;
|
|
3084
2653
|
type index_StreamEventKind = StreamEventKind;
|
|
3085
2654
|
type index_TokenUsageV0 = TokenUsageV0;
|
|
3086
2655
|
type index_ToolCallV0 = ToolCallV0;
|
|
3087
2656
|
type index_ToolCallWithArgumentsV0 = ToolCallWithArgumentsV0;
|
|
3088
|
-
type
|
|
3089
|
-
declare const
|
|
3090
|
-
type index_ToolExecutionV1 = ToolExecutionV1;
|
|
3091
|
-
type index_ToolLimitsV1 = ToolLimitsV1;
|
|
3092
|
-
type index_WorkflowBuilderV1 = WorkflowBuilderV1;
|
|
3093
|
-
declare const index_WorkflowBuilderV1: typeof WorkflowBuilderV1;
|
|
3094
|
-
declare const index_bindFrom: typeof bindFrom;
|
|
3095
|
-
declare const index_bindToPlaceholder: typeof bindToPlaceholder;
|
|
3096
|
-
declare const index_bindToPointer: typeof bindToPointer;
|
|
2657
|
+
type index_WorkflowIntentBuilder = WorkflowIntentBuilder;
|
|
2658
|
+
declare const index_WorkflowIntentBuilder: typeof WorkflowIntentBuilder;
|
|
3097
2659
|
declare const index_parseNodeId: typeof parseNodeId;
|
|
3098
2660
|
declare const index_parseOutputName: typeof parseOutputName;
|
|
3099
2661
|
declare const index_parsePlanHash: typeof parsePlanHash;
|
|
3100
2662
|
declare const index_parseRunId: typeof parseRunId;
|
|
3101
|
-
declare const
|
|
3102
|
-
declare const index_whenOutputExists: typeof whenOutputExists;
|
|
3103
|
-
declare const index_whenOutputMatches: typeof whenOutputMatches;
|
|
3104
|
-
declare const index_whenStatusEquals: typeof whenStatusEquals;
|
|
3105
|
-
declare const index_whenStatusExists: typeof whenStatusExists;
|
|
3106
|
-
declare const index_whenStatusMatches: typeof whenStatusMatches;
|
|
3107
|
-
declare const index_workflowV1: typeof workflowV1;
|
|
2663
|
+
declare const index_workflowIntent: typeof workflowIntent;
|
|
3108
2664
|
declare namespace index {
|
|
3109
|
-
export {
|
|
2665
|
+
export { type index_Condition as Condition, type index_ConditionOp as ConditionOp, type index_ConditionSource as ConditionSource, type index_EventBaseV0 as EventBaseV0, type index_EventNodeFailedV0 as EventNodeFailedV0, type index_EventNodeLLMCallV0 as EventNodeLLMCallV0, type index_EventNodeOutputDeltaV0 as EventNodeOutputDeltaV0, type index_EventNodeOutputV0 as EventNodeOutputV0, type index_EventNodeStartedV0 as EventNodeStartedV0, type index_EventNodeSucceededV0 as EventNodeSucceededV0, type index_EventNodeToolCallV0 as EventNodeToolCallV0, type index_EventNodeToolResultV0 as EventNodeToolResultV0, type index_EventNodeWaitingV0 as EventNodeWaitingV0, type index_EventRunCanceledV0 as EventRunCanceledV0, type index_EventRunCompiledV0 as EventRunCompiledV0, type index_EventRunCompletedV0 as EventRunCompletedV0, type index_EventRunFailedV0 as EventRunFailedV0, type index_EventRunStartedV0 as EventRunStartedV0, type index_EventTypeV0 as EventTypeV0, type index_EventV0 as EventV0, type index_IntentNode as IntentNode, type index_Kind as Kind, index_KindIntent as KindIntent, index_LLMNodeBuilder as LLMNodeBuilder, index_LLM_TEXT_OUTPUT as LLM_TEXT_OUTPUT, index_LLM_USER_MESSAGE_TEXT as LLM_USER_MESSAGE_TEXT, type index_NodeErrorV0 as NodeErrorV0, type index_NodeId as NodeId, type index_NodeLLMCallV0 as NodeLLMCallV0, type index_NodeOutputDeltaV0 as NodeOutputDeltaV0, type index_NodeToolCallV0 as NodeToolCallV0, type index_NodeToolResultV0 as NodeToolResultV0, type index_NodeTypeLite as NodeTypeLite, index_NodeTypesLite as NodeTypesLite, type index_NodeWaitingV0 as NodeWaitingV0, type index_OutputName as OutputName, type index_OutputRefLiteV1 as OutputRefLiteV1, type index_PayloadArtifactV0 as PayloadArtifactV0, type index_PayloadInfoV0 as PayloadInfoV0, type index_PendingToolCallV0 as PendingToolCallV0, type index_PlanHash as PlanHash, type index_RunId as RunId, type index_SpecLiteV1 as SpecLiteV1, type index_StatusV0 as StatusV0, type index_StreamEventKind as StreamEventKind, type index_TokenUsageV0 as TokenUsageV0, type index_ToolCallV0 as ToolCallV0, type index_ToolCallWithArgumentsV0 as ToolCallWithArgumentsV0, index_WorkflowIntentBuilder as WorkflowIntentBuilder, index_parseNodeId as parseNodeId, index_parseOutputName as parseOutputName, index_parsePlanHash as parsePlanHash, index_parseRunId as parseRunId, index_workflowIntent as workflowIntent };
|
|
3110
2666
|
}
|
|
3111
2667
|
|
|
3112
2668
|
/**
|
|
@@ -3160,4 +2716,4 @@ declare class ModelRelay {
|
|
|
3160
2716
|
forCustomer(customerId: string): CustomerScopedModelRelay;
|
|
3161
2717
|
}
|
|
3162
2718
|
|
|
3163
|
-
export { APIError, ApiKey, type AttemptRecord, AuthClient, type AuthHeaders,
|
|
2719
|
+
export { APIError, ApiKey, type AttemptRecord, AuthClient, type AuthHeaders, type ChainOptions, ConfigError, CustomerResponsesClient, CustomerScopedModelRelay, CustomerToken, CustomerTokenProvider, CustomerTokenRequest, type ErrorCategory, type ErrorCode, ErrorCodes, FieldError, GetOrCreateCustomerTokenRequest, type HandleWaitingResult, type ImageData, type ImagePinResponse, type ImageRequest, type ImageResponse, type ImageResponseFormat, type ImageUsage, ImagesClient, InputItem, type JSONPointer, JoinOutput, JoinOutputPath, LLMInput, LLMInputContentItemPath, LLMInputFirstMessageText, LLMInputMessagePath, LLMInputPath, LLMInputSystemText, LLMInputUserText, LLMNodeBuilder, LLMOutput, LLMOutputContentItemPath, LLMOutputContentPath, LLMOutputPath, LLMOutputText, LLM_TEXT_OUTPUT, LLM_USER_MESSAGE_TEXT, type ListSessionsOptions, type ListSessionsResponse, LocalSession, type LocalSessionOptions, type LocalSessionPersistence, MemorySessionStore, MetricsCallbacks, type MockFetchCall, type MockFetchResponder, ModelId, ModelRelay, ModelRelayError, ModelRelayKeyOptions, ModelRelayOptions, type NDJSONDelayStep, type NodeErrorV0$1 as NodeErrorV0, type NodeId$1 as NodeId, OutputFormat, type OutputName$1 as OutputName, type ParallelOptions, PathEscapeError, type PayloadInfoV0$1 as PayloadInfoV0, type PlanHash$1 as PlanHash, type PriceInterval, ProviderId, type RemoteSessionInfo, type RemoteSessionOptions, RequestContext, Response$1 as Response, ResponseEvent, ResponsesClient, ResponsesStream, RetryConfig, type RetryHandler, RetryMetadata, type RunEventTypeV0, type RunEventV0, type RunId$1 as RunId, type RunStatusV0, RunsClient, RunsEventStream, SecretKey, type Session, type SessionArtifacts, type SessionContextManagement, type SessionContextTruncateInfo, type SessionId, type SessionMessage, type SessionPendingToolCall, type SessionRunOptions, type SessionRunResult, type SessionRunStatus, type SessionState, type SessionStore, type SessionSyncOptions, type SessionSyncResult, type SessionType, type SessionUsageSummary, SessionsClient, StreamProtocolError, StreamTimeoutError, type StreamTimeoutKind, StructuredDecodeError, type StructuredErrorKind, StructuredExhaustedError, StructuredJSONEvent, StructuredJSONStream, type StructuredOptions, type StructuredResult, type Tier, type TierCheckoutRequest, type TierCheckoutSession, TierCode, type TierModel, TiersClient, TokenProvider, Tool, ToolArgumentError, ToolChoice, ToolExecutionResult, ToolRegistry, ToolRunner, type ToolRunnerOptions, TraceCallbacks, TransportError, TransportErrorKind, type ValidationIssue, WORKFLOWS_COMPILE_PATH, WorkflowIntentBuilder, type WorkflowIntentBuilderState, type WorkflowKind, WorkflowKinds, WorkflowNodeTypesLite as WorkflowNodeTypes, WorkflowNodeTypesLite, WorkflowValidationError, type WorkflowValidationIssue, WorkflowsClient, type WorkflowsCompileOptions, type WorkflowsCompileRequest, type WorkflowsCompileResponse, type WorkflowsCompileResult, ZodLikeSchema, asSessionId, buildDelayedNDJSONResponse, buildNDJSONResponse, chain, createAccessTokenAuth, createApiKeyAuth, createLocalSession, createMemorySessionStore, createMockFetchQueue, createToolRunner, defaultRetryHandler, defaultTierModelId, generateSessionId, index$1 as generated, isSecretKey, llm, outputFormatFromZod, parallel, parseApiKey, parseErrorResponse, parseNodeId, parseOutputName, parsePlanHash, parseRunId, parseSecretKey, validateWithZod, index as workflow, workflowIntent };
|