@@ -42,6 +42,7 @@ public void testAgent() throws ExecutionException, InterruptedException {
42
42
43
43
when (storySeedAgent .invoke (eq ("A Great Story" ))).thenReturn ("storySeedAgent" );
44
44
when (storySeedAgent .outputName ()).thenReturn ("premise" );
45
+ when (storySeedAgent .name ()).thenReturn ("storySeedAgent" );
45
46
46
47
Workflow workflow =
47
48
AgentWorkflowBuilder .workflow ("storyFlow" )
@@ -72,12 +73,15 @@ public void testAgents() throws ExecutionException, InterruptedException {
72
73
73
74
when (storySeedAgent .invoke (eq ("A Great Story" ))).thenReturn ("storySeedAgent" );
74
75
when (storySeedAgent .outputName ()).thenReturn ("premise" );
76
+ when (storySeedAgent .name ()).thenReturn ("storySeedAgent" );
75
77
76
78
when (plotAgent .invoke (eq ("storySeedAgent" ))).thenReturn ("plotAgent" );
77
79
when (plotAgent .outputName ()).thenReturn ("plot" );
80
+ when (plotAgent .name ()).thenReturn ("plotAgent" );
78
81
79
82
when (sceneAgent .invoke (eq ("plotAgent" ))).thenReturn ("sceneAgent" );
80
83
when (sceneAgent .outputName ()).thenReturn ("story" );
84
+ when (sceneAgent .name ()).thenReturn ("sceneAgent" );
81
85
82
86
Workflow workflow =
83
87
AgentWorkflowBuilder .workflow ("storyFlow" )
@@ -112,12 +116,15 @@ public void testSequence() throws ExecutionException, InterruptedException {
112
116
113
117
when (storySeedAgent .invoke (eq ("A Great Story" ))).thenReturn ("storySeedAgent" );
114
118
when (storySeedAgent .outputName ()).thenReturn ("premise" );
119
+ when (storySeedAgent .name ()).thenReturn ("storySeedAgent" );
115
120
116
121
when (plotAgent .invoke (eq ("storySeedAgent" ))).thenReturn ("plotAgent" );
117
122
when (plotAgent .outputName ()).thenReturn ("plot" );
123
+ when (plotAgent .name ()).thenReturn ("plotAgent" );
118
124
119
125
when (sceneAgent .invoke (eq ("plotAgent" ))).thenReturn ("sceneAgent" );
120
126
when (sceneAgent .outputName ()).thenReturn ("story" );
127
+ when (sceneAgent .name ()).thenReturn ("sceneAgent" );
121
128
122
129
Workflow workflow =
123
130
AgentWorkflowBuilder .workflow ("storyFlow" )
@@ -149,12 +156,15 @@ public void testParallel() throws ExecutionException, InterruptedException {
149
156
150
157
when (setting .invoke (eq ("sci-fi" ))).thenReturn ("Fake conflict response" );
151
158
when (setting .outputName ()).thenReturn ("setting" );
159
+ when (setting .name ()).thenReturn ("setting" );
152
160
153
161
when (hero .invoke (eq ("sci-fi" ))).thenReturn ("Fake hero response" );
154
162
when (hero .outputName ()).thenReturn ("hero" );
163
+ when (hero .name ()).thenReturn ("hero" );
155
164
156
165
when (conflict .invoke (eq ("sci-fi" ))).thenReturn ("Fake setting response" );
157
166
when (conflict .outputName ()).thenReturn ("conflict" );
167
+ when (conflict .name ()).thenReturn ("conflict" );
158
168
159
169
Workflow workflow =
160
170
AgentWorkflowBuilder .workflow ("parallelFlow" )
@@ -193,12 +203,15 @@ public void testSeqAndThenParallel() throws ExecutionException, InterruptedExcep
193
203
194
204
when (factAgent .invoke (eq ("alien" ))).thenReturn ("Some Fact about aliens" );
195
205
when (factAgent .outputName ()).thenReturn ("fact" );
206
+ when (factAgent .name ()).thenReturn ("fact" );
196
207
197
208
when (cultureAgent .invoke (eq ("Some Fact about aliens" ))).thenReturn (cultureTraits );
198
209
when (cultureAgent .outputName ()).thenReturn ("culture" );
210
+ when (cultureAgent .name ()).thenReturn ("culture" );
199
211
200
212
when (technologyAgent .invoke (eq ("Some Fact about aliens" ))).thenReturn (technologyTraits );
201
213
when (technologyAgent .outputName ()).thenReturn ("technology" );
214
+ when (technologyAgent .name ()).thenReturn ("technology" );
202
215
Workflow workflow =
203
216
AgentWorkflowBuilder .workflow ("alienCultureFlow" )
204
217
.tasks (
@@ -237,11 +250,13 @@ public void humanInTheLoop() throws ExecutionException, InterruptedException {
237
250
eq ("Discuss project updates" )))
238
251
.thenReturn ("Drafted meeting invitation for John Doe" );
239
252
when (meetingInvitationDraft .outputName ()).thenReturn ("draft" );
253
+ when (meetingInvitationDraft .name ()).thenReturn ("draft" );
240
254
241
255
final MeetingInvitationStyle meetingInvitationStyle = mock (MeetingInvitationStyle .class );
242
256
when (meetingInvitationStyle .invoke (eq ("Drafted meeting invitation for John Doe" ), eq ("formal" )))
243
257
.thenReturn ("Styled meeting invitation for John Doe" );
244
258
when (meetingInvitationStyle .outputName ()).thenReturn ("styled" );
259
+ when (meetingInvitationStyle .name ()).thenReturn ("styled" );
245
260
246
261
AtomicReference <String > request = new AtomicReference <>();
247
262
0 commit comments