3535import java .time .ZoneId ;
3636import java .time .format .DateTimeFormatter ;
3737
38-
3938abstract class Personas {
4039 static final Persona WRITER = Persona .create (
4140 "Roald Dahl" ,
@@ -106,26 +105,6 @@ class WriteAndReviewAgent {
106105 this .reviewWordCount = reviewWordCount ;
107106 }
108107
109- @ Action
110- Story craftStory (UserInput userInput ) {
111- return PromptRunner .usingLlm (
112- LlmOptions .fromCriteria (AutoModelSelectionCriteria .INSTANCE )
113- .withTemperature (0.9 ) // Higher temperature for more creative output
114- ).withPromptContributor (Personas .WRITER )
115- .createObject (String .format ("""
116- Craft a short story in %d words or less.
117- The story should be engaging and imaginative.
118- Use the user's input as inspiration if possible.
119- If the user has provided a name, include it in the story.
120-
121- # User input
122- %s
123- """ ,
124- storyWordCount ,
125- userInput .getContent ()
126- ).trim (), Story .class );
127- }
128-
129108 @ AchievesGoal (description ="The story has been crafted and reviewed by a book reviewer" )
130109 @ Action
131110 ReviewedStory reviewStory (UserInput userInput , Story story , OperationContext context ) {
@@ -155,4 +134,24 @@ ReviewedStory reviewStory(UserInput userInput, Story story, OperationContext con
155134 Personas .REVIEWER
156135 );
157136 }
137+
138+ @ Action
139+ Story craftStory (UserInput userInput ) {
140+ return PromptRunner .usingLlm (
141+ LlmOptions .fromCriteria (AutoModelSelectionCriteria .INSTANCE )
142+ .withTemperature (0.9 ) // Higher temperature for more creative output
143+ ).withPromptContributor (Personas .WRITER )
144+ .createObject (String .format ("""
145+ Craft a short story in %d words or less.
146+ The story should be engaging and imaginative.
147+ Use the user's input as inspiration if possible.
148+ If the user has provided a name, include it in the story.
149+
150+ # User input
151+ %s
152+ """ ,
153+ storyWordCount ,
154+ userInput .getContent ()
155+ ).trim (), Story .class );
156+ }
158157}
0 commit comments