@modelrelay/sdk 2.1.0 → 5.1.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/{api-Bb7sw9L4.d.cts → api-c1j5ycVR.d.cts} +2585 -2166
- package/dist/{api-Bb7sw9L4.d.ts → api-c1j5ycVR.d.ts} +2585 -2166
- package/dist/billing/index.d.cts +1 -1
- package/dist/billing/index.d.ts +1 -1
- package/dist/{chunk-AZD5EKLV.js → chunk-RVHKBQ7X.js} +1 -1
- package/dist/index.cjs +197 -554
- package/dist/index.d.cts +151 -645
- package/dist/index.d.ts +151 -645
- package/dist/index.js +193 -546
- 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/package.json +1 -1
- package/dist/api-Ct5bpI3U.d.cts +0 -4772
- package/dist/api-Ct5bpI3U.d.ts +0 -4772
- package/dist/api-DWUVls-S.d.cts +0 -4762
- package/dist/api-DWUVls-S.d.ts +0 -4762
- package/dist/api-DZpC1zuz.d.cts +0 -4691
- package/dist/api-DZpC1zuz.d.ts +0 -4691
- package/dist/api-D_hE36Ps.d.cts +0 -4535
- package/dist/api-D_hE36Ps.d.ts +0 -4535
- package/dist/api-Dz9HcUTt.d.cts +0 -4522
- package/dist/api-Dz9HcUTt.d.ts +0 -4522
- package/dist/api-jqOwvH6O.d.cts +0 -4761
- package/dist/api-jqOwvH6O.d.ts +0 -4761
- package/dist/chunk-4FXUTSRZ.js +0 -1194
- package/dist/chunk-BP5HUQ4M.js +0 -1194
- package/dist/chunk-CXJZB6MA.js +0 -1196
- package/dist/chunk-CYGWZYYJ.js +0 -1194
- package/dist/chunk-MXXJDLGU.js +0 -1194
- package/dist/chunk-PLZWDUOP.js +0 -1194
- package/dist/chunk-R6O6UQYM.js +0 -1133
- package/dist/chunk-SCOP57J4.js +0 -1194
- package/dist/chunk-SXNP5Y5L.js +0 -1194
- package/dist/chunk-VOFLESGQ.js +0 -1194
- package/dist/chunk-ZBQKY2W2.js +0 -1194
- package/dist/tools-B7444ZtV.d.cts +0 -1174
- package/dist/tools-B7444ZtV.d.ts +0 -1174
- package/dist/tools-CWEBFsql.d.cts +0 -1192
- package/dist/tools-CWEBFsql.d.ts +0 -1192
- package/dist/tools-Cnl2MgVa.d.cts +0 -1174
- package/dist/tools-Cnl2MgVa.d.ts +0 -1174
- package/dist/tools-CvfwPjC5.d.cts +0 -1098
- package/dist/tools-CvfwPjC5.d.ts +0 -1098
- package/dist/tools-DUYHZdZP.d.cts +0 -982
- package/dist/tools-DUYHZdZP.d.ts +0 -982
package/dist/index.d.cts
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.cjs';
|
|
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.cjs';
|
|
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-c1j5ycVR.cjs';
|
|
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 = {
|
|
@@ -819,6 +740,10 @@ type TokenUsageV0$1 = {
|
|
|
819
740
|
output_tokens?: number;
|
|
820
741
|
total_tokens?: number;
|
|
821
742
|
};
|
|
743
|
+
type PayloadArtifactV0$1 = {
|
|
744
|
+
artifact_key: string;
|
|
745
|
+
info: PayloadInfoV0$1;
|
|
746
|
+
};
|
|
822
747
|
type NodeLLMCallV0$1 = {
|
|
823
748
|
step: number;
|
|
824
749
|
request_id: string;
|
|
@@ -828,7 +753,12 @@ type NodeLLMCallV0$1 = {
|
|
|
828
753
|
stop_reason?: string;
|
|
829
754
|
usage?: TokenUsageV0$1;
|
|
830
755
|
};
|
|
831
|
-
type
|
|
756
|
+
type ToolCallV0$1 = {
|
|
757
|
+
id: string;
|
|
758
|
+
name: string;
|
|
759
|
+
arguments?: string;
|
|
760
|
+
};
|
|
761
|
+
type ToolCallWithArgumentsV0$1 = {
|
|
832
762
|
id: string;
|
|
833
763
|
name: string;
|
|
834
764
|
arguments: string;
|
|
@@ -836,19 +766,17 @@ type FunctionToolCallV0$1 = {
|
|
|
836
766
|
type NodeToolCallV0$1 = {
|
|
837
767
|
step: number;
|
|
838
768
|
request_id: string;
|
|
839
|
-
tool_call:
|
|
769
|
+
tool_call: ToolCallWithArgumentsV0$1;
|
|
840
770
|
};
|
|
841
771
|
type NodeToolResultV0$1 = {
|
|
842
772
|
step: number;
|
|
843
773
|
request_id: string;
|
|
844
|
-
|
|
845
|
-
name: string;
|
|
774
|
+
tool_call: ToolCallV0$1;
|
|
846
775
|
output: string;
|
|
776
|
+
error?: string;
|
|
847
777
|
};
|
|
848
778
|
type PendingToolCallV0$1 = {
|
|
849
|
-
|
|
850
|
-
name: string;
|
|
851
|
-
arguments: string;
|
|
779
|
+
tool_call: ToolCallWithArgumentsV0$1;
|
|
852
780
|
};
|
|
853
781
|
type NodeWaitingV0$1 = {
|
|
854
782
|
step: number;
|
|
@@ -857,7 +785,7 @@ type NodeWaitingV0$1 = {
|
|
|
857
785
|
reason: string;
|
|
858
786
|
};
|
|
859
787
|
type RunEventBaseV0 = {
|
|
860
|
-
envelope_version: "
|
|
788
|
+
envelope_version: "v2";
|
|
861
789
|
run_id: RunId$1;
|
|
862
790
|
seq: number;
|
|
863
791
|
ts: string;
|
|
@@ -873,8 +801,7 @@ type RunEventRunStartedV0 = RunEventBaseV0 & {
|
|
|
873
801
|
type RunEventRunCompletedV0 = RunEventBaseV0 & {
|
|
874
802
|
type: "run_completed";
|
|
875
803
|
plan_hash: PlanHash$1;
|
|
876
|
-
|
|
877
|
-
outputs_info: PayloadInfoV0$1;
|
|
804
|
+
outputs: PayloadArtifactV0$1;
|
|
878
805
|
};
|
|
879
806
|
type RunEventRunFailedV0 = RunEventBaseV0 & {
|
|
880
807
|
type: "run_failed";
|
|
@@ -927,8 +854,7 @@ type RunEventNodeOutputDeltaV0 = RunEventBaseV0 & {
|
|
|
927
854
|
type RunEventNodeOutputV0 = RunEventBaseV0 & {
|
|
928
855
|
type: "node_output";
|
|
929
856
|
node_id: NodeId$1;
|
|
930
|
-
|
|
931
|
-
output_info: PayloadInfoV0$1;
|
|
857
|
+
output: PayloadArtifactV0$1;
|
|
932
858
|
};
|
|
933
859
|
type RunEventV0 = RunEventRunCompiledV0 | RunEventRunStartedV0 | RunEventRunCompletedV0 | RunEventRunFailedV0 | RunEventRunCanceledV0 | RunEventNodeLLMCallV0 | RunEventNodeToolCallV0 | RunEventNodeToolResultV0 | RunEventNodeWaitingV0 | RunEventNodeStartedV0 | RunEventNodeSucceededV0 | RunEventNodeFailedV0 | RunEventNodeOutputDeltaV0 | RunEventNodeOutputV0;
|
|
934
860
|
|
|
@@ -938,8 +864,7 @@ type RunsToolResultsRequest = {
|
|
|
938
864
|
step: number;
|
|
939
865
|
request_id: string;
|
|
940
866
|
results: Array<{
|
|
941
|
-
|
|
942
|
-
name: string;
|
|
867
|
+
tool_call: ToolCallV0$1;
|
|
943
868
|
output: string;
|
|
944
869
|
}>;
|
|
945
870
|
};
|
|
@@ -954,9 +879,7 @@ type RunsPendingToolsResponse = {
|
|
|
954
879
|
step: number;
|
|
955
880
|
request_id: string;
|
|
956
881
|
tool_calls: Array<{
|
|
957
|
-
|
|
958
|
-
name: string;
|
|
959
|
-
arguments: string;
|
|
882
|
+
tool_call: ToolCallWithArgumentsV0$1;
|
|
960
883
|
}>;
|
|
961
884
|
}>;
|
|
962
885
|
};
|
|
@@ -1031,6 +954,7 @@ type RunsCreateOptions = {
|
|
|
1031
954
|
customerId?: string;
|
|
1032
955
|
sessionId?: string;
|
|
1033
956
|
idempotencyKey?: string;
|
|
957
|
+
input?: Record<string, unknown>;
|
|
1034
958
|
signal?: AbortSignal;
|
|
1035
959
|
headers?: Record<string, string>;
|
|
1036
960
|
timeoutMs?: number;
|
|
@@ -1091,7 +1015,7 @@ declare class RunsClient {
|
|
|
1091
1015
|
trace?: TraceCallbacks;
|
|
1092
1016
|
});
|
|
1093
1017
|
private applyCustomerHeader;
|
|
1094
|
-
create(spec:
|
|
1018
|
+
create(spec: WorkflowSpecLiteV1, options?: RunsCreateOptions): Promise<RunsCreateResponse>;
|
|
1095
1019
|
runEventSchemaV0(options?: {
|
|
1096
1020
|
signal?: AbortSignal;
|
|
1097
1021
|
headers?: Record<string, string>;
|
|
@@ -1256,13 +1180,13 @@ type WorkflowsCompileOptions = {
|
|
|
1256
1180
|
metrics?: MetricsCallbacks;
|
|
1257
1181
|
trace?: TraceCallbacks;
|
|
1258
1182
|
};
|
|
1259
|
-
type
|
|
1183
|
+
type WorkflowsCompileResponse = {
|
|
1260
1184
|
plan_json: unknown;
|
|
1261
1185
|
plan_hash: PlanHash$1;
|
|
1262
1186
|
};
|
|
1263
|
-
type
|
|
1187
|
+
type WorkflowsCompileResult = ({
|
|
1264
1188
|
ok: true;
|
|
1265
|
-
} &
|
|
1189
|
+
} & WorkflowsCompileResponse) | {
|
|
1266
1190
|
ok: false;
|
|
1267
1191
|
error_type: "validation_error";
|
|
1268
1192
|
issues: ReadonlyArray<WorkflowValidationIssue>;
|
|
@@ -1283,7 +1207,7 @@ declare class WorkflowsClient {
|
|
|
1283
1207
|
metrics?: MetricsCallbacks;
|
|
1284
1208
|
trace?: TraceCallbacks;
|
|
1285
1209
|
});
|
|
1286
|
-
|
|
1210
|
+
compile(spec: WorkflowSpecLiteV1, options?: WorkflowsCompileOptions): Promise<WorkflowsCompileResult>;
|
|
1287
1211
|
}
|
|
1288
1212
|
|
|
1289
1213
|
/**
|
|
@@ -2320,78 +2244,62 @@ declare class JoinOutputPath {
|
|
|
2320
2244
|
*/
|
|
2321
2245
|
declare function JoinOutput(nodeId: string): JoinOutputPath;
|
|
2322
2246
|
|
|
2323
|
-
/** JSON pointer to extract text content from an LLM response output. */
|
|
2324
2247
|
declare const LLM_TEXT_OUTPUT: string;
|
|
2325
|
-
/** JSON pointer to inject text into the user message of an LLM request.
|
|
2326
|
-
* The pointer is relative to the request object (not the full node input). */
|
|
2327
2248
|
declare const LLM_USER_MESSAGE_TEXT: string;
|
|
2328
|
-
type
|
|
2249
|
+
type WorkflowIntentEdge = {
|
|
2329
2250
|
from: NodeId$1;
|
|
2330
|
-
|
|
2331
|
-
};
|
|
2332
|
-
declare function transformJSONValue(from: NodeId$1, pointer?: string): TransformJSONValueV1;
|
|
2333
|
-
declare function transformJSONObject(object: Record<string, TransformJSONValueV1>): {
|
|
2334
|
-
object: Record<string, TransformJSONValueV1>;
|
|
2335
|
-
};
|
|
2336
|
-
declare function transformJSONMerge(merge: ReadonlyArray<TransformJSONValueV1>): {
|
|
2337
|
-
merge: Array<TransformJSONValueV1>;
|
|
2251
|
+
to: NodeId$1;
|
|
2338
2252
|
};
|
|
2339
|
-
|
|
2340
|
-
* Error thrown when a binding targets a non-existent path in the request.
|
|
2341
|
-
*/
|
|
2342
|
-
declare class BindingTargetError extends Error {
|
|
2343
|
-
readonly nodeId: NodeId$1;
|
|
2344
|
-
readonly bindingIndex: number;
|
|
2345
|
-
readonly pointer: string;
|
|
2346
|
-
constructor(nodeId: NodeId$1, bindingIndex: number, pointer: string, message: string);
|
|
2347
|
-
}
|
|
2348
|
-
/**
|
|
2349
|
-
* Error thrown when a map.fanout node input is invalid.
|
|
2350
|
-
*/
|
|
2351
|
-
declare class MapFanoutInputError extends Error {
|
|
2352
|
-
readonly nodeId: NodeId$1;
|
|
2353
|
-
constructor(nodeId: NodeId$1, message: string);
|
|
2354
|
-
}
|
|
2355
|
-
type WorkflowBuilderV1State = {
|
|
2253
|
+
type WorkflowIntentBuilderState = {
|
|
2356
2254
|
readonly name?: string;
|
|
2357
|
-
readonly
|
|
2358
|
-
readonly nodes: ReadonlyArray<
|
|
2359
|
-
readonly edges: ReadonlyArray<
|
|
2360
|
-
readonly outputs: ReadonlyArray<
|
|
2255
|
+
readonly model?: string;
|
|
2256
|
+
readonly nodes: ReadonlyArray<WorkflowIntentNode>;
|
|
2257
|
+
readonly edges: ReadonlyArray<WorkflowIntentEdge>;
|
|
2258
|
+
readonly outputs: ReadonlyArray<WorkflowOutputRefLiteV1>;
|
|
2361
2259
|
};
|
|
2362
|
-
declare class
|
|
2260
|
+
declare class WorkflowIntentBuilder {
|
|
2363
2261
|
private readonly state;
|
|
2364
|
-
constructor(state?:
|
|
2365
|
-
static new(): WorkflowBuilderV1;
|
|
2262
|
+
constructor(state?: WorkflowIntentBuilderState);
|
|
2366
2263
|
private with;
|
|
2367
|
-
name(name: string):
|
|
2368
|
-
|
|
2369
|
-
node(node:
|
|
2370
|
-
|
|
2371
|
-
|
|
2372
|
-
|
|
2373
|
-
|
|
2374
|
-
|
|
2375
|
-
|
|
2376
|
-
|
|
2377
|
-
|
|
2378
|
-
|
|
2379
|
-
|
|
2380
|
-
|
|
2381
|
-
|
|
2382
|
-
|
|
2383
|
-
|
|
2384
|
-
|
|
2385
|
-
|
|
2386
|
-
|
|
2387
|
-
|
|
2388
|
-
|
|
2389
|
-
|
|
2390
|
-
|
|
2391
|
-
|
|
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;
|
|
2392
2300
|
|
|
2393
2301
|
declare const WORKFLOWS_COMPILE_PATH = "/workflows/compile";
|
|
2394
|
-
type
|
|
2302
|
+
type WorkflowsCompileRequest = WorkflowSpecLiteV1;
|
|
2395
2303
|
|
|
2396
2304
|
type NDJSONDelayStep = {
|
|
2397
2305
|
delayMs: number;
|
|
@@ -2573,381 +2481,15 @@ declare namespace index$1 {
|
|
|
2573
2481
|
}
|
|
2574
2482
|
|
|
2575
2483
|
/**
|
|
2576
|
-
*
|
|
2577
|
-
*
|
|
2578
|
-
* These factory functions reduce boilerplate when building conditional edges
|
|
2579
|
-
* and node bindings.
|
|
2580
|
-
*
|
|
2581
|
-
* @example
|
|
2582
|
-
* ```typescript
|
|
2583
|
-
* import { workflow, workflowV1 } from "@modelrelay/sdk";
|
|
2584
|
-
* import { whenOutputEquals, bindToPlaceholder } from "@modelrelay/sdk/workflow";
|
|
2585
|
-
*
|
|
2586
|
-
* const spec = workflowV1()
|
|
2587
|
-
* .routeSwitch("router", request)
|
|
2588
|
-
* .llmResponses("billing", billingReq, {
|
|
2589
|
-
* bindings: [bindToPlaceholder("router", "route_data")]
|
|
2590
|
-
* })
|
|
2591
|
-
* .edge("router", "billing", whenOutputEquals("$.route", "billing"))
|
|
2592
|
-
* .build();
|
|
2593
|
-
* ```
|
|
2594
|
-
*/
|
|
2595
|
-
|
|
2596
|
-
/**
|
|
2597
|
-
* Create a condition that matches when a node's output equals a specific value.
|
|
2598
|
-
*
|
|
2599
|
-
* @param path - JSONPath expression to extract the value (must start with $)
|
|
2600
|
-
* @param value - The value to compare against
|
|
2601
|
-
* @returns A condition for use in edge `when` clauses
|
|
2602
|
-
*
|
|
2603
|
-
* @example
|
|
2604
|
-
* ```typescript
|
|
2605
|
-
* builder.edge("router", "billing", whenOutputEquals("$.route", "billing"))
|
|
2606
|
-
* ```
|
|
2607
|
-
*/
|
|
2608
|
-
declare function whenOutputEquals(path: string, value: unknown): ConditionV1$1;
|
|
2609
|
-
/**
|
|
2610
|
-
* Create a condition that matches when a node's output matches a regex pattern.
|
|
2611
|
-
*
|
|
2612
|
-
* @param path - JSONPath expression to extract the value (must start with $)
|
|
2613
|
-
* @param pattern - Regular expression pattern to match
|
|
2614
|
-
* @returns A condition for use in edge `when` clauses
|
|
2615
|
-
*
|
|
2616
|
-
* @example
|
|
2617
|
-
* ```typescript
|
|
2618
|
-
* builder.edge("router", "handler", whenOutputMatches("$.category", "billing|support"))
|
|
2619
|
-
* ```
|
|
2620
|
-
*/
|
|
2621
|
-
declare function whenOutputMatches(path: string, pattern: string): ConditionV1$1;
|
|
2622
|
-
/**
|
|
2623
|
-
* Create a condition that matches when a path exists in the node's output.
|
|
2624
|
-
*
|
|
2625
|
-
* @param path - JSONPath expression to check for existence (must start with $)
|
|
2626
|
-
* @returns A condition for use in edge `when` clauses
|
|
2627
|
-
*
|
|
2628
|
-
* @example
|
|
2629
|
-
* ```typescript
|
|
2630
|
-
* builder.edge("router", "handler", whenOutputExists("$.special_case"))
|
|
2631
|
-
* ```
|
|
2632
|
-
*/
|
|
2633
|
-
declare function whenOutputExists(path: string): ConditionV1$1;
|
|
2634
|
-
/**
|
|
2635
|
-
* Create a condition that matches when a node's status equals a specific value.
|
|
2636
|
-
*
|
|
2637
|
-
* @param path - JSONPath expression to extract the status value (must start with $)
|
|
2638
|
-
* @param value - The status value to compare against
|
|
2639
|
-
* @returns A condition for use in edge `when` clauses
|
|
2640
|
-
*
|
|
2641
|
-
* @example
|
|
2642
|
-
* ```typescript
|
|
2643
|
-
* builder.edge("node", "handler", whenStatusEquals("$.status", "succeeded"))
|
|
2644
|
-
* ```
|
|
2645
|
-
*/
|
|
2646
|
-
declare function whenStatusEquals(path: string, value: unknown): ConditionV1$1;
|
|
2647
|
-
/**
|
|
2648
|
-
* Create a condition that matches when a node's status matches a regex pattern.
|
|
2649
|
-
*
|
|
2650
|
-
* @param path - JSONPath expression to extract the status value (must start with $)
|
|
2651
|
-
* @param pattern - Regular expression pattern to match
|
|
2652
|
-
* @returns A condition for use in edge `when` clauses
|
|
2653
|
-
*/
|
|
2654
|
-
declare function whenStatusMatches(path: string, pattern: string): ConditionV1$1;
|
|
2655
|
-
/**
|
|
2656
|
-
* Create a condition that matches when a path exists in the node's status.
|
|
2657
|
-
*
|
|
2658
|
-
* @param path - JSONPath expression to check for existence (must start with $)
|
|
2659
|
-
* @returns A condition for use in edge `when` clauses
|
|
2660
|
-
*/
|
|
2661
|
-
declare function whenStatusExists(path: string): ConditionV1$1;
|
|
2662
|
-
/**
|
|
2663
|
-
* Options for binding factory functions.
|
|
2664
|
-
*/
|
|
2665
|
-
interface BindingOptions {
|
|
2666
|
-
/** JSON pointer to extract from the source node's output */
|
|
2667
|
-
pointer?: string;
|
|
2668
|
-
/** Encoding to use (defaults to "json_string") */
|
|
2669
|
-
encoding?: LLMResponsesBindingEncodingV1;
|
|
2670
|
-
}
|
|
2671
|
-
/**
|
|
2672
|
-
* Create a binding that injects a value into a {{placeholder}} in the prompt.
|
|
2673
|
-
*
|
|
2674
|
-
* @param from - Source node ID
|
|
2675
|
-
* @param placeholder - Placeholder name (without the {{ }} delimiters)
|
|
2676
|
-
* @param opts - Optional pointer and encoding settings
|
|
2677
|
-
* @returns A binding for use in node input
|
|
2678
|
-
*
|
|
2679
|
-
* @example
|
|
2680
|
-
* ```typescript
|
|
2681
|
-
* builder.llmResponses("aggregate", request, {
|
|
2682
|
-
* bindings: [
|
|
2683
|
-
* bindToPlaceholder("join", "route_output"),
|
|
2684
|
-
* bindToPlaceholder("data", "user_data", { pointer: "/results" })
|
|
2685
|
-
* ]
|
|
2686
|
-
* })
|
|
2687
|
-
* ```
|
|
2688
|
-
*/
|
|
2689
|
-
declare function bindToPlaceholder(from: NodeId$1, placeholder: string, opts?: BindingOptions): LLMResponsesBindingV1;
|
|
2690
|
-
/**
|
|
2691
|
-
* Create a binding that injects a value at a specific JSON pointer in the request.
|
|
2692
|
-
*
|
|
2693
|
-
* @param from - Source node ID
|
|
2694
|
-
* @param to - JSON pointer in the request to inject the value
|
|
2695
|
-
* @param opts - Optional pointer and encoding settings
|
|
2696
|
-
* @returns A binding for use in node input
|
|
2697
|
-
*
|
|
2698
|
-
* @example
|
|
2699
|
-
* ```typescript
|
|
2700
|
-
* builder.llmResponses("processor", request, {
|
|
2701
|
-
* bindings: [
|
|
2702
|
-
* bindToPointer("source", "/input/0/content/0/text")
|
|
2703
|
-
* ]
|
|
2704
|
-
* })
|
|
2705
|
-
* ```
|
|
2706
|
-
*/
|
|
2707
|
-
declare function bindToPointer(from: NodeId$1, to: string, opts?: BindingOptions): LLMResponsesBindingV1;
|
|
2708
|
-
/**
|
|
2709
|
-
* Create a binding from a source node with full control over all fields.
|
|
2710
|
-
*
|
|
2711
|
-
* @param from - Source node ID
|
|
2712
|
-
* @returns A builder for fluent binding construction
|
|
2713
|
-
*
|
|
2714
|
-
* @example
|
|
2715
|
-
* ```typescript
|
|
2716
|
-
* const binding = bindFrom("source")
|
|
2717
|
-
* .pointer("/output/text")
|
|
2718
|
-
* .toPlaceholder("data")
|
|
2719
|
-
* .encoding("json")
|
|
2720
|
-
* .build();
|
|
2721
|
-
* ```
|
|
2722
|
-
*/
|
|
2723
|
-
declare function bindFrom(from: NodeId$1): BindingBuilder;
|
|
2724
|
-
/**
|
|
2725
|
-
* Fluent builder for constructing bindings.
|
|
2726
|
-
*/
|
|
2727
|
-
declare class BindingBuilder {
|
|
2728
|
-
private _from;
|
|
2729
|
-
private _pointer?;
|
|
2730
|
-
private _to?;
|
|
2731
|
-
private _toPlaceholder?;
|
|
2732
|
-
private _encoding;
|
|
2733
|
-
constructor(from: NodeId$1);
|
|
2734
|
-
/**
|
|
2735
|
-
* Set the source pointer to extract from the node's output.
|
|
2736
|
-
*/
|
|
2737
|
-
pointer(ptr: string): BindingBuilder;
|
|
2738
|
-
/**
|
|
2739
|
-
* Set the destination JSON pointer in the request.
|
|
2740
|
-
*/
|
|
2741
|
-
to(ptr: string): BindingBuilder;
|
|
2742
|
-
/**
|
|
2743
|
-
* Set the destination placeholder name.
|
|
2744
|
-
*/
|
|
2745
|
-
toPlaceholder(name: string): BindingBuilder;
|
|
2746
|
-
/**
|
|
2747
|
-
* Set the encoding for the binding value.
|
|
2748
|
-
*/
|
|
2749
|
-
encoding(enc: LLMResponsesBindingEncodingV1): BindingBuilder;
|
|
2750
|
-
/**
|
|
2751
|
-
* Build the binding object.
|
|
2752
|
-
*/
|
|
2753
|
-
build(): LLMResponsesBindingV1;
|
|
2754
|
-
}
|
|
2755
|
-
|
|
2756
|
-
/**
|
|
2757
|
-
* High-level pattern builders for workflow.v1.
|
|
2758
|
-
*
|
|
2759
|
-
* These builders provide ergonomic construction of common workflow patterns
|
|
2760
|
-
* like routing and fan-out/reduce, similar to the v0 Chain/Parallel/MapReduce patterns.
|
|
2761
|
-
*
|
|
2762
|
-
* @example
|
|
2763
|
-
* ```typescript
|
|
2764
|
-
* import { RouterV1, FanoutReduceV1 } from "@modelrelay/sdk/workflow";
|
|
2765
|
-
*
|
|
2766
|
-
* // Router pattern: classify input and route to specialized handlers
|
|
2767
|
-
* const routerSpec = new RouterV1({
|
|
2768
|
-
* classifier: { model: "gpt-4o-mini", input: [...] },
|
|
2769
|
-
* routes: [
|
|
2770
|
-
* { value: "billing", handler: { model: "gpt-4o", input: [...] } },
|
|
2771
|
-
* { value: "support", handler: { model: "gpt-4o", input: [...] } },
|
|
2772
|
-
* ]
|
|
2773
|
-
* }).build();
|
|
2774
|
-
*
|
|
2775
|
-
* // FanoutReduce pattern: generate items, process each, aggregate
|
|
2776
|
-
* const fanoutSpec = new FanoutReduceV1({
|
|
2777
|
-
* generator: { model: "gpt-4o-mini", input: [...] },
|
|
2778
|
-
* itemsPath: "/questions",
|
|
2779
|
-
* mapperPlaceholder: "question",
|
|
2780
|
-
* mapper: { model: "gpt-4o", input: [...] },
|
|
2781
|
-
* reducer: { model: "gpt-4o", input: [...] },
|
|
2782
|
-
* }).build();
|
|
2783
|
-
* ```
|
|
2784
|
-
*/
|
|
2785
|
-
|
|
2786
|
-
/**
|
|
2787
|
-
* A route definition for the router pattern.
|
|
2788
|
-
*/
|
|
2789
|
-
interface RouterRouteV1 {
|
|
2790
|
-
/** The value to match in the router output (at routePath) */
|
|
2791
|
-
value: string;
|
|
2792
|
-
/** The handler node ID (auto-generated if not provided) */
|
|
2793
|
-
id?: NodeId$1;
|
|
2794
|
-
/** The LLM request for this route's handler */
|
|
2795
|
-
handler: WireResponsesRequest | ResponsesRequest;
|
|
2796
|
-
/** Optional bindings for the handler */
|
|
2797
|
-
bindings?: ReadonlyArray<LLMResponsesBindingV1>;
|
|
2798
|
-
}
|
|
2799
|
-
/**
|
|
2800
|
-
* Configuration for the RouterV1 pattern builder.
|
|
2801
|
-
*/
|
|
2802
|
-
interface RouterConfigV1 {
|
|
2803
|
-
/** Optional workflow name */
|
|
2804
|
-
name?: string;
|
|
2805
|
-
/** The classifier/router node configuration */
|
|
2806
|
-
classifier: WireResponsesRequest | ResponsesRequest;
|
|
2807
|
-
/** Optional classifier node ID (defaults to "router") */
|
|
2808
|
-
classifierId?: NodeId$1;
|
|
2809
|
-
/** JSONPath to extract the route value from classifier output (defaults to "$.route") */
|
|
2810
|
-
routePath?: string;
|
|
2811
|
-
/** Route definitions mapping values to handlers */
|
|
2812
|
-
routes: RouterRouteV1[];
|
|
2813
|
-
/** Optional aggregator node to combine results */
|
|
2814
|
-
aggregator?: {
|
|
2815
|
-
/** Aggregator node ID (defaults to "aggregate") */
|
|
2816
|
-
id?: NodeId$1;
|
|
2817
|
-
/** The LLM request for aggregation */
|
|
2818
|
-
request: WireResponsesRequest | ResponsesRequest;
|
|
2819
|
-
/** Placeholder name for injecting the routed result (defaults to "route_output") */
|
|
2820
|
-
placeholder?: string;
|
|
2821
|
-
};
|
|
2822
|
-
/** Output name (defaults to "final") */
|
|
2823
|
-
outputName?: OutputName$1;
|
|
2824
|
-
}
|
|
2825
|
-
/**
|
|
2826
|
-
* Builder for the Router pattern in workflow.v1.
|
|
2827
|
-
*
|
|
2828
|
-
* The router pattern classifies input and routes to specialized handlers
|
|
2829
|
-
* based on the classification result. A join.any node collects the first
|
|
2830
|
-
* successful handler response.
|
|
2831
|
-
*
|
|
2832
|
-
* Topology:
|
|
2833
|
-
* ```
|
|
2834
|
-
* classifier --[when=billing]--> billing_handler --\
|
|
2835
|
-
* --[when=support]--> support_handler --> join.any --> [aggregator]
|
|
2836
|
-
* --[when=sales]--> sales_handler ----/
|
|
2837
|
-
* ```
|
|
2838
|
-
*
|
|
2839
|
-
* @example
|
|
2840
|
-
* ```typescript
|
|
2841
|
-
* const spec = new RouterV1({
|
|
2842
|
-
* classifier: {
|
|
2843
|
-
* model: "gpt-4o-mini",
|
|
2844
|
-
* input: [{ role: "user", content: "Classify: {{query}}" }]
|
|
2845
|
-
* },
|
|
2846
|
-
* routes: [
|
|
2847
|
-
* { value: "billing", handler: { model: "gpt-4o", input: [...] } },
|
|
2848
|
-
* { value: "support", handler: { model: "gpt-4o", input: [...] } },
|
|
2849
|
-
* ],
|
|
2850
|
-
* aggregator: {
|
|
2851
|
-
* request: { model: "gpt-4o", input: [...] },
|
|
2852
|
-
* placeholder: "route_output"
|
|
2853
|
-
* }
|
|
2854
|
-
* }).build();
|
|
2855
|
-
* ```
|
|
2856
|
-
*/
|
|
2857
|
-
declare class RouterV1 {
|
|
2858
|
-
private readonly config;
|
|
2859
|
-
constructor(config: RouterConfigV1);
|
|
2860
|
-
/**
|
|
2861
|
-
* Build the workflow specification.
|
|
2862
|
-
*/
|
|
2863
|
-
build(): WorkflowSpecV1;
|
|
2864
|
-
}
|
|
2865
|
-
/**
|
|
2866
|
-
* Configuration for the FanoutReduceV1 pattern builder.
|
|
2867
|
-
*/
|
|
2868
|
-
interface FanoutReduceConfigV1 {
|
|
2869
|
-
/** Optional workflow name */
|
|
2870
|
-
name?: string;
|
|
2871
|
-
/** The generator node that produces items to process */
|
|
2872
|
-
generator: WireResponsesRequest | ResponsesRequest;
|
|
2873
|
-
/** Generator node ID (defaults to "generator") */
|
|
2874
|
-
generatorId?: NodeId$1;
|
|
2875
|
-
/** JSON Pointer to extract items array from generator output (defaults to "/items") */
|
|
2876
|
-
itemsPath?: string;
|
|
2877
|
-
/** The mapper subnode template (processes each item) */
|
|
2878
|
-
mapper: WireResponsesRequest | ResponsesRequest;
|
|
2879
|
-
/** Placeholder name for item injection in mapper (defaults to "item") */
|
|
2880
|
-
mapperPlaceholder?: string;
|
|
2881
|
-
/** Maximum parallel mapper executions (defaults to 4) */
|
|
2882
|
-
maxParallelism?: number;
|
|
2883
|
-
/** The reducer node that aggregates results */
|
|
2884
|
-
reducer: WireResponsesRequest | ResponsesRequest;
|
|
2885
|
-
/** Reducer node ID (defaults to "reducer") */
|
|
2886
|
-
reducerId?: NodeId$1;
|
|
2887
|
-
/** How to inject fanout results into reducer */
|
|
2888
|
-
reducerBinding?: {
|
|
2889
|
-
/** Pointer to extract from fanout output (defaults to "/results") */
|
|
2890
|
-
pointer?: string;
|
|
2891
|
-
/** Placeholder name for injection (uses to_placeholder if set) */
|
|
2892
|
-
placeholder?: string;
|
|
2893
|
-
/** JSON pointer for injection (uses to if set, defaults to user message text) */
|
|
2894
|
-
to?: string;
|
|
2895
|
-
};
|
|
2896
|
-
/** Output name (defaults to "final") */
|
|
2897
|
-
outputName?: OutputName$1;
|
|
2898
|
-
}
|
|
2899
|
-
/**
|
|
2900
|
-
* Builder for the FanoutReduce pattern in workflow.v1.
|
|
2901
|
-
*
|
|
2902
|
-
* The fanout/reduce pattern generates a list of items, processes each item
|
|
2903
|
-
* in parallel using a mapper node, then aggregates all results.
|
|
2904
|
-
*
|
|
2905
|
-
* Topology:
|
|
2906
|
-
* ```
|
|
2907
|
-
* generator --> map.fanout(mapper) --> reducer
|
|
2908
|
-
* ```
|
|
2909
|
-
*
|
|
2910
|
-
* @example
|
|
2911
|
-
* ```typescript
|
|
2912
|
-
* const spec = new FanoutReduceV1({
|
|
2913
|
-
* generator: {
|
|
2914
|
-
* model: "gpt-4o-mini",
|
|
2915
|
-
* input: [{ role: "user", content: "Generate 3 questions about {{topic}}" }]
|
|
2916
|
-
* },
|
|
2917
|
-
* itemsPath: "/questions",
|
|
2918
|
-
* mapperPlaceholder: "question",
|
|
2919
|
-
* mapper: {
|
|
2920
|
-
* model: "gpt-4o",
|
|
2921
|
-
* input: [{ role: "system", content: "Answer: {{question}}" }]
|
|
2922
|
-
* },
|
|
2923
|
-
* reducer: {
|
|
2924
|
-
* model: "gpt-4o",
|
|
2925
|
-
* input: [{ role: "system", content: "Combine answers: {{results}}" }]
|
|
2926
|
-
* },
|
|
2927
|
-
* reducerBinding: { placeholder: "results" },
|
|
2928
|
-
* maxParallelism: 4,
|
|
2929
|
-
* }).build();
|
|
2930
|
-
* ```
|
|
2931
|
-
*/
|
|
2932
|
-
declare class FanoutReduceV1 {
|
|
2933
|
-
private readonly config;
|
|
2934
|
-
constructor(config: FanoutReduceConfigV1);
|
|
2935
|
-
/**
|
|
2936
|
-
* Build the workflow specification.
|
|
2937
|
-
*/
|
|
2938
|
-
build(): WorkflowSpecV1;
|
|
2939
|
-
}
|
|
2940
|
-
|
|
2941
|
-
/**
|
|
2942
|
-
* Workflow types with clean naming (no Workflow prefix).
|
|
2484
|
+
* Workflow.lite.v1 types with clean naming (no Workflow prefix).
|
|
2943
2485
|
*
|
|
2944
2486
|
* @example
|
|
2945
2487
|
* ```typescript
|
|
2946
2488
|
* import { workflow } from "@modelrelay/sdk";
|
|
2947
2489
|
*
|
|
2948
|
-
* const spec: workflow.
|
|
2949
|
-
* kind: workflow.
|
|
2950
|
-
* nodes: [{ id: "my_node", type: workflow.
|
|
2490
|
+
* const spec: workflow.SpecLiteV1 = {
|
|
2491
|
+
* kind: workflow.KindIntent,
|
|
2492
|
+
* nodes: [{ id: "my_node", type: workflow.NodeTypesLite.LLM, user: "hello" }],
|
|
2951
2493
|
* outputs: [],
|
|
2952
2494
|
* };
|
|
2953
2495
|
* ```
|
|
@@ -2959,18 +2501,12 @@ type RunId = RunId$1;
|
|
|
2959
2501
|
type PlanHash = PlanHash$1;
|
|
2960
2502
|
|
|
2961
2503
|
type Kind = WorkflowKind;
|
|
2962
|
-
type
|
|
2963
|
-
type
|
|
2964
|
-
type
|
|
2965
|
-
type
|
|
2966
|
-
type
|
|
2967
|
-
type
|
|
2968
|
-
type ToolLimitsV1 = LLMResponsesToolLimitsV1;
|
|
2969
|
-
type ToolExecutionV1 = ToolExecutionV1$1;
|
|
2970
|
-
type ToolExecutionModeV1 = ToolExecutionModeV1$1;
|
|
2971
|
-
type ConditionV1 = ConditionV1$1;
|
|
2972
|
-
type ConditionOpV1 = ConditionOpV1$1;
|
|
2973
|
-
type ConditionSourceV1 = ConditionSourceV1$1;
|
|
2504
|
+
type SpecLiteV1 = WorkflowSpecLiteV1;
|
|
2505
|
+
type IntentNode = WorkflowIntentNode;
|
|
2506
|
+
type OutputRefLiteV1 = WorkflowOutputRefLiteV1;
|
|
2507
|
+
type Condition = WorkflowIntentCondition;
|
|
2508
|
+
type ConditionOp = WorkflowIntentConditionOp;
|
|
2509
|
+
type ConditionSource = WorkflowIntentConditionSource;
|
|
2974
2510
|
type StatusV0 = RunStatusV0;
|
|
2975
2511
|
type EventTypeV0 = RunEventTypeV0;
|
|
2976
2512
|
type EventV0 = RunEventV0;
|
|
@@ -2996,40 +2532,26 @@ type NodeToolCallV0 = NodeToolCallV0$1;
|
|
|
2996
2532
|
type NodeToolResultV0 = NodeToolResultV0$1;
|
|
2997
2533
|
type NodeWaitingV0 = NodeWaitingV0$1;
|
|
2998
2534
|
type PendingToolCallV0 = PendingToolCallV0$1;
|
|
2999
|
-
type
|
|
2535
|
+
type ToolCallV0 = ToolCallV0$1;
|
|
2536
|
+
type ToolCallWithArgumentsV0 = ToolCallWithArgumentsV0$1;
|
|
3000
2537
|
type TokenUsageV0 = TokenUsageV0$1;
|
|
3001
2538
|
type PayloadInfoV0 = PayloadInfoV0$1;
|
|
2539
|
+
type PayloadArtifactV0 = PayloadArtifactV0$1;
|
|
3002
2540
|
type StreamEventKind = StreamEventKind$1;
|
|
3003
|
-
declare const
|
|
3004
|
-
declare const
|
|
3005
|
-
readonly
|
|
3006
|
-
readonly RouteSwitch: "route.switch";
|
|
2541
|
+
declare const KindIntent: "workflow";
|
|
2542
|
+
declare const NodeTypesLite: {
|
|
2543
|
+
readonly LLM: "llm";
|
|
3007
2544
|
readonly JoinAll: "join.all";
|
|
3008
2545
|
readonly JoinAny: "join.any";
|
|
3009
2546
|
readonly JoinCollect: "join.collect";
|
|
3010
2547
|
readonly TransformJSON: "transform.json";
|
|
3011
2548
|
readonly MapFanout: "map.fanout";
|
|
3012
2549
|
};
|
|
3013
|
-
type
|
|
3014
|
-
declare const BindingEncodings: {
|
|
3015
|
-
readonly JSON: "json";
|
|
3016
|
-
readonly JSONString: "json_string";
|
|
3017
|
-
};
|
|
3018
|
-
declare const ToolExecutionModes: {
|
|
3019
|
-
readonly Server: "server";
|
|
3020
|
-
readonly Client: "client";
|
|
3021
|
-
};
|
|
2550
|
+
type NodeTypeLite = (typeof NodeTypesLite)[keyof typeof NodeTypesLite];
|
|
3022
2551
|
|
|
3023
|
-
type
|
|
3024
|
-
|
|
3025
|
-
type
|
|
3026
|
-
declare const index_BindingEncodings: typeof BindingEncodings;
|
|
3027
|
-
type index_BindingOptions = BindingOptions;
|
|
3028
|
-
type index_BindingV1 = BindingV1;
|
|
3029
|
-
type index_ConditionOpV1 = ConditionOpV1;
|
|
3030
|
-
type index_ConditionSourceV1 = ConditionSourceV1;
|
|
3031
|
-
type index_ConditionV1 = ConditionV1;
|
|
3032
|
-
type index_EdgeV1 = EdgeV1;
|
|
2552
|
+
type index_Condition = Condition;
|
|
2553
|
+
type index_ConditionOp = ConditionOp;
|
|
2554
|
+
type index_ConditionSource = ConditionSource;
|
|
3033
2555
|
type index_EventBaseV0 = EventBaseV0;
|
|
3034
2556
|
type index_EventNodeFailedV0 = EventNodeFailedV0;
|
|
3035
2557
|
type index_EventNodeLLMCallV0 = EventNodeLLMCallV0;
|
|
@@ -3047,12 +2569,11 @@ type index_EventRunFailedV0 = EventRunFailedV0;
|
|
|
3047
2569
|
type index_EventRunStartedV0 = EventRunStartedV0;
|
|
3048
2570
|
type index_EventTypeV0 = EventTypeV0;
|
|
3049
2571
|
type index_EventV0 = EventV0;
|
|
3050
|
-
type
|
|
3051
|
-
type index_FanoutReduceV1 = FanoutReduceV1;
|
|
3052
|
-
declare const index_FanoutReduceV1: typeof FanoutReduceV1;
|
|
3053
|
-
type index_FunctionToolCallV0 = FunctionToolCallV0;
|
|
2572
|
+
type index_IntentNode = IntentNode;
|
|
3054
2573
|
type index_Kind = Kind;
|
|
3055
|
-
declare const
|
|
2574
|
+
declare const index_KindIntent: typeof KindIntent;
|
|
2575
|
+
type index_LLMNodeBuilder = LLMNodeBuilder;
|
|
2576
|
+
declare const index_LLMNodeBuilder: typeof LLMNodeBuilder;
|
|
3056
2577
|
declare const index_LLM_TEXT_OUTPUT: typeof LLM_TEXT_OUTPUT;
|
|
3057
2578
|
declare const index_LLM_USER_MESSAGE_TEXT: typeof LLM_USER_MESSAGE_TEXT;
|
|
3058
2579
|
type index_NodeErrorV0 = NodeErrorV0;
|
|
@@ -3061,46 +2582,31 @@ type index_NodeLLMCallV0 = NodeLLMCallV0;
|
|
|
3061
2582
|
type index_NodeOutputDeltaV0 = NodeOutputDeltaV0;
|
|
3062
2583
|
type index_NodeToolCallV0 = NodeToolCallV0;
|
|
3063
2584
|
type index_NodeToolResultV0 = NodeToolResultV0;
|
|
3064
|
-
type
|
|
3065
|
-
declare const
|
|
3066
|
-
type index_NodeV1 = NodeV1;
|
|
2585
|
+
type index_NodeTypeLite = NodeTypeLite;
|
|
2586
|
+
declare const index_NodeTypesLite: typeof NodeTypesLite;
|
|
3067
2587
|
type index_NodeWaitingV0 = NodeWaitingV0;
|
|
3068
2588
|
type index_OutputName = OutputName;
|
|
3069
|
-
type
|
|
2589
|
+
type index_OutputRefLiteV1 = OutputRefLiteV1;
|
|
2590
|
+
type index_PayloadArtifactV0 = PayloadArtifactV0;
|
|
3070
2591
|
type index_PayloadInfoV0 = PayloadInfoV0;
|
|
3071
2592
|
type index_PendingToolCallV0 = PendingToolCallV0;
|
|
3072
2593
|
type index_PlanHash = PlanHash;
|
|
3073
|
-
type index_RouterConfigV1 = RouterConfigV1;
|
|
3074
|
-
type index_RouterRouteV1 = RouterRouteV1;
|
|
3075
|
-
type index_RouterV1 = RouterV1;
|
|
3076
|
-
declare const index_RouterV1: typeof RouterV1;
|
|
3077
2594
|
type index_RunId = RunId;
|
|
3078
|
-
type
|
|
2595
|
+
type index_SpecLiteV1 = SpecLiteV1;
|
|
3079
2596
|
type index_StatusV0 = StatusV0;
|
|
3080
2597
|
type index_StreamEventKind = StreamEventKind;
|
|
3081
2598
|
type index_TokenUsageV0 = TokenUsageV0;
|
|
3082
|
-
type
|
|
3083
|
-
|
|
3084
|
-
type
|
|
3085
|
-
|
|
3086
|
-
type index_WorkflowBuilderV1 = WorkflowBuilderV1;
|
|
3087
|
-
declare const index_WorkflowBuilderV1: typeof WorkflowBuilderV1;
|
|
3088
|
-
declare const index_bindFrom: typeof bindFrom;
|
|
3089
|
-
declare const index_bindToPlaceholder: typeof bindToPlaceholder;
|
|
3090
|
-
declare const index_bindToPointer: typeof bindToPointer;
|
|
2599
|
+
type index_ToolCallV0 = ToolCallV0;
|
|
2600
|
+
type index_ToolCallWithArgumentsV0 = ToolCallWithArgumentsV0;
|
|
2601
|
+
type index_WorkflowIntentBuilder = WorkflowIntentBuilder;
|
|
2602
|
+
declare const index_WorkflowIntentBuilder: typeof WorkflowIntentBuilder;
|
|
3091
2603
|
declare const index_parseNodeId: typeof parseNodeId;
|
|
3092
2604
|
declare const index_parseOutputName: typeof parseOutputName;
|
|
3093
2605
|
declare const index_parsePlanHash: typeof parsePlanHash;
|
|
3094
2606
|
declare const index_parseRunId: typeof parseRunId;
|
|
3095
|
-
declare const
|
|
3096
|
-
declare const index_whenOutputExists: typeof whenOutputExists;
|
|
3097
|
-
declare const index_whenOutputMatches: typeof whenOutputMatches;
|
|
3098
|
-
declare const index_whenStatusEquals: typeof whenStatusEquals;
|
|
3099
|
-
declare const index_whenStatusExists: typeof whenStatusExists;
|
|
3100
|
-
declare const index_whenStatusMatches: typeof whenStatusMatches;
|
|
3101
|
-
declare const index_workflowV1: typeof workflowV1;
|
|
2607
|
+
declare const index_workflowIntent: typeof workflowIntent;
|
|
3102
2608
|
declare namespace index {
|
|
3103
|
-
export {
|
|
2609
|
+
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 };
|
|
3104
2610
|
}
|
|
3105
2611
|
|
|
3106
2612
|
/**
|
|
@@ -3154,4 +2660,4 @@ declare class ModelRelay {
|
|
|
3154
2660
|
forCustomer(customerId: string): CustomerScopedModelRelay;
|
|
3155
2661
|
}
|
|
3156
2662
|
|
|
3157
|
-
export { APIError, ApiKey, type AttemptRecord, AuthClient, type AuthHeaders,
|
|
2663
|
+
export { APIError, ApiKey, type AttemptRecord, AuthClient, type AuthHeaders, 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, 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, createAccessTokenAuth, createApiKeyAuth, createLocalSession, createMemorySessionStore, createMockFetchQueue, createToolRunner, defaultRetryHandler, defaultTierModelId, generateSessionId, index$1 as generated, isSecretKey, outputFormatFromZod, parseApiKey, parseErrorResponse, parseNodeId, parseOutputName, parsePlanHash, parseRunId, parseSecretKey, validateWithZod, index as workflow, workflowIntent };
|