Skip to content

Commit 699a075

Browse files
LaSylvmarkpollack
authored andcommitted
Update prompt.adoc
Remove `this.` in code example as it's local variables and not fields
1 parent c7fd7c7 commit 699a075

File tree

1 file changed

+6
-6
lines changed
  • spring-ai-docs/src/main/antora/modules/ROOT/pages/api

1 file changed

+6
-6
lines changed

spring-ai-docs/src/main/antora/modules/ROOT/pages/api/prompt.adoc

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ A simple example taken from the https://github.com/Azure-Samples/spring-ai-azure
202202

203203
PromptTemplate promptTemplate = new PromptTemplate("Tell me a {adjective} joke about {topic}");
204204

205-
Prompt prompt = this.promptTemplate.create(Map.of("adjective", adjective, "topic", topic));
205+
Prompt prompt = promptTemplate.create(Map.of("adjective", adjective, "topic", topic));
206206

207207
return chatModel.call(prompt).getResult();
208208
```
@@ -215,20 +215,20 @@ String userText = """
215215
Write at least a sentence for each pirate.
216216
""";
217217

218-
Message userMessage = new UserMessage(this.userText);
218+
Message userMessage = new UserMessage(userText);
219219

220220
String systemText = """
221221
You are a helpful AI assistant that helps people find information.
222222
Your name is {name}
223223
You should reply to the user's request with your name and also in the style of a {voice}.
224224
""";
225225

226-
SystemPromptTemplate systemPromptTemplate = new SystemPromptTemplate(this.systemText);
227-
Message systemMessage = this.systemPromptTemplate.createMessage(Map.of("name", name, "voice", voice));
226+
SystemPromptTemplate systemPromptTemplate = new SystemPromptTemplate(systemText);
227+
Message systemMessage = systemPromptTemplate.createMessage(Map.of("name", name, "voice", voice));
228228

229-
Prompt prompt = new Prompt(List.of(this.userMessage, this.systemMessage));
229+
Prompt prompt = new Prompt(List.of(userMessage, systemMessage));
230230

231-
List<Generation> response = chatModel.call(this.prompt).getResults();
231+
List<Generation> response = chatModel.call(prompt).getResults();
232232

233233
```
234234

0 commit comments

Comments
 (0)