Skip to content

Commit fce3b4e

Browse files
committed
fixing checkstyle and deps
Signed-off-by: salaboy <Salaboy@gmail.com>
1 parent ca44394 commit fce3b4e

File tree

67 files changed

+4063
-2825
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

67 files changed

+4063
-2825
lines changed

pom.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,9 @@
3838
<maven-site-plugin.version>3.12.1</maven-site-plugin.version>
3939
<maven-project-info-reports-plugin.version>3.7.0</maven-project-info-reports-plugin.version>
4040
<maven-jar-plugin.version>3.4.2</maven-jar-plugin.version>
41-
<maven.compiler.source>11</maven.compiler.source>
42-
<maven.compiler.target>11</maven.compiler.target>
43-
<maven.compiler.release>11</maven.compiler.release>
41+
<maven.compiler.source>17</maven.compiler.source>
42+
<maven.compiler.target>17</maven.compiler.target>
43+
<maven.compiler.release>17</maven.compiler.release>
4444
<maven.deploy.skip>true</maven.deploy.skip>
4545
<jackson.version>2.16.2</jackson.version>
4646
<gpg.skip>true</gpg.skip>

quarkus/deployment/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
<artifactId>gizmo</artifactId>
3434
</dependency>
3535
<dependency>
36-
<groupId>io.quarkiverse.dapr</groupId>
36+
<groupId>io.dapr.quarkus</groupId>
3737
<artifactId>quarkus-agentic-dapr</artifactId>
3838
<version>${project.version}</version>
3939
</dependency>

quarkus/deployment/src/main/java/io/quarkiverse/dapr/langchain4j/deployment/DaprAgenticProcessor.java

Lines changed: 565 additions & 510 deletions
Large diffs are not rendered by default.

quarkus/examples/pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,13 @@
1616
<dependencies>
1717
<!-- Our Dapr Agentic extension (brings quarkus-dapr + quarkus-langchain4j-agentic transitively) -->
1818
<dependency>
19-
<groupId>io.quarkiverse.dapr</groupId>
19+
<groupId>io.dapr.quarkus</groupId>
2020
<artifactId>quarkus-agentic-dapr</artifactId>
2121
<version>${project.version}</version>
2222
</dependency>
2323

2424
<dependency>
25-
<groupId>io.quarkiverse.dapr</groupId>
25+
<groupId>io.dapr.quarkus</groupId>
2626
<artifactId>quarkus-agentic-dapr-agents-registry</artifactId>
2727
<version>${project.version}</version>
2828
</dependency>
Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,16 @@
1+
/*
2+
* Copyright 2025 The Dapr Authors
3+
* Licensed under the Apache License, Version 2.0 (the "License");
4+
* you may not use this file except in compliance with the License.
5+
* You may obtain a copy of the License at
6+
* http://www.apache.org/licenses/LICENSE-2.0
7+
* Unless required by applicable law or agreed to in writing, software
8+
* distributed under the License is distributed on an "AS IS" BASIS,
9+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10+
* See the License for the specific language governing permissions and
11+
limitations under the License.
12+
*/
13+
114
package io.quarkiverse.dapr.examples;
215

316
import dev.langchain4j.agentic.Agent;
@@ -10,12 +23,13 @@
1023
*/
1124
public interface CreativeWriter {
1225

13-
@UserMessage("""
14-
You are a creative writer.
15-
Generate a draft of a story no more than 3 sentences around the given topic.
16-
Return only the story and nothing else.
17-
The topic is {{topic}}.
18-
""")
19-
@Agent(name = "creative-writer-agent", description = "Generate a story based on the given topic", outputKey = "story")
20-
String generateStory(@V("topic") String topic);
26+
@UserMessage("""
27+
You are a creative writer.
28+
Generate a draft of a story no more than 3 sentences around the given topic.
29+
Return only the story and nothing else.
30+
The topic is {{topic}}.
31+
""")
32+
@Agent(name = "creative-writer-agent",
33+
description = "Generate a story based on the given topic", outputKey = "story")
34+
String generateStory(@V("topic") String topic);
2135
}
Lines changed: 33 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,16 @@
1+
/*
2+
* Copyright 2025 The Dapr Authors
3+
* Licensed under the Apache License, Version 2.0 (the "License");
4+
* you may not use this file except in compliance with the License.
5+
* You may obtain a copy of the License at
6+
* http://www.apache.org/licenses/LICENSE-2.0
7+
* Unless required by applicable law or agreed to in writing, software
8+
* distributed under the License is distributed on an "AS IS" BASIS,
9+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10+
* See the License for the specific language governing permissions and
11+
limitations under the License.
12+
*/
13+
114
package io.quarkiverse.dapr.examples;
215

