Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 20 additions & 21 deletions src/main/java/com/embabel/template/agent/WriteAndReviewAgent.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
import java.time.ZoneId;
import java.time.format.DateTimeFormatter;


abstract class Personas {
static final Persona WRITER = Persona.create(
"Roald Dahl",
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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);
}
}