Skip to content

Commit f411f0b

Browse files
Edits to java-petclinic-ai-overview.md.
1 parent dbcd455 commit f411f0b

File tree

1 file changed

+31
-36
lines changed

1 file changed

+31
-36
lines changed
Lines changed: 31 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
---
22
title: Introduction to the Java PetClinic AI Sample in Azure Container Apps
3-
description: "Explains the architecture of AI applications deployed to Azure Container Apps."
3+
description: Explain the architecture of AI applications deployed to Azure Container Apps.
44
author: KarlErickson
55
ms.author: sonwan
66
ms.service: azure-container-apps
77
ms.topic: concept-article
8-
ms.date: 02/10/2025
8+
ms.date: 02/12/2025
99
ms.custom: devx-track-java, devx-track-extended-java
1010
#customer intent: As a developer, I want to understand the architecture of AI applications deployed to Azure Container Apps.
1111
---
@@ -20,37 +20,38 @@ The application features many different services working together to introduce t
2020

2121
## Architecture of the AI app in Azure Container Apps
2222

23-
The following diagram shows the architecture of the AI application in Azure Container Apps.
23+
The following diagram shows the architecture of the AI application in Azure Container Apps:
2424

2525
:::image type="complex" source="media/first-java-ai-application/architecture-chart.png" alt-text="Diagram of the architecture of the AI application, which includes a Container Apps environment, an API gateway, Entra ID for authentication, and other components." lightbox="media/first-java-ai-application/architecture-chart.png":::
2626
Diagram that shows the architecture of the AI application. Users access the system through authentication managed by Entra ID. The Azure Container App environment contains an API gateway that enables routing for and communication with the application. The API gateway uses managed identities to securely interact with Azure Container Registry and cognitive services. The API gateway also handles communication with external users. A virtual network between the API gateway and external systems provides secure and isolated network connectivity.
2727
:::image-end:::
2828

2929
The application's API gateway, hosted in the Azure Container Apps environment, serves as the central entry point for all external requests.
3030

31-
This gateway:
31+
This gateway performs the following functions:
3232

33-
- Routes and manages communication between application components
34-
- Authenticates users through Microsoft Entra ID
35-
- Secures access to Azure Container Registry and cognitive services using managed identities
36-
- Handles all incoming external user requests
33+
- Routes and manages communication between application components.
34+
- Authenticates users through Microsoft Entra ID.
35+
- Secures access to Azure Container Registry and cognitive services using managed identities.
36+
- Handles all incoming external user requests.
3737

3838
The gateway operates within a dedicated virtual network, ensuring secure and isolated communication between the application and external systems.
3939

4040
The following are the key components and services featured in the application:
4141

