This is an automated email from the ASF dual-hosted git repository. aldettinger pushed a commit to branch data-extraction-example in repository https://gitbox.apache.org/repos/asf/camel-quarkus-examples.git
commit 19551829a68fb12333bd05bc279506ed22e6b9ce Author: aldettinger <[email protected]> AuthorDate: Fri Aug 16 15:26:13 2024 +0200 Remove useless @V annotation from extraction service method signature --- data-extract-langchain4j/pom.xml | 2 ++ .../org/acme/extraction/CustomPojoExtractionService.java | 16 +++++++++++----- .../src/test/java/org/acme/extraction/RouteTest.java | 5 ++--- 3 files changed, 15 insertions(+), 8 deletions(-) diff --git a/data-extract-langchain4j/pom.xml b/data-extract-langchain4j/pom.xml index 1e7fa75..ce159e3 100644 --- a/data-extract-langchain4j/pom.xml +++ b/data-extract-langchain4j/pom.xml @@ -168,6 +168,8 @@ <showDeprecation>true</showDeprecation> <showWarnings>true</showWarnings> <compilerArgs> + <!-- Specifying -parameters is optional, see CustomPojoExtractionService.extractFromText javadoc --> + <arg>-parameters</arg> <arg>-Xlint:unchecked</arg> </compilerArgs> </configuration> diff --git a/data-extract-langchain4j/src/main/java/org/acme/extraction/CustomPojoExtractionService.java b/data-extract-langchain4j/src/main/java/org/acme/extraction/CustomPojoExtractionService.java index a1eff0b..541242e 100644 --- a/data-extract-langchain4j/src/main/java/org/acme/extraction/CustomPojoExtractionService.java +++ b/data-extract-langchain4j/src/main/java/org/acme/extraction/CustomPojoExtractionService.java @@ -3,7 +3,6 @@ package org.acme.extraction; import java.time.LocalDate; import dev.langchain4j.service.UserMessage; -import dev.langchain4j.service.V; import io.quarkiverse.langchain4j.RegisterAiService; import io.quarkus.runtime.annotations.RegisterForReflection; import jakarta.enterprise.context.ApplicationScoped; @@ -25,10 +24,17 @@ public interface CustomPojoExtractionService { + "The customerBirthday field should be formatted as YYYY-MM-DD." + "The summary field should concisely relate the customer main ask."; + /** + * See how the java method parameter named text is automatically injected as {text} in the + * CUSTOM_POJO_EXTRACT_PROMPT. + * + * This is made possible as the code is compiled with -parameters argument in the maven-compiler-plugin related + * section of the pom.xml file. + * + * Without -parameters, one would need to use the @V annotation like in the method signature proposed below: + * extractFromText(@dev.langchain4j.service.V("text") String text); + */ @UserMessage(CUSTOM_POJO_EXTRACT_PROMPT) @Handler - // TODO: It should be possible to remove @V as this is working in data-experiments-camel-quarkus - // The issue is still there with q-platform 3.12.0/3, 3.13.0.CR1 and maven.compiler.target/source = 21 - CustomPojo extractFromText(@V("text") String text); - //CustomPojo extractFromText(String text); + CustomPojo extractFromText(String text); } diff --git a/data-extract-langchain4j/src/test/java/org/acme/extraction/RouteTest.java b/data-extract-langchain4j/src/test/java/org/acme/extraction/RouteTest.java index 117f10c..de8965a 100644 --- a/data-extract-langchain4j/src/test/java/org/acme/extraction/RouteTest.java +++ b/data-extract-langchain4j/src/test/java/org/acme/extraction/RouteTest.java @@ -18,11 +18,10 @@ import static org.hamcrest.Matchers.is; import static org.hamcrest.Matchers.not; /** - * TODO: The routeSchema is not up to date - * TODO: Add kubernetes and openshift deployment * TODO: Consume from an unstructured data store + * TODO: Add kubernetes and openshift deployment * TODO: Correct all TODOs in the example - * TODO: Write example instructions + * TODO: Write example instructions (with a section to update the wiremock mappings) */ @WithTestResource(OllamaTestResource.class) @QuarkusTest
