File tree Expand file tree Collapse file tree 2 files changed +6
-7
lines changed
examples-java/src/main/java/com/embabel/example/repeatuntil Expand file tree Collapse file tree 2 files changed +6
-7
lines changed Original file line number Diff line number Diff line change 1717
1818import com .embabel .agent .api .common .workflow .loop .RepeatUntilAcceptableBuilder ;
1919import com .embabel .agent .api .common .workflow .loop .TextFeedback ;
20-
2120import com .embabel .agent .api .models .OpenAiModels ;
2221import com .embabel .agent .core .Agent ;
2322import org .springframework .context .annotation .Bean ;
@@ -38,8 +37,8 @@ public Agent goatWriter() {
3837 .returning (Goat .class )
3938 .withMaxIterations (3 )
4039 .repeating (context -> {
41- var lastFeedback = context .getInput (). lastFeedback ();
42- var feedback = lastFeedback != null ? "Feedback: " + lastFeedback .getFeedback () : "" ;
40+ var lastAttempt = context .lastAttempt ();
41+ var feedback = lastAttempt != null ? "Feedback: " + lastAttempt .getFeedback () : "" ;
4342 return context .ai ()
4443 .withLlm (OpenAiModels .GPT_5_NANO )
4544 .createObject (
@@ -59,7 +58,7 @@ public Agent goatWriter() {
5958 %s
6059
6160 Provide feedback of no more than 40 words on a scale from 0 to 1, where 1 is excellent and 0 is poor.
62- """ .formatted (context .getInput (). resultToEvaluate ()),
61+ """ .formatted (context .getResultToEvaluate ()),
6362 TextFeedback .class ))
6463 .buildAgent ("GoatWriter" ,
6564 "Write a description of a goat" );
Original file line number Diff line number Diff line change @@ -48,8 +48,8 @@ Story rewriteUntilSatisfied(
4848 .withMaxIterations (7 )
4949 .withScoreThreshold (.8 )
5050 .repeating (context -> {
51- var lastFeedback = context .getInput (). lastFeedback ();
52- var feedback = lastFeedback != null ? "Consider the following feedback: " + lastFeedback .getFeedback () : "" ;
51+ var lastAttempt = context .lastAttempt ();
52+ var feedback = lastAttempt != null ? "Consider the following feedback: " + lastAttempt .getFeedback () : "" ;
5353 return writerPromptRunner .createObject (
5454 """
5555 Write a creative story inspired by the user input: %s
@@ -68,7 +68,7 @@ Story rewriteUntilSatisfied(
6868
6969 User input: %s
7070 """ .formatted (
71- context .getInput (). resultToEvaluate (),
71+ context .getResultToEvaluate (),
7272 userInput .getContent ()),
7373 TextFeedback .class )
7474 )
You can’t perform that action at this time.
0 commit comments