Skip to content

Commit 5b545df

Browse files
committed
edits
1 parent 163c963 commit 5b545df

File tree

7 files changed

+42
-70
lines changed

7 files changed

+42
-70
lines changed

learn-pr/azure/build-enterprise-ai-agents-with-java-spring/includes/2-pgvector-azure-postgresql-setup.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ The `pgvector` extension adds an open-source vector similarity search to Postgre
2121
Before you can enable `pgvector` on your Azure Database for PostgreSQL flexible server instance, you need to add it to your allowlist as described in [Allow extensions](/azure/postgresql/extensions/how-to-allow-extensions). To determine whether you added it correctly, use the following command: `SHOW azure.extensions;`
2222

2323
> [!IMPORTANT]
24-
> Although the PostgreSQL community often refers to this extension as `pgvector`, the name of the binary and the extension itself is `vector`. That is the name you must use in the allowlist and when you create it in PostgreSQL via the `CREATE EXTENSION` command.
24+
> The PostgreSQL community often refers to this extension as `pgvector`. However, the name of the binary and the extension itself is `vector`, which is the name you must use in the allowlist and when you create it in PostgreSQL via the `CREATE EXTENSION` command.
2525
2626
After you add the extension to the allowlist, install the extension by using the following SQL command:
2727

@@ -44,7 +44,7 @@ LIMIT 3;
4444

4545
Spring AI includes an abstraction of `pgvector` named `VectorStore`. This implementation requires two other PostgreSQL extensions: `hstore` and `uuid-ossp`.
4646

47-
On startup, Spring Boot installs the required extensions and creates the required `vector_store` table with an index if doesn't already exist.
47+
On startup, Spring Boot installs the required extensions and creates the required `vector_store` table with an index if it doesn't already exist.
4848

4949
## Unit summary
5050

learn-pr/azure/build-enterprise-ai-agents-with-java-spring/includes/3-exercise-pgvector-azure-postgresql-setup.md

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,10 @@ export PUBLIC_IP=$(curl -s ipinfo.io/ip)
2525
echo "Start IP: $PUBLIC_IP"
2626
```
2727

28-
> [!TIP]
29-
> This command should work in most Linux distributions and in Git Bash. If it doesn't work, you can alternatively get your public IP address using [https://whatismyipaddress.com/](https://whatismyipaddress.com/)
28+
This command should work in most Linux distributions and in Git Bash. If it doesn't work, you can alternatively get your public IP address by using [https://whatismyipaddress.com/](https://whatismyipaddress.com/)
3029

3130
> [!NOTE]
32-
> Your IP address can change. If this happens, you must update the corresponding firewall rule accordingly.
31+
> Your IP address can change. If it changes, you must update the corresponding firewall rule accordingly.
3332
3433
### Create a resource group
3534

@@ -105,7 +104,7 @@ az postgres flexible-server ad-admin create \
105104
--display-name azureuser
106105
```
107106

108-
### Update allowlist required extensions for pgvector
107+
### Allow the required extensions for pgvector
109108

110109
Before you can enable the extensions required by `pgvector`, you need to allow them by using the following command:
111110