42-
| Service or feature | Description |
43-
|---|---|
44-
| [Azure Container Apps](/azure/container-apps/overview) | A fully managed serverless container platform for building and deploying modern apps. Handles autoscaling, traffic splitting, and revision management of containerized applications. |
45-
| [Azure Container Apps environment](/azure/container-apps/environment) | A secure boundary around a group of container apps that share networking, scaling, and management configurations. Provides the foundational runtime for container apps deployment. |
46-
| [Azure OpenAI Service](/azure/ai-services/openai/overview) | Provides REST API access to OpenAI's powerful language models like GPT-4, embeddings, and ChatGPT. Enables AI capabilities with enterprise-grade security and compliance features. |
47-
| [Azure Container Registry](/azure/container-registry/container-registry-intro) | A private Docker registry service for storing and managing container images. Supports automated container builds, vulnerability scanning, and geo-replication. |
48-
| [Managed Identities](/entra/identity/managed-identities-azure-resources/overview) | Provides Azure services with automatically managed identities in Azure AD. Eliminates the need for credential management by allowing secure service-to-service authentication without storing credentials in code. |
49-
| [Spring AI](https://spring.io/projects/spring-ai) | Spring framework for AI engineering that applies AI design principles to the Spring ecosystem. Alternatively, [Langchain4j](https://docs.langchain4j.dev/intro) is another AI framework with its own PetClinic sample in [spring-petclinic-langchain4j](https://github.com/Azure-Samples/spring-petclinic-langchain4j). For more information, see [Chat Client API](https://docs.spring.io/spring-ai/reference/api/chatclient.html). |
42+
| Service or feature | Description |
43+
|-----------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
44+
| [Azure Container Apps](/azure/container-apps/overview) | A fully managed serverless container platform for building and deploying modern apps. Handles autoscaling, traffic splitting, and revision management of containerized applications. |
45+
| [Azure Container Apps environment](/azure/container-apps/environment) | A secure boundary around a group of container apps that share networking, scaling, and management configurations. Provides the foundational runtime for container apps deployment. |
46+
| [Azure OpenAI Service](/azure/ai-services/openai/overview) | Provides REST API access to OpenAI's powerful language models like GPT-4, embeddings, and ChatGPT. Enables AI capabilities with enterprise-grade security and compliance features. |
47+
| [Azure Container Registry](/azure/container-registry/container-registry-intro) | A private Docker registry service for storing and managing container images. Supports automated container builds, vulnerability scanning, and geo-replication. |
48+
| [Managed Identities](/entra/identity/managed-identities-azure-resources/overview) | Provides Azure services with automatically managed identities in Azure AD. Eliminates the need for credential management by allowing secure service-to-service authentication without storing credentials in code. |
49+
| [Spring AI](https://spring.io/projects/spring-ai) | Spring framework for AI engineering that applies AI design principles to the Spring ecosystem. Alternatively, [Langchain4j](https://docs.langchain4j.dev/intro) is another AI framework with its own PetClinic sample in [spring-petclinic-langchain4j](https://github.com/Azure-Samples/spring-petclinic-langchain4j). For more information, see [Chat Client API](https://docs.spring.io/spring-ai/reference/api/chatclient.html).|
5050

51-
For more detail on infrastructure as code elements of the application, refer to the [bicep scripts](https://github.com/Azure-Samples/spring-petclinic-ai/blob/main/infra/bicep/main.bicep) in the [spring-petclinic-ai](https://github.com/Azure-Samples/spring-petclinic-ai/) repository.
51+
For more information on infrastructure as code elements of the application, see the [bicep scripts](https://github.com/Azure-Samples/spring-petclinic-ai/blob/main/infra/bicep/main.bicep) in the [Bring your first AI app in Azure Container Apps](https://github.com/Azure-Samples/spring-petclinic-ai/) repository
52+
.
5253

53-
### Code implementation
54+
## Code implementation
5455

5556
The following information is an introduction to the code for readers to understand the flow of this first AI application:
5657

@@ -66,21 +67,16 @@ return this.chatClient.prompt().user(u -> u.text(query)).call().content();
6667

6768
The [`ChatConfiguration`](https://github.com/Azure-Samples/spring-petclinic-ai/blob/main/src/main/java/org/springframework/samples/petclinic/genai/ChatConfiguration.java) class customizes requests sent to `chatClient`. The following are some key configuration settings of `chatClient`:
6869

69-
- **Connections authentication**: The client connects to Azure OpenAI. Both API key authentication and managed identity authentication are supported.
70+
- Connections authentication: The client connects to Azure OpenAI. Both API key authentication and managed identity authentication are supported.
71+
- Configuration settings location: For `ChatModel`, deployment `gpt-4o` and temperature `0.7` are set in the configuration file.
72+
- Vector database: The vector database stores mathematical representations of source documents, known as *embeddings*. The vector data is used by the chat API to find documents relevant to a user's question.
73+
- System prompt: Customize AI behavior and enhance performance.
74+
- API endpoints: The application features customized Azure Functions endpoints so that OpenAI to interact with the application.
75+
- Advisors: Advisors provide a flexible and powerful way to intercept, modify, and enhance AI-driven interactions in your Spring applications.
7076

71-
- **Configuration settings location**: For `ChatModel`, deployment `gpt-4o` and temperature `0.7` are set in the configuration file.
77+
### Example
7278

73-
- **Vector database**: The vector database stores mathematical representations of source documents, known as *embeddings*. The vector data is used by the chat API to find documents relevant to a user's question.
74-
75-
- **System prompt**: Customize AI behavior and enhance performance.
76-
77-
- **API endpoints**: The application features customized Azure Functions endpoints so that OpenAI to interact with the application.
78-
79-
- **Advisors**: Advisors provide a flexible and powerful way to intercept, modify, and enhance AI-driven interactions in your Spring applications.
80-
81-
#### Example
82-
83-
The following code listing shows how the `ChatClientCustomizer` class loads configuration information.
79+
The following code example shows how the `ChatClientCustomizer` class loads configuration information:
8480

8581
```java
8682
@Bean
@@ -98,7 +94,7 @@ public ChatClientCustomizer chatClientCustomizer(VectorStore vectorStore, ChatMo
9894

9995
The beans defined under `java.util.Function` are functions defined in the application context. These functions are the interface between the AI models and the PetClinc application.
10096

101-
There are sample functions in [`AIFunctionConfiguration.java`](https://github.com/Azure-Samples/spring-petclinic-ai/blob/main/src/main/java/org/springframework/samples/petclinic/genai/AIFunctionConfiguration.java) which communicate with the PetClinic application.
97+
There are sample functions in [AIFunctionConfiguration.java](https://github.com/Azure-Samples/spring-petclinic-ai/blob/main/src/main/java/org/springframework/samples/petclinic/genai/AIFunctionConfiguration.java) that communicate with the PetClinic application.
10298

10399
Keep in mind the following details about these functions:
104100

@@ -107,17 +103,16 @@ Keep in mind the following details about these functions:
107103

108104
### Advisors
109105

110-
Advisors are components that modify or enhance AI prompts which act as middleware for prompt processing.
106+
Advisors are components that modify or enhance AI prompts, which act as middleware for prompt processing.
111107

112108
This application uses two different advisors:
113109

114110
- [`QuestionAnswerAdvisor`](https://github.com/Azure-Samples/spring-petclinic-ai/blob/main/src/main/java/org/springframework/samples/petclinic/genai/ModeledQuestionAnswerAdvisor.java) calls the AI models that generate a new user which includes results from the search vector before finalizing the prompt.
115-
116-
- `PromptChatMemoryAdvisor`adds chat memory into the prompt and provide a conversation history to the chat model. With this context, the AI model can remember the context of the chat and improve the chat quality.
111+
- `PromptChatMemoryAdvisor` adds chat memory into the prompt and provide a conversation history to the chat model. With this context, the AI model can remember the context of the chat and improve the chat quality.
117112

118113
For more information, see [Advisors API](https://docs.spring.io/spring-ai/reference/api/advisors.html).
119114

120115
## Next steps
121116

122117
> [!div class="nextstepaction"]
123-
> [Deploy an AI-enabled instance of Spring PetClinic on Azure Container Apps](java-petclinic-ai-overview.md)
118+
> [Deploy an AI-enabled instance of Spring PetClinic on Azure Container Apps](java-petclinic-ai-overview.md).

0 commit comments

Comments
 (0)