From c4659fa3f34f138b9d0a6d0b12772f5bc4979f95 Mon Sep 17 00:00:00 2001 From: jitokim Date: Tue, 29 Oct 2024 23:17:08 +0900 Subject: [PATCH] Fix example codes in docs chatclient.adoc - Replaced javaCopySimpleLoggerAdvisor with SimpleLoggerAdvisor - Fixed typo in the multiline String for ChatClient example etl-pipeline.adoc - Fixed indent in the ParagraphPdfDocumentReader example imageclient.adoc - Fixed indent of override annotation in the ImageGeneration example testing.adoc - Added a semicolon to the Evaluator interface Signed-off-by: jitokim --- .../src/main/antora/modules/ROOT/pages/api/chatclient.adoc | 4 ++-- .../src/main/antora/modules/ROOT/pages/api/etl-pipeline.adoc | 5 +++-- .../src/main/antora/modules/ROOT/pages/api/imageclient.adoc | 2 +- .../src/main/antora/modules/ROOT/pages/api/testing.adoc | 2 +- 4 files changed, 7 insertions(+), 6 deletions(-) diff --git a/spring-ai-docs/src/main/antora/modules/ROOT/pages/api/chatclient.adoc b/spring-ai-docs/src/main/antora/modules/ROOT/pages/api/chatclient.adoc index 2ba0f6f62e8..c89f428ef6b 100644 --- a/spring-ai-docs/src/main/antora/modules/ROOT/pages/api/chatclient.adoc +++ b/spring-ai-docs/src/main/antora/modules/ROOT/pages/api/chatclient.adoc @@ -450,7 +450,7 @@ public class CustomerSupportAssistant { this.chatClient = builder .defaultSystem(""" - You are a customer chat support agent of an airline named "Funnair".", Respond in a friendly, + You are a customer chat support agent of an airline named "Funnair". Respond in a friendly, helpful, and joyful manner. Before providing information about a booking or cancelling a booking, you MUST always @@ -524,7 +524,7 @@ Example usage: [source,java] ---- -javaCopySimpleLoggerAdvisor customLogger = new SimpleLoggerAdvisor( +SimpleLoggerAdvisor customLogger = new SimpleLoggerAdvisor( request -> "Custom request: " + request.userText, response -> "Custom response: " + response.getResult() ); diff --git a/spring-ai-docs/src/main/antora/modules/ROOT/pages/api/etl-pipeline.adoc b/spring-ai-docs/src/main/antora/modules/ROOT/pages/api/etl-pipeline.adoc index 06c5808d7e6..63f053c5876 100644 --- a/spring-ai-docs/src/main/antora/modules/ROOT/pages/api/etl-pipeline.adoc +++ b/spring-ai-docs/src/main/antora/modules/ROOT/pages/api/etl-pipeline.adoc @@ -235,6 +235,7 @@ class MyTextReader { MyTextReader(@Value("classpath:text-source.txt") Resource resource) { this.resource = resource; } + List loadText() { TextReader textReader = new TextReader(this.resource); textReader.getCustomMetadata().put("filename", "text-source.txt"); @@ -447,7 +448,7 @@ dependencies { @Component public class MyPagePdfDocumentReader { - List getDocsFromPdfwithCatalog() { + List getDocsFromPdfWithCatalog() { ParagraphPdfDocumentReader pdfReader = new ParagraphPdfDocumentReader("classpath:/sample1.pdf", PdfDocumentReaderConfig.builder() @@ -458,7 +459,7 @@ public class MyPagePdfDocumentReader { .withPagesPerDocument(1) .build()); - return pdfReader.read(); + return pdfReader.read(); } } ---- diff --git a/spring-ai-docs/src/main/antora/modules/ROOT/pages/api/imageclient.adoc b/spring-ai-docs/src/main/antora/modules/ROOT/pages/api/imageclient.adoc index 6ad615946e8..100648708d4 100644 --- a/spring-ai-docs/src/main/antora/modules/ROOT/pages/api/imageclient.adoc +++ b/spring-ai-docs/src/main/antora/modules/ROOT/pages/api/imageclient.adoc @@ -144,7 +144,7 @@ public class ImageGeneration implements ModelResult { private Image image; - @Override + @Override public Image getOutput() {...} @Override diff --git a/spring-ai-docs/src/main/antora/modules/ROOT/pages/api/testing.adoc b/spring-ai-docs/src/main/antora/modules/ROOT/pages/api/testing.adoc index 5c1087ebfb6..9fb9be50b32 100644 --- a/spring-ai-docs/src/main/antora/modules/ROOT/pages/api/testing.adoc +++ b/spring-ai-docs/src/main/antora/modules/ROOT/pages/api/testing.adoc @@ -12,7 +12,7 @@ The Spring AI interface for evaluating responses is `Evaluator`, defined as: ---- @FunctionalInterface public interface Evaluator { - EvaluationResponse evaluate(EvaluationRequest evaluationRequest) + EvaluationResponse evaluate(EvaluationRequest evaluationRequest); } ----