diff --git a/agentic-patterns/chain-workflow/output.txt b/agentic-patterns/chain-workflow/output.txt new file mode 100644 index 0000000..1f1e470 --- /dev/null +++ b/agentic-patterns/chain-workflow/output.txt @@ -0,0 +1,257 @@ +[INFO] Scanning for projects... +[INFO] +[INFO] -------------< com.example.spring.ai:evaluator-optimizer >-------------- +[INFO] Building evaluator-optimizer 0.0.1-SNAPSHOT +[INFO] from pom.xml +[INFO] --------------------------------[ jar ]--------------------------------- +[INFO] +[INFO] >>> spring-boot:3.4.5:run (default-cli) > test-compile @ evaluator-optimizer >>> +[INFO] +[INFO] --- resources:3.3.1:resources (default-resources) @ evaluator-optimizer --- +[INFO] Copying 1 resource from src/main/resources to target/classes +[INFO] Copying 0 resource from src/main/resources to target/classes +[INFO] +[INFO] --- compiler:3.13.0:compile (default-compile) @ evaluator-optimizer --- +[INFO] Nothing to compile - all classes are up to date. +[INFO] +[INFO] --- resources:3.3.1:testResources (default-testResources) @ evaluator-optimizer --- +[INFO] skip non existing resourceDirectory /home/mark/projects/spring-ai-examples/agentic-patterns/evaluator-optimizer/src/test/resources +[INFO] +[INFO] --- compiler:3.13.0:testCompile (default-testCompile) @ evaluator-optimizer --- +[INFO] No sources to compile +[INFO] +[INFO] <<< spring-boot:3.4.5:run (default-cli) < test-compile @ evaluator-optimizer <<< +[INFO] +[INFO] +[INFO] --- spring-boot:3.4.5:run (default-cli) @ evaluator-optimizer --- +[INFO] Attaching agents: [] + + . ____ _ __ _ _ + /\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \ +( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \ + \\/ ___)| |_)| | | | | || (_| | ) ) ) ) + ' |____| .__|_| |_|_| |_\__, | / / / / + =========|_|==============|___/=/_/_/_/ + + :: Spring Boot :: (v3.4.5) + +2025-05-02T14:04:25.705-04:00 INFO 218056 --- [mcp] [ main] com.example.agentic.Application : Starting Application using Java 17.0.12 with PID 218056 (/home/mark/projects/spring-ai-examples/agentic-patterns/evaluator-optimizer/target/classes started by mark in /home/mark/projects/spring-ai-examples/agentic-patterns/evaluator-optimizer) +2025-05-02T14:04:25.710-04:00 INFO 218056 --- [mcp] [ main] com.example.agentic.Application : No active profile set, falling back to 1 default profile: "default" +2025-05-02T14:04:27.710-04:00 INFO 218056 --- [mcp] [ main] com.example.agentic.Application : Started Application in 2.633 seconds (process running for 3.112) + +=== GENERATOR OUTPUT === +THOUGHTS: Implementing a stack with push, pop, and getMin operations using two stacks for efficiency. + +RESPONSE: + public class Stack { + private java.util.Stack stack; + private java.util.Stack minStack; + public Stack() { + this.stack = new java.util.Stack<>(); + this.minStack = new java.util.Stack<>(); + } + public void push(int x) { + this.stack.push(x); + if (this.minStack.isEmpty() || x <= this.minStack.peek()) { + this.minStack.push(x); + } + } + public void pop() { + if (this.stack.isEmpty()) return; + int top = this.stack.pop(); + if (top == this.minStack.peek()) { + this.minStack.pop(); + } + } + public int getMin() { + if (this.minStack.isEmpty()) throw new java.util.EmptyStackException(); + return this.minStack.peek(); + } +} + + +=== EVALUATOR OUTPUT === +EVALUATION: NEEDS_IMPROVEMENT + +FEEDBACK: The code implementation is correct in terms of functionality and time complexity, achieving O(1) for all operations. However, it lacks proper Javadoc documentation for the class and its methods, which is important for best practices. Adding Javadoc comments to describe the class and each method's purpose, parameters, and return values would improve the code. + + +=== GENERATOR OUTPUT === +THOUGHTS: Adding Javadoc comments to the Stack implementation for clarity and documentation. + +RESPONSE: + public class Stack { + /** + * Stack to store all elements. + */ + private java.util.Stack stack; + /** + * Stack to store the minimum values. + */ + private java.util.Stack minStack; + /** + * Constructor to initialize the Stack and MinStack. + */ + public Stack() { + this.stack = new java.util.Stack<>(); + this.minStack = new java.util.Stack<>(); + } + /** + * Pushes an element onto the stack and updates the minStack if necessary. + * @param x the element to push onto the stack + */ + public void push(int x) { + this.stack.push(x); + if (this.minStack.isEmpty() || x <= this.minStack.peek()) { + this.minStack.push(x); + } + } + /** + * Removes the element on top of the stack and updates the minStack. + */ + public void pop() { + if (this.stack.isEmpty()) return; + int top = this.stack.pop(); + if (top == this.minStack.peek()) { + this.minStack.pop(); + } + } + /** + * Retrieves the minimum element in the stack. + * @return the minimum element in the stack + * @throws java.util.EmptyStackException if the stack is empty + */ + public int getMin() { + if (this.minStack.isEmpty()) throw new java.util.EmptyStackException(); + return this.minStack.peek(); + } +} + + +=== EVALUATOR OUTPUT === +EVALUATION: PASS + +FEEDBACK: The code correctly implements a stack with push, pop, and getMin operations in O(1) time complexity. It uses two stacks to maintain elements and track the minimum values. All fields are private and prefixed with 'this.', and proper Javadoc documentation is provided for clarity. + +FINAL OUTPUT: + : RefinedResponse[solution=public class Stack { + /** + * Stack to store all elements. + */ + private java.util.Stack stack; + /** + * Stack to store the minimum values. + */ + private java.util.Stack minStack; + /** + * Constructor to initialize the Stack and MinStack. + */ + public Stack() { + this.stack = new java.util.Stack<>(); + this.minStack = new java.util.Stack<>(); + } + /** + * Pushes an element onto the stack and updates the minStack if necessary. + * @param x the element to push onto the stack + */ + public void push(int x) { + this.stack.push(x); + if (this.minStack.isEmpty() || x <= this.minStack.peek()) { + this.minStack.push(x); + } + } + /** + * Removes the element on top of the stack and updates the minStack. + */ + public void pop() { + if (this.stack.isEmpty()) return; + int top = this.stack.pop(); + if (top == this.minStack.peek()) { + this.minStack.pop(); + } + } + /** + * Retrieves the minimum element in the stack. + * @return the minimum element in the stack + * @throws java.util.EmptyStackException if the stack is empty + */ + public int getMin() { + if (this.minStack.isEmpty()) throw new java.util.EmptyStackException(); + return this.minStack.peek(); + } +}, chainOfThought=[Generation[thoughts=Implementing a stack with push, pop, and getMin operations using two stacks for efficiency., response=public class Stack { + private java.util.Stack stack; + private java.util.Stack minStack; + public Stack() { + this.stack = new java.util.Stack<>(); + this.minStack = new java.util.Stack<>(); + } + public void push(int x) { + this.stack.push(x); + if (this.minStack.isEmpty() || x <= this.minStack.peek()) { + this.minStack.push(x); + } + } + public void pop() { + if (this.stack.isEmpty()) return; + int top = this.stack.pop(); + if (top == this.minStack.peek()) { + this.minStack.pop(); + } + } + public int getMin() { + if (this.minStack.isEmpty()) throw new java.util.EmptyStackException(); + return this.minStack.peek(); + } +}], Generation[thoughts=Adding Javadoc comments to the Stack implementation for clarity and documentation., response=public class Stack { + /** + * Stack to store all elements. + */ + private java.util.Stack stack; + /** + * Stack to store the minimum values. + */ + private java.util.Stack minStack; + /** + * Constructor to initialize the Stack and MinStack. + */ + public Stack() { + this.stack = new java.util.Stack<>(); + this.minStack = new java.util.Stack<>(); + } + /** + * Pushes an element onto the stack and updates the minStack if necessary. + * @param x the element to push onto the stack + */ + public void push(int x) { + this.stack.push(x); + if (this.minStack.isEmpty() || x <= this.minStack.peek()) { + this.minStack.push(x); + } + } + /** + * Removes the element on top of the stack and updates the minStack. + */ + public void pop() { + if (this.stack.isEmpty()) return; + int top = this.stack.pop(); + if (top == this.minStack.peek()) { + this.minStack.pop(); + } + } + /** + * Retrieves the minimum element in the stack. + * @return the minimum element in the stack + * @throws java.util.EmptyStackException if the stack is empty + */ + public int getMin() { + if (this.minStack.isEmpty()) throw new java.util.EmptyStackException(); + return this.minStack.peek(); + } +}]]] +[INFO] ------------------------------------------------------------------------ +[INFO] BUILD SUCCESS +[INFO] ------------------------------------------------------------------------ +[INFO] Total time: 18.434 s +[INFO] Finished at: 2025-05-02T14:04:41-04:00 +[INFO] ------------------------------------------------------------------------ diff --git a/agentic-patterns/chain-workflow/pom.xml b/agentic-patterns/chain-workflow/pom.xml index 1c192a0..9d56f35 100644 --- a/agentic-patterns/chain-workflow/pom.xml +++ b/agentic-patterns/chain-workflow/pom.xml @@ -6,7 +6,7 @@ org.springframework.boot spring-boot-starter-parent - 3.4.1 + 3.4.5 com.example.spring.ai diff --git a/agentic-patterns/chain-workflow/run-chain-workflow.sh b/agentic-patterns/chain-workflow/run-chain-workflow.sh new file mode 100755 index 0000000..f10b108 --- /dev/null +++ b/agentic-patterns/chain-workflow/run-chain-workflow.sh @@ -0,0 +1,90 @@ +#!/bin/bash + +# Script to build and run the Chain Workflow example with verification +# Usage: ./run-chain-workflow.sh + +set -e + +# Colors for output +GREEN='\033[0;32m' +RED='\033[0;31m' +YELLOW='\033[0;33m' +NC='\033[0m' # No Color + +SCRIPT_DIR=$(dirname "$(readlink -f "$0")") +cd "$SCRIPT_DIR" + +# Function to display section header +function section() { + echo -e "\n${YELLOW}======== $1 ========${NC}" +} + +# Build the project +section "Building Chain Workflow" +echo "Running mvn clean package..." +./mvnw clean package + +# Run the application and capture output +section "Running Chain Workflow" +echo "Starting the application..." +OUTPUT_FILE=$(mktemp) +./mvnw spring-boot:run | tee "$OUTPUT_FILE" + +# Verify the output +section "Verifying Output" + +# Check if markdown table is present +if ! grep -q "| Metric | Value |" "$OUTPUT_FILE"; then + echo -e "${RED}ERROR: Markdown table header not found in output${NC}" + rm "$OUTPUT_FILE" + exit 1 +fi + +# Check for expected metrics in the output +EXPECTED_METRICS=( + "Customer Satisfaction" + "Employee Satisfaction" + "Product Adoption Rate" + "Revenue Growth" + "Operating Margin" + "Market Share" + "Customer Churn" +) + +ERRORS=0 +for metric in "${EXPECTED_METRICS[@]}"; do + if ! grep -q "| $metric |" "$OUTPUT_FILE"; then + echo -e "${RED}ERROR: Expected metric not found: $metric${NC}" + ERRORS=$((ERRORS+1)) + fi +done + +# Verify sorting (highest values should come first) +# This is a basic check - values should decrease as we go down the table +if grep -A1 "Customer Satisfaction" "$OUTPUT_FILE" | grep -q "Employee Satisfaction" && \ + grep -A1 "Employee Satisfaction" "$OUTPUT_FILE" | grep -q "Product Adoption Rate"; then + echo -e "${GREEN}✓ Metrics appear to be correctly sorted by value${NC}" +else + echo -e "${RED}ERROR: Metrics don't appear to be correctly sorted${NC}" + ERRORS=$((ERRORS+1)) +fi + +# Check for completion status +if grep -q "BUILD SUCCESS" "$OUTPUT_FILE"; then + echo -e "${GREEN}✓ Application completed successfully${NC}" +else + echo -e "${RED}ERROR: Application did not complete successfully${NC}" + ERRORS=$((ERRORS+1)) +fi + +# Clean up +rm "$OUTPUT_FILE" + +# Final result +if [ $ERRORS -eq 0 ]; then + echo -e "\n${GREEN}✓ Chain Workflow executed and verified successfully!${NC}" + exit 0 +else + echo -e "\n${RED}× Chain Workflow verification failed with $ERRORS errors!${NC}" + exit 1 +fi \ No newline at end of file diff --git a/agentic-patterns/evaluator-optimizer/pom.xml b/agentic-patterns/evaluator-optimizer/pom.xml index 15f0b08..a977b8c 100644 --- a/agentic-patterns/evaluator-optimizer/pom.xml +++ b/agentic-patterns/evaluator-optimizer/pom.xml @@ -6,7 +6,7 @@ org.springframework.boot spring-boot-starter-parent - 3.4.1 + 3.4.5 com.example.spring.ai @@ -16,7 +16,7 @@ Demo project for Spring Boot 17 - 1.0.0-SNAPSHOT + 1.0.0-M8 @@ -25,16 +25,16 @@ - - org.springframework.ai - spring-ai-starter-model-anthropic + spring-ai-starter-model-openai + + + + + com.example.spring.ai diff --git a/agentic-patterns/parallelization-worflow/pom.xml b/agentic-patterns/parallelization-worflow/pom.xml index bac16fb..e14182a 100644 --- a/agentic-patterns/parallelization-worflow/pom.xml +++ b/agentic-patterns/parallelization-worflow/pom.xml @@ -6,7 +6,7 @@ org.springframework.boot spring-boot-starter-parent - 3.4.1 + 3.4.5 diff --git a/agentic-patterns/routing-workflow/pom.xml b/agentic-patterns/routing-workflow/pom.xml index 79fb27e..3147292 100644 --- a/agentic-patterns/routing-workflow/pom.xml +++ b/agentic-patterns/routing-workflow/pom.xml @@ -6,7 +6,7 @@ org.springframework.boot spring-boot-starter-parent - 3.4.1 + 3.4.5 diff --git a/agents/reflection/pom.xml b/agents/reflection/pom.xml index 228b371..4e24db6 100644 --- a/agents/reflection/pom.xml +++ b/agents/reflection/pom.xml @@ -5,7 +5,7 @@ org.springframework.boot spring-boot-starter-parent - 3.3.0 + 3.4.5 com.example diff --git a/kotlin/kotlin-function-callback/pom.xml b/kotlin/kotlin-function-callback/pom.xml index 0037090..ea5da94 100644 --- a/kotlin/kotlin-function-callback/pom.xml +++ b/kotlin/kotlin-function-callback/pom.xml @@ -5,7 +5,7 @@ org.springframework.boot spring-boot-starter-parent - 3.3.5 + 3.4.5 com.example diff --git a/kotlin/kotlin-hello-world/pom.xml b/kotlin/kotlin-hello-world/pom.xml index 434446e..2dc9700 100644 --- a/kotlin/kotlin-hello-world/pom.xml +++ b/kotlin/kotlin-hello-world/pom.xml @@ -5,7 +5,7 @@ org.springframework.boot spring-boot-starter-parent - 3.3.5 + 3.4.5 com.example diff --git a/kotlin/rag-with-kotlin/pom.xml b/kotlin/rag-with-kotlin/pom.xml index 4ee252e..78413f7 100644 --- a/kotlin/rag-with-kotlin/pom.xml +++ b/kotlin/rag-with-kotlin/pom.xml @@ -5,7 +5,7 @@ org.springframework.boot spring-boot-starter-parent - 3.3.5 + 3.4.5 com.example diff --git a/misc/openai-streaming-response/pom.xml b/misc/openai-streaming-response/pom.xml index e715cb7..79d7f07 100644 --- a/misc/openai-streaming-response/pom.xml +++ b/misc/openai-streaming-response/pom.xml @@ -5,7 +5,7 @@ org.springframework.boot spring-boot-starter-parent - 3.3.5 + 3.4.5 com.example diff --git a/misc/spring-ai-java-function-callback/pom.xml b/misc/spring-ai-java-function-callback/pom.xml index 9ace397..a3f8e7a 100644 --- a/misc/spring-ai-java-function-callback/pom.xml +++ b/misc/spring-ai-java-function-callback/pom.xml @@ -5,7 +5,7 @@ org.springframework.boot spring-boot-starter-parent - 3.3.7-SNAPSHOT + 3.4.5 com.example diff --git a/misc/spring-ai-java-function-callback/src/main/java/com/example/java_ai_function_callback/#SpringAiJavaFunctionCallbackApplication.java# b/misc/spring-ai-java-function-callback/src/main/java/com/example/java_ai_function_callback/#SpringAiJavaFunctionCallbackApplication.java# new file mode 100644 index 0000000..5aade42 --- /dev/null +++ b/misc/spring-ai-java-function-callback/src/main/java/com/example/java_ai_function_callback/#SpringAiJavaFunctionCallbackApplication.java# @@ -0,0 +1,97 @@ +package com.example.java_ai_function_callback; + +import java.util.function.Function; + +import org.springframework.ai.chat.client.ChatClient; +import org.springframework.ai.chat.model.ChatResponse; +import org.springframework.ai.tool.ToolCallback; +import org.springframework.ai.tool.function.FunctionToolCallback; +import org.springframework.boot.CommandLineRunner; +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +@SpringBootApplication +public class SpringAiJavaFunctionCallbackApplication { + + public static void main(String[] args) { + SpringApplication.run(SpringAiJavaFunctionCallbackApplication.class, args); + } + + @Bean + public CommandLineRunner init(ChatClient.Builder chatClientBuilder) { + return args -> { + try { + ChatClient chatClient = chatClientBuilder.build(); + ChatResponse response = chatClient + .prompt("What are the weather conditions in San Francisco, Tokyo, and Paris? Find the temperature in Celsius for each of the three locations.") + .toolNames("WeatherInfo") + .call().chatResponse(); + + System.out.println("Response: " + response); + System.out.println("Exiting successfully"); + System.exit(0); + } + catch (Exception e) { + System.out.println("Error during weather check: " + e.getMessage()); + } + }; + } + + public enum Unit { + C("metric"), + F("imperial"); + + private final String unitName; + + Unit(String unitName) { + this.unitName = unitName; + } + + public String getUnitName() { + return unitName; + } + } + + @Configuration + static class Config { + + @Bean + public ToolCallback weatherFunctionInfo(Function currentWeather) { + return FunctionToolCallback.builder("WeatherInfo", currentWeather) + .description( + "Find the weather conditions, forecasts, and temperatures for a location, like a city or state." + ) + .inputType(WeatherRequest.class) + .build(); + } + + @Bean + public Function currentWeather() { + return request -> new MockJavaWeatherService().apply(request); + } + + } + + static class MockJavaWeatherService implements Function { + + @Override + public WeatherResponse apply(WeatherRequest weatherRequest) { + double temperature = 10.0; + if (weatherRequest.getLocation().contains("Paris")) { + temperature = 15.0; + } + else if (weatherRequest.getLocation().contains("Tokyo")) { + temperature = 10.0; + } + else if (weatherRequest.getLocation().contains("San Francisco")) { + temperature = 30.0; + } + + return new WeatherResponse(temperature, 15.0, 20.0, 2.0, 53, 45, Unit.C); + } + + } + +} diff --git a/misc/spring-ai-java-function-callback/src/main/java/com/example/java_ai_function_callback/.#SpringAiJavaFunctionCallbackApplication.java b/misc/spring-ai-java-function-callback/src/main/java/com/example/java_ai_function_callback/.#SpringAiJavaFunctionCallbackApplication.java new file mode 120000 index 0000000..2d5e036 --- /dev/null +++ b/misc/spring-ai-java-function-callback/src/main/java/com/example/java_ai_function_callback/.#SpringAiJavaFunctionCallbackApplication.java @@ -0,0 +1 @@ +mark@feynman.187885:1746111141 \ No newline at end of file diff --git a/misc/spring-ai-java-function-callback/src/test/java/com/example/java_ai_function_callback/SpringAiJavaFunctionCallbackApplicationTests.java b/misc/spring-ai-java-function-callback/src/test/java/com/example/java_ai_function_callback/SpringAiJavaFunctionCallbackApplicationTests.java deleted file mode 100644 index 39a9dab..0000000 --- a/misc/spring-ai-java-function-callback/src/test/java/com/example/java_ai_function_callback/SpringAiJavaFunctionCallbackApplicationTests.java +++ /dev/null @@ -1,13 +0,0 @@ -package com.example.java_ai_function_callback; - -import org.junit.jupiter.api.Test; -import org.springframework.boot.test.context.SpringBootTest; - -@SpringBootTest -class SpringAiJavaFunctionCallbackApplicationTests { - - @Test - void contextLoads() { - } - -} diff --git a/model-context-protocol/brave/pom.xml b/model-context-protocol/brave/pom.xml index d1e14cf..b8c5101 100644 --- a/model-context-protocol/brave/pom.xml +++ b/model-context-protocol/brave/pom.xml @@ -6,7 +6,7 @@ org.springframework.boot spring-boot-starter-parent - 3.3.6 + 3.4.5 com.example diff --git a/model-context-protocol/client-starter/starter-default-client/pom.xml b/model-context-protocol/client-starter/starter-default-client/pom.xml index 3c13abf..8a57f60 100644 --- a/model-context-protocol/client-starter/starter-default-client/pom.xml +++ b/model-context-protocol/client-starter/starter-default-client/pom.xml @@ -6,7 +6,7 @@ org.springframework.boot spring-boot-starter-parent - 3.3.6 + 3.4.5 com.example diff --git a/model-context-protocol/client-starter/starter-webflux-client/pom.xml b/model-context-protocol/client-starter/starter-webflux-client/pom.xml index 78b1e90..2a6c4ef 100644 --- a/model-context-protocol/client-starter/starter-webflux-client/pom.xml +++ b/model-context-protocol/client-starter/starter-webflux-client/pom.xml @@ -6,7 +6,7 @@ org.springframework.boot spring-boot-starter-parent - 3.3.6 + 3.4.5 com.example diff --git a/model-context-protocol/dynamic-tool-update/client/pom.xml b/model-context-protocol/dynamic-tool-update/client/pom.xml index be5839c..52bad05 100644 --- a/model-context-protocol/dynamic-tool-update/client/pom.xml +++ b/model-context-protocol/dynamic-tool-update/client/pom.xml @@ -6,7 +6,7 @@ org.springframework.boot spring-boot-starter-parent - 3.3.6 + 3.4.5 com.example diff --git a/model-context-protocol/dynamic-tool-update/server/pom.xml b/model-context-protocol/dynamic-tool-update/server/pom.xml index 7ae3699..5d311c7 100644 --- a/model-context-protocol/dynamic-tool-update/server/pom.xml +++ b/model-context-protocol/dynamic-tool-update/server/pom.xml @@ -6,7 +6,7 @@ org.springframework.boot spring-boot-starter-parent - 3.3.6 + 3.4.5 diff --git a/model-context-protocol/filesystem/pom.xml b/model-context-protocol/filesystem/pom.xml index 9ad38dc..fa3b60e 100644 --- a/model-context-protocol/filesystem/pom.xml +++ b/model-context-protocol/filesystem/pom.xml @@ -5,7 +5,7 @@ org.springframework.boot spring-boot-starter-parent - 3.3.6 + 3.4.5 com.example diff --git a/model-context-protocol/sampling/mcp-sampling-client/pom.xml b/model-context-protocol/sampling/mcp-sampling-client/pom.xml index 0085b2a..d77cfb4 100644 --- a/model-context-protocol/sampling/mcp-sampling-client/pom.xml +++ b/model-context-protocol/sampling/mcp-sampling-client/pom.xml @@ -6,7 +6,7 @@ org.springframework.boot spring-boot-starter-parent - 3.3.6 + 3.4.5 com.example diff --git a/model-context-protocol/sampling/mcp-weather-webmvc-server/pom.xml b/model-context-protocol/sampling/mcp-weather-webmvc-server/pom.xml index eefb74b..879ff1b 100644 --- a/model-context-protocol/sampling/mcp-weather-webmvc-server/pom.xml +++ b/model-context-protocol/sampling/mcp-weather-webmvc-server/pom.xml @@ -6,7 +6,7 @@ org.springframework.boot spring-boot-starter-parent - 3.3.6 + 3.4.5 diff --git a/model-context-protocol/sqlite/chatbot/pom.xml b/model-context-protocol/sqlite/chatbot/pom.xml index 0bc1523..9961456 100644 --- a/model-context-protocol/sqlite/chatbot/pom.xml +++ b/model-context-protocol/sqlite/chatbot/pom.xml @@ -5,7 +5,7 @@ org.springframework.boot spring-boot-starter-parent - 3.3.6 + 3.4.5 com.example diff --git a/model-context-protocol/sqlite/simple/pom.xml b/model-context-protocol/sqlite/simple/pom.xml index 3ee764c..787d2d8 100644 --- a/model-context-protocol/sqlite/simple/pom.xml +++ b/model-context-protocol/sqlite/simple/pom.xml @@ -5,7 +5,7 @@ org.springframework.boot spring-boot-starter-parent - 3.3.6 + 3.4.5 com.example diff --git a/model-context-protocol/weather/manual-webflux-server/pom.xml b/model-context-protocol/weather/manual-webflux-server/pom.xml index f8100a7..0fce478 100644 --- a/model-context-protocol/weather/manual-webflux-server/pom.xml +++ b/model-context-protocol/weather/manual-webflux-server/pom.xml @@ -6,7 +6,7 @@ org.springframework.boot spring-boot-starter-parent - 3.3.6 + 3.4.5 diff --git a/model-context-protocol/weather/starter-stdio-server/pom.xml b/model-context-protocol/weather/starter-stdio-server/pom.xml index 339fd1a..e3b2e4b 100644 --- a/model-context-protocol/weather/starter-stdio-server/pom.xml +++ b/model-context-protocol/weather/starter-stdio-server/pom.xml @@ -6,7 +6,7 @@ org.springframework.boot spring-boot-starter-parent - 3.3.6 + 3.4.5 diff --git a/model-context-protocol/weather/starter-webflux-server/pom.xml b/model-context-protocol/weather/starter-webflux-server/pom.xml index ba88908..053d499 100644 --- a/model-context-protocol/weather/starter-webflux-server/pom.xml +++ b/model-context-protocol/weather/starter-webflux-server/pom.xml @@ -6,7 +6,7 @@ org.springframework.boot spring-boot-starter-parent - 3.3.6 + 3.4.5 diff --git a/model-context-protocol/weather/starter-webmvc-oauth2-server/pom.xml b/model-context-protocol/weather/starter-webmvc-oauth2-server/pom.xml index 010fdf5..8bc8dd0 100644 --- a/model-context-protocol/weather/starter-webmvc-oauth2-server/pom.xml +++ b/model-context-protocol/weather/starter-webmvc-oauth2-server/pom.xml @@ -6,7 +6,7 @@ org.springframework.boot spring-boot-starter-parent - 3.4.3 + 3.4.5 diff --git a/model-context-protocol/weather/starter-webmvc-server/pom.xml b/model-context-protocol/weather/starter-webmvc-server/pom.xml index 31ab79c..bb92754 100644 --- a/model-context-protocol/weather/starter-webmvc-server/pom.xml +++ b/model-context-protocol/weather/starter-webmvc-server/pom.xml @@ -6,7 +6,7 @@ org.springframework.boot spring-boot-starter-parent - 3.3.6 + 3.4.5 diff --git a/model-context-protocol/web-search/brave-chatbot/pom.xml b/model-context-protocol/web-search/brave-chatbot/pom.xml index 53af8ab..fa57bdb 100644 --- a/model-context-protocol/web-search/brave-chatbot/pom.xml +++ b/model-context-protocol/web-search/brave-chatbot/pom.xml @@ -6,7 +6,7 @@ org.springframework.boot spring-boot-starter-parent - 3.3.6 + 3.4.5 com.example diff --git a/model-context-protocol/web-search/brave-starter/pom.xml b/model-context-protocol/web-search/brave-starter/pom.xml index 1ca67b9..60b4e74 100644 --- a/model-context-protocol/web-search/brave-starter/pom.xml +++ b/model-context-protocol/web-search/brave-starter/pom.xml @@ -6,7 +6,7 @@ org.springframework.boot spring-boot-starter-parent - 3.3.6 + 3.4.5 com.example diff --git a/models/chat/helloworld/pom.xml b/models/chat/helloworld/pom.xml index 5cd9638..56ce5a3 100644 --- a/models/chat/helloworld/pom.xml +++ b/models/chat/helloworld/pom.xml @@ -5,7 +5,7 @@ org.springframework.boot spring-boot-starter-parent - 3.3.0 + 3.4.5 com.example diff --git a/prompt-engineering/prompt-engineering-patterns/pom.xml b/prompt-engineering/prompt-engineering-patterns/pom.xml index 1c1022a..0c6cca5 100644 --- a/prompt-engineering/prompt-engineering-patterns/pom.xml +++ b/prompt-engineering/prompt-engineering-patterns/pom.xml @@ -5,7 +5,7 @@ org.springframework.boot spring-boot-starter-parent - 3.4.4 + 3.4.5 org.springframework.ai.example diff --git a/run-example.sh b/run-example.sh new file mode 100755 index 0000000..ffe6c8c --- /dev/null +++ b/run-example.sh @@ -0,0 +1,58 @@ +#!/bin/bash + +# Script to build and run Spring AI examples +# Usage: ./run-example.sh +# Example: ./run-example.sh agentic-patterns/chain-workflow + +set -e + +# Colors for output +GREEN='\033[0;32m' +RED='\033[0;31m' +YELLOW='\033[0;33m' +NC='\033[0m' # No Color + +# Base directory for Spring AI examples +BASE_DIR=$(dirname "$(readlink -f "$0")") + +# Check if project name is provided +if [ -z "$1" ]; then + echo -e "${RED}Error: Project directory not specified${NC}" + echo "Usage: ./run-example.sh " + echo "Example: ./run-example.sh agentic-patterns/chain-workflow" + exit 1 +fi + +PROJECT_PATH="$BASE_DIR/$1" + +# Check if project directory exists +if [ ! -d "$PROJECT_PATH" ]; then + echo -e "${RED}Error: Project directory not found: $PROJECT_PATH${NC}" + exit 1 +fi + +# Check if pom.xml exists +if [ ! -f "$PROJECT_PATH/pom.xml" ]; then + echo -e "${RED}Error: pom.xml not found in $PROJECT_PATH${NC}" + echo "This script is for Maven-based Spring AI examples only." + exit 1 +fi + +# Function to display section header +function section() { + echo -e "\n${YELLOW}======== $1 ========${NC}" +} + +# Navigate to project directory +cd "$PROJECT_PATH" +PROJECT_NAME=$(basename "$PROJECT_PATH") + +section "Building $PROJECT_NAME" +echo "Running mvn clean package..." +./mvnw clean package + +section "Running $PROJECT_NAME" +echo "Starting the application..." +./mvnw spring-boot:run + +echo -e "\n${GREEN}Execution completed successfully!${NC}" \ No newline at end of file