@@ -161,4 +160,4 @@ After this rule is created, you can update it by using `az postgres flexible-ser
161160

162161
## Unit summary
163162

164-
You now have a vector-enabled PostgreSQL database ready that provides vector similarity search capabilities
163+
You now have a vector-enabled PostgreSQL database ready that provides vector similarity search capabilities.

learn-pr/azure/build-enterprise-ai-agents-with-java-spring/includes/5-exercise-spring-ai-development.md

Lines changed: 7 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,8 @@
11
In this unit, you build a retrieval-augmented generation (RAG) application using Spring AI, Azure OpenAI, and `VectorStore` from Spring AI.
22

3-
## Set up your development environment
4-
5-
Before you start building an AI-powered application, set up your development environment and the required Azure resources.
6-
7-
## Set up your local environment
8-
9-
Use the following steps to set up your environment:
10-
11-
1. Use the following command to confirm that the Java Development Kit (JDK) version 17 or greater is installed:
12-
13-
```bash
14-
java -version # Verify the Java installation
15-
```
16-
17-
1. Use the following command to confirm that Maven is installed:
18-
19-
```bash
20-
mvn -version # Verify the Maven installation
21-
```
22-
23-
1. Use the following command to sign in to Azure:
24-
25-
```azurecli
26-
az login
27-
```
28-
293
## Set up environment variables
304

31-
For this exercise, you need some environment variables from prior exercises. If you're using the same Bash window, these variables should still exist. If the variables are no longer available, use the following commands to recreate them:
5+
For this exercise, you need some environment variables from prior exercises. If you're using the same Bash window, these variables should still exist. If the variables are no longer available, use the following commands to recreate them. Be sure to replace the `<...>` placeholders with your own values, and use the same values that you used previously.
326

337
```bash
348
export RESOURCE_GROUP=<resource-group>
@@ -122,11 +96,11 @@ The generated Spring Boot starter project includes the following configurations
12296
- Spring Boot Version: 3.4.3
12397
- Java Version: 17
12498
- Dependencies:
125-
- `web`: Adds support for building web applications, including RESTful services using Spring Model View Controller (MVC).
126-
- `jdbc`: Provides Java Database Connectivity (JDBC) support for database access.
127-
- `azure-support`: Adds support for integrating with Azure services.
128-
- `spring-ai-azure-openai`: Adds support for integrating with Azure OpenAI services.
129-
- `spring-ai-vectordb-pgvector`: Adds support for using `pgvector`, a PostgreSQL extension for vector embeddings.
99+
- `web`: adds support for building web applications, including RESTful services using Spring Model View Controller (MVC).
100+
- `jdbc`: provides Java Database Connectivity (JDBC) support for database access.
101+
- `azure-support`: adds support for integrating with Azure services.
102+
- `spring-ai-azure-openai`: adds support for integrating with Azure OpenAI services.
103+
- `spring-ai-vectordb-pgvector`: adds support for using `pgvector`, a PostgreSQL extension for vector embeddings.
130104

131105
Unzip the downloaded file using the command:
132106

