You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
var deployment =newDeploymentApi().create(RESOURCE_GROUP, deploymentCreationRequest);
587
586
588
587
// Print the deployment response message
589
588
System.out.println(deployment.getMessage());
@@ -1072,6 +1071,153 @@ Data masking and content filtering are available to enhance data privacy and saf
1072
1071
1073
1072
[OPTION END]
1074
1073
1074
+
[OPTION BEGIN [SAP Cloud SDK for Java]]
1075
+
1076
+
In this step, we will consume an LLM through the orchestration service with the created deployment, using the core and orchestration module of the SAP Cloud SDK for Java.
1077
+
1078
+
To begin the consumption process for the orchestration you’ve deployed, follow the steps below:
1079
+
1080
+
**Prepare the CV File**
1081
+
1082
+
• Download the [cv.txt](img/cv.txt) file, which contains the CV used this tutorial. Add it to your project.
1083
+
1084
+
• Read the CV file from the correct path using the following code:
1085
+
1086
+
```java
1087
+
// Adapt filepath to the location you stored the file
The next step involves creating the prompt for the LLM including both `SystemMessage` and `UserMessage` components.
1103
+
1104
+
• `SystemMessage`: Defines the AI assistant's role and instructions.
1105
+
1106
+
• `UserMessage`: Represents the user's input (i.e., the CV content) to be processed by the LLM.
1107
+
1108
+
```java
1109
+
// Define system and user messages for prompt
1110
+
var systemMessage =newSystemMessage(
1111
+
"""
1112
+
You are an AI assistant designed to screen resumes for HR purposes.
1113
+
Please assess the candidate qualifications based on the provided resume.
1114
+
"""
1115
+
);
1116
+
var userMessage =newUserMessage("Candidate Resume: \n"+ cvContent);
1117
+
1118
+
// Define the prompt for resume screening
1119
+
var prompt =newOrchestrationPrompt(systemMessage, userMessage);
1120
+
1121
+
```
1122
+
1123
+
We can define multiple models for the use case. Only use those models that are already deployed in your instances. For this example, we have selected the following three models:
1124
+
1125
+
```java
1126
+
// List of models to iterate through
1127
+
var models =List.of("gpt-4o", "mistralai--mistral-large-instruct", "anthropic--claude-3.5-sonnet");
1128
+
```
1129
+
1130
+
With the following function we create an `OrchestrationModuleConfig` containing information about the `LLMModule`. This can be extended to contain information regarding templating, masking, filtering and grounding, if desired to use these functionality of orchestration.
1131
+
1132
+
```java
1133
+
// Function to create orchestration module configuration
This step outlines the process of generating responses for a set of queries using different models. We iterate through the list of models created earlier and query the model with the created prompt using an `OrchestrationClient`.
1169
+
1170
+
```java
1171
+
// Create the client used for interaction with orchestration service
1172
+
var client =newOrchestrationClient(newAiCoreService()
Ensure at least one orchestration deployment is ready to be consumed during this process.
1214
+
1215
+
**Optional Advanced Modules**
1216
+
1217
+
Together with document grounding and templating, data masking and content filtering are available to enhance data privacy and safety. Data masking hides sensitive information like phone numbers or organization names, while content filtering can screen for categories such as hate self-harm, sexual content, and violence. In this tutorial, the response generated by the LLM models may carry sensitive information, such as names and phone numbers. For further enhancement, refer to the next tutorial on implementing these modules.
1218
+
1219
+
[OPTION END]
1220
+
1075
1221
[OPTION BEGIN [Bruno]]
1076
1222
- Go to the 08_consume_model section in the collection.
0 commit comments