This is an automated email from the ASF dual-hosted git repository.
jamesnetherton pushed a commit to branch camel-quarkus-main
in repository https://gitbox.apache.org/repos/asf/camel-quarkus-examples.git
The following commit(s) were added to refs/heads/camel-quarkus-main by this
push:
new ec891bf8 Fixes apache/camel-quarkus#8880. Fixed Agent API.
ec891bf8 is described below
commit ec891bf8d2572d29a3aac435acdc88ff4deac4ac
Author: Jiří Ondrušek <[email protected]>
AuthorDate: Tue Aug 11 20:12:06 2026 +0200
Fixes apache/camel-quarkus#8880. Fixed Agent API.
* Fixes apache/camel-quarkus#8880. Adapt DataExtractAgent to Agent.chat()
returning Result<String>
Co-Authored-By: Claude Opus 4.6 <[email protected]>
* Bump LangChain4j to 1.17.2
---------
Co-authored-by: Claude Opus 4.6 <[email protected]>
Co-authored-by: James Netherton <[email protected]>
---
data-extract-langchain4j/pom.xml | 2 +-
.../src/main/java/org/acme/extraction/DataExtractAgent.java | 5 +++--
2 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/data-extract-langchain4j/pom.xml b/data-extract-langchain4j/pom.xml
index eee99d90..a647a36a 100644
--- a/data-extract-langchain4j/pom.xml
+++ b/data-extract-langchain4j/pom.xml
@@ -52,7 +52,7 @@
<maven-resources-plugin.version>3.3.1</maven-resources-plugin.version>
<maven-surefire-plugin.version>3.5.6</maven-surefire-plugin.version>
- <langchain4j.version>1.12.2</langchain4j.version>
+ <langchain4j.version>1.17.2</langchain4j.version>
<wiremock.version>3.13.2</wiremock.version>
</properties>
diff --git
a/data-extract-langchain4j/src/main/java/org/acme/extraction/DataExtractAgent.java
b/data-extract-langchain4j/src/main/java/org/acme/extraction/DataExtractAgent.java
index 8e545dc3..652276e0 100644
---
a/data-extract-langchain4j/src/main/java/org/acme/extraction/DataExtractAgent.java
+++
b/data-extract-langchain4j/src/main/java/org/acme/extraction/DataExtractAgent.java
@@ -17,6 +17,7 @@
package org.acme.extraction;
import dev.langchain4j.service.AiServices;
+import dev.langchain4j.service.Result;
import dev.langchain4j.service.tool.ToolProvider;
import org.acme.extraction.CustomPojoExtractionService.CustomPojo;
import org.apache.camel.component.langchain4j.agent.api.Agent;
@@ -41,14 +42,14 @@ public class DataExtractAgent implements Agent {
* Returns a string representation of the extracted {@link CustomPojo}.
*/
@Override
- public String chat(AiAgentBody<?> aiAgentBody, ToolProvider toolProvider) {
+ public Result<String> chat(AiAgentBody<?> aiAgentBody, ToolProvider
toolProvider) {
CustomPojo response =
createService(toolProvider).extractFromText(aiAgentBody.getUserMessage());
// Store extracted CustomPojoExtractionService.CustomPojos objects
into the CustomPojoStore for later inspection
pojoStore.addPojo(response);
// Return a string representation of the result POJO
- return response.toString();
+ return Result.<String> builder().content(response.toString()).build();
}
CustomPojoExtractionService createService(ToolProvider toolProvider) {