Skip to content

Commit e6303aa

Browse files
committed
Switch to Ai vs OperationContext
1 parent c71630a commit e6303aa

1 file changed

Lines changed: 5 additions & 6 deletions

File tree

src/main/java/com/embabel/template/agent/WriteAndReviewAgent.java

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
import com.embabel.agent.api.annotation.Action;
2020
import com.embabel.agent.api.annotation.Agent;
2121
import com.embabel.agent.api.annotation.Export;
22-
import com.embabel.agent.api.common.OperationContext;
22+
import com.embabel.agent.api.common.Ai;
2323
import com.embabel.agent.domain.io.UserInput;
2424
import com.embabel.agent.domain.library.HasContent;
2525
import com.embabel.agent.prompt.persona.Persona;
@@ -105,9 +105,8 @@ public String getContent() {
105105
description = "The story has been crafted and reviewed by a book reviewer",
106106
export = @Export(remote = true, name = "writeAndReviewStory"))
107107
@Action
108-
ReviewedStory reviewStory(UserInput userInput, Story story, OperationContext context) {
109-
var review = context
110-
.ai()
108+
ReviewedStory reviewStory(UserInput userInput, Story story, Ai ai) {
109+
var review = ai
111110
.withAutoLlm()
112111
.withPromptContributor(Personas.REVIEWER)
113112
.generateText(String.format("""
@@ -135,8 +134,8 @@ ReviewedStory reviewStory(UserInput userInput, Story story, OperationContext con
135134
}
136135

137136
@Action
138-
Story craftStory(UserInput userInput, OperationContext context) {
139-
return context.ai()
137+
Story craftStory(UserInput userInput, Ai ai) {
138+
return ai
140139
// Higher temperature for more creative output
141140
.withLlm(LlmOptions
142141
.withAutoLlm() // You can also choose a specific model or role here

0 commit comments

Comments
 (0)