316
import dev.langchain4j.agentic.declarative.Output;
@@ -7,24 +20,31 @@
720
/**
821
* Composite agent that orchestrates {@link StoryCreator} and {@link ResearchWriter}
922
* in parallel, backed by a Dapr Workflow.
10-
* <p>
11-
* Both sub-agents execute concurrently via a {@code ParallelOrchestrationWorkflow}.
23+
*
24+
* <p>Both sub-agents execute concurrently via a {@code ParallelOrchestrationWorkflow}.
1225
* {@link StoryCreator} is itself a {@code @SequenceAgent} that chains
1326
* {@link CreativeWriter} and {@link StyleEditor} — demonstrating nested composite agents.
1427
* Meanwhile {@link ResearchWriter} gathers facts about the country.
1528
*/
1629
public interface ParallelCreator {
1730

18-
@ParallelAgent(name = "parallel-creator-agent",
19-
outputKey = "storyAndCountryResearch",
20-
subAgents = { StoryCreator.class, ResearchWriter.class })
21-
ParallelStatus create(@V("topic") String topic, @V("country") String country, @V("style") String style);
31+
@ParallelAgent(name = "parallel-creator-agent",
32+
outputKey = "storyAndCountryResearch",
33+
subAgents = { StoryCreator.class, ResearchWriter.class })
34+
ParallelStatus create(@V("topic") String topic, @V("country") String country, @V("style") String style);
2235

23-
@Output
24-
static ParallelStatus output(String story, String summary) {
25-
if(story == null || summary == null){
26-
return new ParallelStatus("ERROR", story, summary);
27-
}
28-
return new ParallelStatus("OK", story, summary);
36+
/**
37+
* Produces the final output from the parallel agent results.
38+
*
39+
* @param story the generated story
40+
* @param summary the generated summary
41+
* @return the combined parallel status
42+
*/
43+
@Output
44+
static ParallelStatus output(String story, String summary) {
45+
if (story == null || summary == null) {
46+
return new ParallelStatus("ERROR", story, summary);
2947
}
30-
}
48+
return new ParallelStatus("OK", story, summary);
49+
}
50+
}
Lines changed: 28 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,16 @@
1+
/*
2+
* Copyright 2025 The Dapr Authors
3+
* Licensed under the Apache License, Version 2.0 (the "License");
4+
* you may not use this file except in compliance with the License.
5+
* You may obtain a copy of the License at
6+
* http://www.apache.org/licenses/LICENSE-2.0
7+
* Unless required by applicable law or agreed to in writing, software
8+
* distributed under the License is distributed on an "AS IS" BASIS,
9+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10+
* See the License for the specific language governing permissions and
11+
limitations under the License.
12+
*/
13+
114
package io.quarkiverse.dapr.examples;
215

316
import jakarta.inject.Inject;
@@ -10,27 +23,27 @@
1023

