From c341f3e433b5a972264751832dadcd65dfd29906 Mon Sep 17 00:00:00 2001 From: Russ Miles Date: Fri, 27 Jun 2025 10:08:21 +0100 Subject: [PATCH] Adjusted location of goals in example agent file Closes #14 --- .../template/agent/WriteAndReviewAgent.java | 41 +++++++++---------- 1 file changed, 20 insertions(+), 21 deletions(-) diff --git a/src/main/java/com/embabel/template/agent/WriteAndReviewAgent.java b/src/main/java/com/embabel/template/agent/WriteAndReviewAgent.java index 943857a..f57c6b3 100644 --- a/src/main/java/com/embabel/template/agent/WriteAndReviewAgent.java +++ b/src/main/java/com/embabel/template/agent/WriteAndReviewAgent.java @@ -35,7 +35,6 @@ import java.time.ZoneId; import java.time.format.DateTimeFormatter; - abstract class Personas { static final Persona WRITER = Persona.create( "Roald Dahl", @@ -106,26 +105,6 @@ class WriteAndReviewAgent { this.reviewWordCount = reviewWordCount; } - @Action - Story craftStory(UserInput userInput) { - return PromptRunner.usingLlm( - LlmOptions.fromCriteria(AutoModelSelectionCriteria.INSTANCE) - .withTemperature(0.9) // Higher temperature for more creative output - ).withPromptContributor(Personas.WRITER) - .createObject(String.format(""" - Craft a short story in %d words or less. - The story should be engaging and imaginative. - Use the user's input as inspiration if possible. - If the user has provided a name, include it in the story. - - # User input - %s - """, - storyWordCount, - userInput.getContent() - ).trim(), Story.class); - } - @AchievesGoal(description="The story has been crafted and reviewed by a book reviewer") @Action ReviewedStory reviewStory(UserInput userInput, Story story, OperationContext context) { @@ -155,4 +134,24 @@ ReviewedStory reviewStory(UserInput userInput, Story story, OperationContext con Personas.REVIEWER ); } + + @Action + Story craftStory(UserInput userInput) { + return PromptRunner.usingLlm( + LlmOptions.fromCriteria(AutoModelSelectionCriteria.INSTANCE) + .withTemperature(0.9) // Higher temperature for more creative output + ).withPromptContributor(Personas.WRITER) + .createObject(String.format(""" + Craft a short story in %d words or less. + The story should be engaging and imaginative. + Use the user's input as inspiration if possible. + If the user has provided a name, include it in the story. + + # User input + %s + """, + storyWordCount, + userInput.getContent() + ).trim(), Story.class); + } } \ No newline at end of file