Skip to content

Commit 1996cc1

Browse files
committed
improvements for more reliable/robust flows and a more robust openai llm integration flow
1 parent 6e4ce4c commit 1996cc1

File tree

13 files changed

+294
-179
lines changed

13 files changed

+294
-179
lines changed

examples-test-flows/openai-fetch-completion-as-stream-with-toolcall.json

Lines changed: 75 additions & 106 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88
"nodes": [
99
{
1010
"id": "8f4ac174-5c8e-45da-8ad4-a81a40f4f666",
11-
"x": 4018.001194935557,
12-
"y": 1005.8785419019923,
11+
"x": 4018.000870558403,
12+
"y": 1005.8784135831913,
1313
"width": 270.4013005316974,
1414
"height": 221.78921192887083,
1515
"nodeType": "Shape",
@@ -26,15 +26,15 @@
2626
},
2727
{
2828
"id": "3cf44538-9913-4aa2-aade-a7c619910f45",
29-
"x": 2886.530679091066,
30-
"y": 1087.7022502825994,
29+
"x": 2884.773835034504,
30+
"y": 1092.945931537805,
3131
"width": 178.5078125,
3232
"height": 80,
3333
"nodeType": "Shape",
3434
"nodeInfo": {
3535
"type": "json-node",
3636
"formValues": {
37-
"json": "{ \n \"@map\": {\n \"@comment\": \"this maps input.messages to messages\",\n \"input\": \"chat\",\n \"property\": \"messages\",\n \"map\": {\n \"type\": \"object\",\n \"properties\": {\n \"@set:role\": \"role\",\n \"@set:content\": \"message\"\n }\n }\n }, \n \"@pushTo:messages\": {\n \"@comment\": \"this pushes a new message to messages\",\n \"role\": \"system\",\n \"@set:content\": \"input\"\n },\n \"temperature\": 0.6,\n \"model\": \"gpt-4-turbo\",\n \"max_tokens\": 30,\n \"stream\": true,\n \"tools\": [\n {\n \"type\": \"function\",\n \"function\": {\n \"name\": \"get_current_weather\",\n \"description\": \"Get the current weather in a given location\",\n \"parameters\": {\n \"type\": \"object\",\n \"properties\": {\n \"location\": {\n \"type\": \"string\",\n \"description\": \"The city and state, e.g. San Francisco, CA\"\n },\n \"unit\": {\n \"type\": \"string\",\n \"enum\": [\"celsius\", \"fahrenheit\"]\n }\n },\n \"required\": [\"location\"]\n }\n }\n }\n ],\n \"tool_choice\": \"auto\"\n}"
37+
"json": "{ \n \"@pushTo:messages:1\": {\n \"@comment\": \"this pushes a new message to messages\",\n \"role\": \"system\",\n \"content\": \"you're a helpful assistant\"\n },\n \"@map\": {\n \"@comment\": \"this maps input.messages to messages\",\n \"input\": \"chat\",\n \"property\": \"messages\",\n \"map\": {\n \"type\": \"object\",\n \"properties\": {\n \"@set:role\": \"role\",\n \"@set:content\": \"message\"\n }\n }\n }, \n \"@pushTo:messages:2\": {\n \"@comment\": \"this pushes a new message to messages\",\n \"role\": \"user\",\n \"@set:content\": \"input\"\n },\n \"temperature\": 0.6,\n \"model\": \"gpt-4-turbo\",\n \"max_tokens\": 30,\n \"stream\": true,\n \"tools\": [\n {\n \"type\": \"function\",\n \"function\": {\n \"name\": \"get_current_weather\",\n \"description\": \"Get the current weather in a given location\",\n \"parameters\": {\n \"type\": \"object\",\n \"properties\": {\n \"location\": {\n \"type\": \"string\",\n \"description\": \"The city and state, e.g. San Francisco, CA\"\n },\n \"unit\": {\n \"type\": \"string\",\n \"enum\": [\"celsius\", \"fahrenheit\"]\n }\n },\n \"required\": [\"location\"]\n }\n }\n }\n ],\n \"tool_choice\": \"auto\"\n}"
3838
},
3939
"nodeCannotBeReplaced": true,
4040
"showFormOnlyInPopup": true,
@@ -44,10 +44,10 @@
4444
},
4545
{
4646
"id": "d186a002-218b-47dc-aae8-07522a3da6ed",
47-
"x": 4483.128089787184,
48-
"y": 1055.631264357424,
49-
"width": 119.99994892943876,
50-
"height": 271.9999476823221,
47+
"x": 4478.709650312037,
48+
"y": 1049.7659395381786,
49+
"width": 120.00026219138137,
50+
"height": 271.99996617879617,
5151
"nodeType": "Shape",
5252
"nodeInfo": {
5353
"type": "show-input",
@@ -61,10 +61,10 @@
6161
},
6262
{
6363
"id": "383eb9cf-3b45-489e-8281-720b702b9159",
64-
"x": 3302.618503441852,
65-
"y": 529.4952407721033,
66-
"width": 240.00003417791402,
67-
"height": 216.00004186971287,
64+
"x": 3302.6184447265578,
65+
"y": 528.2644630083273,
66+
"width": 136.6719108291816,
67+
"height": 300.0000056974173,
6868
"nodeType": "Shape",
6969
"nodeInfo": {
7070
"type": "scope-variable",
@@ -117,8 +117,8 @@
117117
},
118118
{
119119
"id": "bfc480ee-0c81-4221-a725-252298402221",
120-
"x": 4762.8962698236355,
121-
"y": 1061.0163345637106,
120+
"x": 4808.82988279589,
121+
"y": 977.1597314400699,
122122
"width": 110,
123123
"height": 110,
124124
"nodeType": "Shape",
@@ -127,22 +127,6 @@
127127
"formValues": {}
128128
}
129129
},
130-
{
131-
"id": "62d6f81d-08f3-4379-8c9f-f41f3452ea52",
132-
"x": 5023.995662279095,
133-
"y": 1081.1967122309472,
134-
"width": 150,
135-
"height": 150,
136-
"nodeType": "Shape",
137-
"nodeInfo": {
138-
"type": "if-condition",
139-
"formValues": {
140-
"Mode": "expression",
141-
"expression": "choices[0].delta.role != \"assistant\"",
142-
"inputType": "boolean"
143-
}
144-
}
145-
},
146130
{
147131
"id": "604d00b5-69c4-4beb-8aca-394674de0d61",
148132
"x": 3778.1804795215508,
@@ -203,8 +187,8 @@
203187
"id": "b936e1cd-134c-4476-b412-342c7d89c762",
204188
"x": 5386.76078539173,
205189
"y": 1471.9176827094705,
206-
"width": 120.00001708895701,
207-
"height": 103.99998518485536,
190+
"width": 120.00026219138137,
191+
"height": 104.00005395758755,
208192
"nodeType": "Shape",
209193
"nodeInfo": {
210194
"type": "show-input",
@@ -236,8 +220,8 @@
236220
},
237221
{
238222
"id": "6631fbab-1a06-4f8e-9abc-ee8ac2c3f923",
239-
"x": 2179.535249615978,
240-
"y": 1039.0974158395657,
223+
"x": 2179.5353893846127,
224+
"y": 1041.40584559574,
241225
"width": 434.54733649065247,
242226
"height": 185.8378093625031,
243227
"nodeType": "Shape",
@@ -257,8 +241,8 @@
257241
"id": "6e164a19-962b-412d-ad81-8505dcc24783",
258242
"x": 3750.292871193505,
259243
"y": 557.7131389156825,
260-
"width": 240.00003417791402,
261-
"height": 144.00000939715815,
244+
"width": 136.6719108291816,
245+
"height": 420.00005129511993,
262246
"nodeType": "Shape",
263247
"nodeInfo": {
264248
"type": "scope-variable",
@@ -410,8 +394,8 @@
410394
},
411395
{
412396
"id": "4d4ecef5-1cfd-4208-b04e-b1772969c127",
413-
"x": 5319.014978761918,
414-
"y": 893.438835639887,
397+
"x": 5319.014895916903,
398+
"y": 893.4388842888031,
415399
"width": 357.06596157040985,
416400
"height": 203.5263261975747,
417401
"nodeType": "Shape",
@@ -485,10 +469,10 @@
485469
},
486470
{
487471
"id": "597efff5-91e1-40f2-bd4d-993567abb93a",
488-
"x": 4136.596689010678,
489-
"y": 525.8275219295643,
490-
"width": 120.00013253873077,
491-
"height": 108.00000116087155,
472+
"x": 4136.59680841861,
473+
"y": 526.2205686983754,
474+
"width": 186.835834113889,
475+
"height": 84.00003337938271,
492476
"nodeType": "Shape",
493477
"nodeInfo": {
494478
"type": "scope-variable",
@@ -723,10 +707,10 @@
723707
},
724708
{
725709
"id": "f02b98f8-d7be-40ec-82da-0fcaddda5663",
726-
"x": 6021.410858818388,
727-
"y": 2273.5351450129733,
728-
"width": 120.00001708895701,
729-
"height": 272.00020908202,
710+
"x": 6020.7092112533,
711+
"y": 2274.701394685855,
712+
"width": 119.99982900402395,
713+
"height": 272.00007447563553,
730714
"nodeType": "Shape",
731715
"nodeInfo": {
732716
"type": "show-input",
@@ -740,10 +724,10 @@
740724
},
741725
{
742726
"id": "a16c5c54-c867-41af-a922-9a014786c513",
743-
"x": 4288.402495467255,
744-
"y": 1035.8785419019923,
745-
"endX": 4483.128089787184,
746-
"endY": 1085.631264357424,
727+
"x": 4288.402171090101,
728+
"y": 1035.8784135831913,
729+
"endX": 4478.709650312037,
730+
"endY": 1079.7659395381786,
747731
"startNodeId": "8f4ac174-5c8e-45da-8ad4-a81a40f4f666",
748732
"endNodeId": "d186a002-218b-47dc-aae8-07522a3da6ed",
749733
"startThumbName": "output",
@@ -755,10 +739,10 @@
755739
},
756740
{
757741
"id": "9c9efadf-8473-439f-849b-1fa8cbc09ad5",
758-
"x": 4603.1280387166225,
759-
"y": 1085.631264357424,
760-
"endX": 4762.8962698236355,
761-
"endY": 1116.0163345637106,
742+
"x": 4598.709912503419,
743+
"y": 1079.7659395381786,
744+
"endX": 4808.82988279589,
745+
"endY": 1032.15973144007,
762746
"startNodeId": "d186a002-218b-47dc-aae8-07522a3da6ed",
763747
"endNodeId": "bfc480ee-0c81-4221-a725-252298402221",
764748
"startThumbName": "output",
@@ -768,42 +752,12 @@
768752
"layer": 1,
769753
"nodeInfo": {}
770754
},
771-
{
772-
"id": "441e2ae8-bb43-4d98-b5c2-73b5d33f1884",
773-
"x": 4872.8962698236355,
774-
"y": 1141.0163345637106,
775-
"endX": 5023.995662279095,
776-
"endY": 1156.1967122309472,
777-
"startNodeId": "bfc480ee-0c81-4221-a725-252298402221",
778-
"endNodeId": "62d6f81d-08f3-4379-8c9f-f41f3452ea52",
779-
"startThumbName": "output2",
780-
"endThumbName": "input",
781-
"lineType": "BezierCubic",
782-
"nodeType": "Connection",
783-
"layer": 1,
784-
"nodeInfo": {}
785-
},
786-
{
787-
"id": "3766e220-8955-4981-9ea5-94bd56926cc1",
788-
"x": 5098.995662279095,
789-
"y": 1081.1967122309472,
790-
"endX": 5319.014978761918,
791-
"endY": 995.2019987386743,
792-
"startNodeId": "62d6f81d-08f3-4379-8c9f-f41f3452ea52",
793-
"endNodeId": "4d4ecef5-1cfd-4208-b04e-b1772969c127",
794-
"startThumbName": "success",
795-
"endThumbName": "input",
796-
"lineType": "BezierCubic",
797-
"nodeType": "Connection",
798-
"layer": 1,
799-
"nodeInfo": {}
800-
},
801755
{
802756
"id": "b58697e4-82bf-4d83-917a-03be6daedc12",
803757
"x": 3887.1033641109398,
804758
"y": 1119.1708983882722,
805-
"endX": 4018.001194935557,
806-
"endY": 1116.7731478664277,
759+
"endX": 4018.000870558403,
760+
"endY": 1116.7730195476267,
807761
"startNodeId": "2a227359-4016-4fa7-9788-948030bc0e90",
808762
"endNodeId": "8f4ac174-5c8e-45da-8ad4-a81a40f4f666",
809763
"startThumbName": "output",
@@ -815,8 +769,8 @@
815769
},
816770
{
817771
"id": "0dd730cc-1691-454f-868c-cb19da250699",
818-
"x": 4288.402495467255,
819-
"y": 1185.8785419019923,
772+
"x": 4288.402171090101,
773+
"y": 1185.8784135831913,
820774
"endX": 4613.562367206762,
821775
"endY": 1478.0828093084283,
822776
"startNodeId": "8f4ac174-5c8e-45da-8ad4-a81a40f4f666",
@@ -860,10 +814,10 @@
860814
},
861815
{
862816
"id": "3601f5bf-09f9-401d-b7de-28d1be639fb5",
863-
"x": 2614.0825861066305,
864-
"y": 1118.0974158395657,
865-
"endX": 2886.530679091066,
866-
"endY": 1127.7022502825994,
817+
"x": 2614.082725875265,
818+
"y": 1120.40584559574,
819+
"endX": 2884.773835034504,
820+
"endY": 1132.945931537805,
867821
"startNodeId": "6631fbab-1a06-4f8e-9abc-ee8ac2c3f923",
868822
"endNodeId": "3cf44538-9913-4aa2-aade-a7c619910f45",
869823
"startThumbName": "output",
@@ -875,8 +829,8 @@
875829
},
876830
{
877831
"id": "993273ac-60cc-4c0b-9f50-31b62d6ec3f0",
878-
"x": 3065.038491591066,
879-
"y": 1127.7022502825994,
832+
"x": 3063.281647534504,
833+
"y": 1132.945931537805,
880834
"endX": 3286.817011462188,
881835
"endY": 1119.1708983882722,
882836
"startNodeId": "3cf44538-9913-4aa2-aade-a7c619910f45",
@@ -890,7 +844,7 @@
890844
},
891845
{
892846
"id": "7619188f-269f-46a1-b144-d641b411a547",
893-
"x": 5506.760802480687,
847+
"x": 5506.761047583112,
894848
"y": 1501.9176827094705,
895849
"endX": 5660.339934319284,
896850
"endY": 1508.1553278560464,
@@ -950,8 +904,8 @@
950904
},
951905
{
952906
"id": "000e9d47-dfae-4e6e-a9b9-32ccb2eeb6f4",
953-
"x": 2614.0825861066305,
954-
"y": 1118.0974158395657,
907+
"x": 2614.082725875265,
908+
"y": 1120.40584559574,
955909
"endX": 2864.01552290941,
956910
"endY": 1340.7535959916072,
957911
"startNodeId": "6631fbab-1a06-4f8e-9abc-ee8ac2c3f923",
@@ -995,8 +949,8 @@
995949
},
996950
{
997951
"id": "3ddb52ba-1be0-4db8-9a76-96e31bbbbf0e",
998-
"x": 5676.080940332328,
999-
"y": 934.438835639887,
952+
"x": 5676.080857487313,
953+
"y": 934.4388842888031,
1000954
"endX": 5810.519744967219,
1001955
"endY": 856.5678705012955,
1002956
"startNodeId": "4d4ecef5-1cfd-4208-b04e-b1772969c127",
@@ -1010,8 +964,8 @@
1010964
},
1011965
{
1012966
"id": "69125950-e400-4c25-bb27-85a6538817cb",
1013-
"x": 5676.080940332328,
1014-
"y": 974.438835639887,
967+
"x": 5676.080857487313,
968+
"y": 974.4388842888031,
1015969
"endX": 5874.434653632948,
1016970
"endY": 1044.742694970008,
1017971
"startNodeId": "4d4ecef5-1cfd-4208-b04e-b1772969c127",
@@ -1055,8 +1009,8 @@
10551009
},
10561010
{
10571011
"id": "edde2b26-d006-4aad-8faf-1a5a5e8cb49a",
1058-
"x": 5676.080940332328,
1059-
"y": 1014.438835639887,
1012+
"x": 5676.080857487313,
1013+
"y": 1014.4388842888031,
10601014
"endX": 5806.882291697722,
10611015
"endY": 1228.425800281837,
10621016
"startNodeId": "4d4ecef5-1cfd-4208-b04e-b1772969c127",
@@ -1162,8 +1116,8 @@
11621116
"id": "45b89ff9-cea6-4ddd-85ed-f1925f7f1730",
11631117
"x": 5768.971508916734,
11641118
"y": 2299.7993271591404,
1165-
"endX": 6021.410858818388,
1166-
"endY": 2303.5351450129733,
1119+
"endX": 6020.7092112533,
1120+
"endY": 2304.701394685855,
11671121
"startNodeId": "9cfbb4cf-59ea-40ae-898e-d232d139b3c4",
11681122
"endNodeId": "f02b98f8-d7be-40ec-82da-0fcaddda5663",
11691123
"startThumbName": "output",
@@ -1172,6 +1126,21 @@
11721126
"nodeType": "Connection",
11731127
"layer": 1,
11741128
"nodeInfo": {}
1129+
},
1130+
{
1131+
"id": "03b55861-807c-4c62-a11b-8a38d9d343c8",
1132+
"x": 4918.82988279589,
1133+
"y": 1057.15973144007,
1134+
"endX": 5319.014895916903,
1135+
"endY": 995.2020473875905,
1136+
"startNodeId": "bfc480ee-0c81-4221-a725-252298402221",
1137+
"endNodeId": "4d4ecef5-1cfd-4208-b04e-b1772969c127",
1138+
"startThumbName": "output2",
1139+
"endThumbName": "input",
1140+
"lineType": "BezierCubic",
1141+
"nodeType": "Connection",
1142+
"layer": 1,
1143+
"nodeInfo": {}
11751144
}
11761145
]
11771146
}

libs/visual-programming-system/src/canvas-app/base-flow.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ export interface IBaseFlow<T extends BaseNodeInfo> {
9999
markup?: string | INodeComponent<T> | HTMLElement,
100100
layoutProperties?: {
101101
classNames?: string;
102+
autoSizeToContentIfNodeHasNoThumbs?: boolean;
102103
},
103104
hasStaticWidthHeight?: boolean,
104105
disableInteraction?: boolean,
@@ -120,6 +121,7 @@ export interface IBaseFlow<T extends BaseNodeInfo> {
120121
markup?: string | INodeComponent<T> | undefined,
121122
layoutProperties?: {
122123
classNames?: string;
124+
autoSizeToContentIfNodeHasNoThumbs?: boolean;
123125
},
124126
hasStaticWidthHeight?: boolean,
125127
disableInteraction?: boolean,

0 commit comments

Comments
 (0)