@@ -196,7 +170,7 @@ src/
196170
└── pom.xml
197171
```
198172

199-
### Spring AI configuration
173+
### Configure Spring AI
200174

201175
Before you can run the application successfully, you need to add the following required configuration:
202176

learn-pr/azure/build-enterprise-ai-agents-with-java-spring/includes/6-agent-ai-development.md

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,55 +1,55 @@
1-
In this unit, you learn about AI Agents, which are autonomous entities capable of making decisions and performing tasks based on their environment and objectives. Also, you explore various agentic patterns - including the Evaluator Optimizer pattern - to improve the performance and decision-making capabilities of AI systems by evaluating and refining outputs.
1+
In this unit, you learn about AI agents, which are autonomous entities capable of making decisions and performing tasks based on their environment and objectives. Also, you explore various *agentic patterns* - including the Evaluator Optimizer pattern - to improve the performance and decision-making capabilities of AI systems by evaluating and refining outputs.
22

33
## What is an AI Agent?
44

55
An AI agent is a software entity designed to perform tasks autonomously or semi-autonomously by receiving input, processing information, and taking actions to achieve specific goals.
66

7-
Agents can send and receive messages, generating responses using a combination of models, tools, human inputs, or other customizable components.
7+
Agents can send and receive messages, generating responses using a combination of models, tools, human inputs, and other customizable components.
88

99
## What problems do AI agents solve?
1010

11-
AI agents offer several advantages for application development by enabling the creation of modular components that collaborate to reduce manual intervention in complex tasks. Key benefits include:
11+
AI agents offer several advantages for application development by enabling the creation of modular components that collaborate to reduce manual intervention in complex tasks. These advantage include the following key benefits:
1212

13-
- Modular Components: Define specialized agents for tasks like data scraping, API interaction, or natural language processing. This modularity makes it easier to adapt the application as requirements evolve.
13+
- Modular components: define specialized agents for tasks like data scraping, API interaction, and natural language processing. This modularity makes it easier to adapt the application as requirements evolve.
1414

15-
- Collaboration: Multiple agents can work together - one might handle data collection, another performs analysis, while yet another makes decisions - creating distributed intelligence.
15+
- Collaboration: multiple agents can work together. One might handle data collection, another might perform analysis, while yet another might make decisions, creating distributed intelligence.
1616

17-
- Human-Agent Collaboration: Agents can work alongside humans to augment decision-making, for example, by preparing analyses that humans review and refine.
17+
- Human-agent collaboration: agents can work alongside humans to augment decision-making - for example, by preparing analyses that humans review and refine.
1818

19-
- Process Orchestration: Agents can coordinate tasks across systems, tools, and APIs, automating end-to-end processes such as cloud orchestration, deployments, or creative workflows.
19+
- Process orchestration: agents can coordinate tasks across systems, tools, and APIs, automating end-to-end processes such as cloud orchestration, deployments, and creative workflows.
2020

2121
## Agent workflows and patterns
2222

23-
Modern AI applications can be designed using a variety of agentic patterns. The Spring AI blog post on Agentic Patterns outlines several key workflows:
23+
Modern AI applications can be designed using various agentic patterns. The Spring AI blog post on Agentic Patterns outlines several key workflows:
2424

25-
- Chain workflow: Breaks complex tasks into a series of sequential steps. Each step processes the output of the previous one, allowing for gradual transformation and refinement of data.
25+
- Chain workflow: breaks complex tasks into a series of sequential steps. Each step processes the output of the previous one, enabling gradual transformation and refinement of data.
2626

27-
- Parallelization workflow: Executes multiple LLM calls concurrently using techniques like thread pools and futures. This pattern is ideal for processing large volumes of independent items or obtaining diverse perspectives through majority voting.
27+
- Parallelization workflow: executes multiple large language model (LLM) calls concurrently using techniques like thread pools and futures. This pattern is ideal for processing large volumes of independent items or obtaining diverse perspectives through majority voting.
2828

29-
- Routing workflow: Directs inputs to specialized handlers based on content. By classifying the input and routing it to a corresponding prompt, the system ensures that each type of task is handled optimally.
29+
- Routing workflow: directs inputs to specialized handlers based on content. By classifying the input and routing it to a corresponding prompt, the system ensures that each type of task is handled optimally.
3030

31-
- Orchestrator-Workers workflow: Uses a central orchestrator to decompose a complex task into subtasks that are handled by specialized worker agents. This pattern supports distributed problem solving while maintaining overall process control.
31+
- Orchestrator-Workers workflow: uses a central orchestrator to decompose a complex task into subtasks that are handled by specialized worker agents. This pattern supports distributed problem solving while maintaining overall process control.
3232

33-
- Evaluator Optimizer workflow: Focused on iterative refinement, this dual-model approach uses a generator (writer) to produce an initial output and an evaluator (editor) to review and suggest improvements. The process repeats until the output meets defined quality standards.
33+
- Evaluator Optimizer workflow: focused on iterative refinement, this dual-model approach uses a generator (writer) to produce an initial output and an evaluator (editor) to review and suggest improvements. The process repeats until the output meets defined quality standards.
3434

3535
## Advanced content generation with the Evaluator Optimizer Agent pattern
3636

3737
Building on the core RAG functionality, advanced AI applications benefit from iterative refinement for generating high-quality content. The Evaluator Optimizer Agent pattern employs a dual-model process:
3838

39-
- Generator (Writer): Produces an initial draft, such as a blog post.
40-
- Evaluator (Editor): Reviews the draft, providing detailed feedback and identifying areas for improvement.
39+
- Generator (Writer): produces an initial draft, such as a blog post.
40+
- Evaluator (Editor): reviews the draft, providing detailed feedback and identifying areas for improvement.
4141

4242
### How it works
4343

4444
The following steps describe how this pattern works:
4545

46-
1. Initial generation: The writer creates a draft based on the given topic.
46+
1. Initial generation: the writer creates a draft based on the given topic.
4747

48-
1. Evaluation: The evaluator reviews the draft against criteria such as clarity, engagement, and structure.
48+
1. Evaluation: the evaluator reviews the draft against criteria such as clarity, engagement, and structure.
4949

50-
1. Iterative refinement: If improvements are needed, feedback is incorporated and the writer generates a revised draft.
50+
1. Iterative refinement: if improvements are needed, feedback is incorporated and the writer generates a revised draft.
5151

52-
1. Loop until approved: The process repeats until the content meets the desired quality standards or a maximum number of iterations is reached.
52+
1. Loop until approved: the process repeats until the content meets the desired quality standards or a maximum number of iterations is reached.
5353

5454
### Example application: blog post generation
5555

learn-pr/azure/build-enterprise-ai-agents-with-java-spring/includes/7-exercise-agent-ai-development.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -659,7 +659,7 @@ This command will return a JSON response containing both the blog content and me
659659

660660
With the implementation as shown above, you should consistently see at least 2 iterations (and often 3) in the feedback loop. The first iteration is guaranteed by the instruction to the Editor agent to always provide improvement feedback on the first round. This ensures you can observe the complete Evaluator Optimizer Agent pattern in action. Without this forced iteration, you might occasionally see the Editor agent approve the first draft immediately, which doesn't demonstrate the full pattern.
661661

662-
The JSON response provides valuable insights into the generation process, allowing you to track:
662+
The JSON response provides valuable insights into the generation process, enabling you to track:
663663

664664
- How many iterations were needed (3 in this example)
665665
- Whether the post was approved by the Editor agent (false in this example, meaning it reached max iterations)

learn-pr/azure/build-enterprise-ai-agents-with-java-spring/includes/8-aca-deployment.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ In this module, you learn how to deploy your Spring Retrieval Augmented Generati
22

33
## Azure Container Apps concepts
44

5-
Azure Container Apps is a serverless platform that allows you to maintain less infrastructure and save costs while running containerized applications.
5+
Azure Container Apps is a serverless platform that enables you to maintain less infrastructure and save costs while running containerized applications.
66

77
### Environments
88

@@ -22,7 +22,7 @@ Replicas are instances of your container app that run concurrently to handle inc
2222

2323
#### Revisions
2424

25-
Revisions are immutable snapshots of your container app's configuration and code at a specific point in time. Each deployment creates a new revision, allowing you to roll back to previous versions if needed. Revisions enable safe updates and version control for your containerized applications. You can configure traffic splitting between revisions to gradually roll out new features or perform A/B testing.
25+
Revisions are immutable snapshots of your container app's configuration and code at a specific point in time. Each deployment creates a new revision, enabling you to roll back to previous versions if needed. Revisions enable safe updates and version control for your containerized applications. You can configure traffic splitting between revisions to gradually roll out new features or perform A/B testing.
2626

2727
### Deployment types
2828

@@ -53,13 +53,13 @@ Azure Container Apps supports the following ingress options to control how your
5353

5454
Azure Container Apps provides flexible scaling options to ensure that your application can handle varying loads efficiently. The following list describes the primary scaling options:
5555

56-
- Manual scaling. You can manually set the number of replicas for your container app. This option gives you full control over the scaling process, allowing you to adjust the number of instances based on your specific needs.
56+
- Manual scaling. You can manually set the number of replicas for your container app. This option gives you full control over the scaling process, enabling you to adjust the number of instances based on your specific needs.
5757

58-
- Automatic scaling. Azure Container Apps support automatic scaling based on various metrics. You can configure autoscaling rules to automatically adjust the number of replicas based on CPU usage, memory usage, or custom metrics including `JVM` - Java Virtual Machine - metrics using Kubernetes Event-driven Autoscaling (KEDA). This capability ensures your application can handle increased traffic without manual intervention.
58+
- Automatic scaling. Azure Container Apps support automatic scaling based on various metrics. You can configure autoscaling rules to automatically adjust the number of replicas based on CPU usage, memory usage, or custom metrics, including `JVM` - Java Virtual Machine - metrics, using Kubernetes Event-driven Autoscaling (KEDA). This capability ensures your application can handle increased traffic without manual intervention.
5959

6060
- Scale to zero. For serverless applications, you can configure your container app to scale down to zero instances when there's no traffic. This helps save costs by only using resources when needed.
6161

62-
To configure scaling, you can use the Azure CLI, Azure portal, or ARM templates. Here's an example of how to set up autoscaling using the Azure CLI:
62+
To configure scaling, you can use the Azure CLI, the Azure portal, or ARM templates. The following example shows you how to set up autoscaling by using the Azure CLI:
6363

6464
```azurecli
6565
az containerapp update \