1124
/**
1225
* REST endpoint that triggers the parallel creation workflow.
13-
* <p>
14-
* Runs {@link StoryCreator} (a nested {@code @SequenceAgent}) and {@link ResearchWriter}
26+
*
27+
* <p>Runs {@link StoryCreator} (a nested {@code @SequenceAgent}) and {@link ResearchWriter}
1528
* in parallel via a {@code ParallelOrchestrationWorkflow} Dapr Workflow.
16-
* <p>
17-
* Example usage:
29+
*
30+
* <p>Example usage:
1831
* <pre>
1932
* curl "http://localhost:8080/parallel?topic=dragons&amp;country=France&amp;style=comedy"
2033
* </pre>
2134
*/
2235
@Path("/parallel")
2336
public class ParallelResource {
2437

25-
@Inject
26-
ParallelCreator parallelCreator;
38+
@Inject
39+
ParallelCreator parallelCreator;
2740

28-
@GET
29-
@Produces(MediaType.APPLICATION_JSON)
30-
public ParallelStatus create(
31-
@QueryParam("topic") @DefaultValue("dragons and wizards") String topic,
32-
@QueryParam("country") @DefaultValue("France") String country,
33-
@QueryParam("style") @DefaultValue("fantasy") String style) {
34-
return parallelCreator.create(topic, country, style);
35-
}
36-
}
41+
@GET
42+
@Produces(MediaType.APPLICATION_JSON)
43+
public ParallelStatus create(
44+
@QueryParam("topic") @DefaultValue("dragons and wizards") String topic,
45+
@QueryParam("country") @DefaultValue("France") String country,
46+
@QueryParam("style") @DefaultValue("fantasy") String style) {
47+
return parallelCreator.create(topic, country, style);
48+
}
49+
}

quarkus/examples/src/main/java/io/quarkiverse/dapr/examples/ParallelStatus.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,16 @@
1+
/*
2+
* Copyright 2025 The Dapr Authors
3+
* Licensed under the Apache License, Version 2.0 (the "License");
4+
* you may not use this file except in compliance with the License.
5+
* You may obtain a copy of the License at
6+
* http://www.apache.org/licenses/LICENSE-2.0
7+
* Unless required by applicable law or agreed to in writing, software
8+
* distributed under the License is distributed on an "AS IS" BASIS,
9+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10+
* See the License for the specific language governing permissions and
11+
limitations under the License.
12+
*/
13+
114
package io.quarkiverse.dapr.examples;
215

