From 699a075e1c9925ba2f1f9073e686d79b65ce2dc7 Mon Sep 17 00:00:00 2001 From: Sylvain Blanc Date: Sat, 14 Dec 2024 18:44:31 +0100 Subject: [PATCH] Update prompt.adoc Remove `this.` in code example as it's local variables and not fields --- .../main/antora/modules/ROOT/pages/api/prompt.adoc | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/spring-ai-docs/src/main/antora/modules/ROOT/pages/api/prompt.adoc b/spring-ai-docs/src/main/antora/modules/ROOT/pages/api/prompt.adoc index 41d9ac67c..e82f98247 100644 --- a/spring-ai-docs/src/main/antora/modules/ROOT/pages/api/prompt.adoc +++ b/spring-ai-docs/src/main/antora/modules/ROOT/pages/api/prompt.adoc @@ -202,7 +202,7 @@ A simple example taken from the https://github.com/Azure-Samples/spring-ai-azure PromptTemplate promptTemplate = new PromptTemplate("Tell me a {adjective} joke about {topic}"); -Prompt prompt = this.promptTemplate.create(Map.of("adjective", adjective, "topic", topic)); +Prompt prompt = promptTemplate.create(Map.of("adjective", adjective, "topic", topic)); return chatModel.call(prompt).getResult(); ``` @@ -215,7 +215,7 @@ String userText = """ Write at least a sentence for each pirate. """; -Message userMessage = new UserMessage(this.userText); +Message userMessage = new UserMessage(userText); String systemText = """ You are a helpful AI assistant that helps people find information. @@ -223,12 +223,12 @@ String systemText = """ You should reply to the user's request with your name and also in the style of a {voice}. """; -SystemPromptTemplate systemPromptTemplate = new SystemPromptTemplate(this.systemText); -Message systemMessage = this.systemPromptTemplate.createMessage(Map.of("name", name, "voice", voice)); +SystemPromptTemplate systemPromptTemplate = new SystemPromptTemplate(systemText); +Message systemMessage = systemPromptTemplate.createMessage(Map.of("name", name, "voice", voice)); -Prompt prompt = new Prompt(List.of(this.userMessage, this.systemMessage)); +Prompt prompt = new Prompt(List.of(userMessage, systemMessage)); -List response = chatModel.call(this.prompt).getResults(); +List response = chatModel.call(prompt).getResults(); ```