learn-pr/azure/build-enterprise-ai-agents-with-java-spring/index.yml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,8 @@ metadata:
88
ms.author: karler
99
ms.reviewer: jbalderas, gok
1010
ms.topic: module
11-
ms.custom: team=cloud_advocates
11+
ms.custom: team=cloud_advocates, devx-track-java
1212
ms.service: azure-container-apps
13-
ms.custom: devx-track-java
1413
ms.collection: ce-skilling-ai-copilot
1514
title: Build enterprise AI agents with Java and Spring
1615
summary: Build and deploy a Java application and AI agents using Spring AI, Azure OpenAI, and Azure Container Apps with PostgreSQL vector storage.
@@ -31,12 +30,12 @@ products:
3130
- azure-container-apps
3231
- azure-database-postgresql
3332
prerequisites: |
34-
- An Azure subscription.
33+
- An Azure subscription. [Create one for free.](https://azure.microsoft.com/free/)
3534
- Basic familiarity with Java and Spring Boot.
3635
- Experience with Git and Maven.
37-
- Java 17 or later installed.
36+
- [Java 17 or later](/java/openjdk/download#openjdk-17).
3837
- The psql client.
39-
- Maven.
38+
- [Maven](https://maven.apache.org/download.cgi).
4039
subjects:
4140
- machine-learning
4241
- custom-app-development

0 commit comments

Comments
 (0)