316
public record ParallelStatus(String status, String story, String summary) {
Lines changed: 26 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,16 @@
1+
/*
2+
* Copyright 2025 The Dapr Authors
3+
* Licensed under the Apache License, Version 2.0 (the "License");
4+
* you may not use this file except in compliance with the License.
5+
* You may obtain a copy of the License at
6+
* http://www.apache.org/licenses/LICENSE-2.0
7+
* Unless required by applicable law or agreed to in writing, software
8+
* distributed under the License is distributed on an "AS IS" BASIS,
9+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10+
* See the License for the specific language governing permissions and
11+
limitations under the License.
12+
*/
13+
114
package io.quarkiverse.dapr.examples;
215

316
import jakarta.inject.Inject;
@@ -11,17 +24,17 @@
1124
/**
1225
* REST endpoint that triggers a research workflow with tool calls routed through
1326
* Dapr Workflow Activities.
14-
* <p>
15-
* Each request:
27+
*
28+
* <p>Each request:
1629
* <ol>
1730
* <li>Starts a {@code SequentialOrchestrationWorkflow} (orchestration level).</li>
1831
* <li>For the {@link ResearchWriter} sub-agent, starts an {@code AgentRunWorkflow}
1932
* (per-agent level).</li>
2033
* <li>Each LLM tool call ({@code getPopulation} / {@code getCapital}) is executed
2134
* inside a {@code ToolCallActivity} (tool-call level).</li>
2235
* </ol>
23-
* <p>
24-
* Example usage:
36+
*
37+
* <p>Example usage:
2538
* <pre>
2639
* curl "http://localhost:8080/research?country=France"
2740
* curl "http://localhost:8080/research?country=Germany"
@@ -30,13 +43,13 @@
3043
@Path("/research")
3144
public class ResearchResource {
3245

33-
@Inject
34-
ResearchWriter researchWriter;
46+
@Inject
47+
ResearchWriter researchWriter;
3548

36-
@GET
37-
@Produces(MediaType.TEXT_PLAIN)
38-
public String research(
39-
@QueryParam("country") @DefaultValue("France") String country) {
40-
return researchWriter.research(country);
41-
}
42-
}
49+
@GET
50+
@Produces(MediaType.TEXT_PLAIN)
51+
public String research(
52+
@QueryParam("country") @DefaultValue("France") String country) {
53+
return researchWriter.research(country);
54+
}
55+
}
Lines changed: 50 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,30 @@
1+
/*
2+
* Copyright 2025 The Dapr Authors
3+
* Licensed under the Apache License, Version 2.0 (the "License");
4+
* you may not use this file except in compliance with the License.
5+
* You may obtain a copy of the License at
6+
* http://www.apache.org/licenses/LICENSE-2.0
7+
* Unless required by applicable law or agreed to in writing, software
8+
* distributed under the License is distributed on an "AS IS" BASIS,
9+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10+
* See the License for the specific language governing permissions and
11+
limitations under the License.
12+
*/
13+
114
package io.quarkiverse.dapr.examples;
215

316
import dev.langchain4j.agent.tool.Tool;
417
import jakarta.enterprise.context.ApplicationScoped;
518

619
/**
720
* CDI bean providing research tools for the {@link ResearchWriter} agent.
8-
* <p>
9-
* Because the {@code quarkus-agentic-dapr} extension automatically applies
21+
*
22+
* <p>Because the {@code quarkus-agentic-dapr} extension automatically applies
1023
* {@code @DaprAgentToolInterceptorBinding} to all {@code @Tool}-annotated methods at
1124
* build time, every call to these methods that occurs inside a Dapr-backed agent run is
1225
* transparently routed through a {@code ToolCallActivity} Dapr Workflow Activity.
13-
* <p>
14-
* This means:
26+
*
27+
* <p>This means:
1528
* <ul>
1629
* <li>Each tool call is recorded in the Dapr Workflow history.</li>
1730
* <li>If the process crashes during a tool call, Dapr retries the activity automatically.</li>
@@ -21,25 +34,37 @@
2134
@ApplicationScoped
2235
public class ResearchTools {
2336

24-
@Tool("Looks up real-time population data for a given country")
25-
public String getPopulation(String country) {
26-
// In a real implementation this would call an external API.
27-
// Here we return a stub so the example runs without network access.
28-
return switch (country.toLowerCase()) {
29-
case "france" -> "France has approximately 68 million inhabitants (2024).";
30-
case "germany" -> "Germany has approximately 84 million inhabitants (2024).";
31-
case "japan" -> "Japan has approximately 124 million inhabitants (2024).";
32-
default -> country + " population data is not available in this demo.";
33-
};
34-
}
37+
/**
38+
* Looks up real-time population data for a given country.
39+
*
40+
* @param country the country to look up
41+
* @return population data string
42+
*/
43+
@Tool("Looks up real-time population data for a given country")
44+
public String getPopulation(String country) {
45+
// In a real implementation this would call an external API.
46+
// Here we return a stub so the example runs without network access.
47+
return switch (country.toLowerCase()) {
48+
case "france" -> "France has approximately 68 million inhabitants (2024).";
49+
case "germany" -> "Germany has approximately 84 million inhabitants (2024).";
50+
case "japan" -> "Japan has approximately 124 million inhabitants (2024).";
51+
default -> country + " population data is not available in this demo.";
52+
};
53+
}
3554

36-
@Tool("Returns the official capital city of a given country")
37-
public String getCapital(String country) {
38-
return switch (country.toLowerCase()) {
39-
case "france" -> "The capital of France is Paris.";
40-
case "germany" -> "The capital of Germany is Berlin.";
41-
case "japan" -> "The capital of Japan is Tokyo.";
42-
default -> "Capital city for " + country + " is not available in this demo.";
43-
};
44-
}
45-
}
55+
/**
56+
* Returns the official capital city of a given country.
57+
*
58+
* @param country the country to look up
59+
* @return capital city string
60+
*/
61+
@Tool("Returns the official capital city of a given country")
62+
public String getCapital(String country) {
63+
return switch (country.toLowerCase()) {
64+
case "france" -> "The capital of France is Paris.";
65+
case "germany" -> "The capital of Germany is Berlin.";
66+
case "japan" -> "The capital of Japan is Tokyo.";
67+
default -> "Capital city for " + country + " is not available in this demo.";
68+
};
69+
}
70+
}

0 commit comments

Comments
 (0)