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
1. From the *src/main/java/com/example/aicompletiondemo* folder, open *AiCompletionApplication.java* in your preferred editor or IDE and paste in the following code:
System.out.println(String.format("Prompt created %d generated response(s).", resps.getGenerations().size()));
171
+
172
+
resps.getGenerations().stream()
173
+
.forEach(gen -> {
174
+
finalvar role = gen.getInfo().getOrDefault(ROLE_INFO_KEY, MessageType.ASSISTANT.getValue());
175
+
176
+
System.out.println(String.format("Generated respose from \"%s\": %s", role, gen.getText()));
177
+
});
178
+
}
179
+
180
+
}
179
181
```
180
182
181
183
> [!IMPORTANT]
@@ -190,20 +192,20 @@ The generated files and folders resemble the following structure:
190
192
## Output
191
193
192
194
```output
193
-
. ____ _ __ _ _
194
-
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
195
+
. ____ _ __ _ _
196
+
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
195
197
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
196
-
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
197
-
' |____| .__|_| |_|_| |_\__, | / / / /
198
-
=========|_|==============|___/=/_/_/_/
198
+
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
199
+
' |____| .__|_| |_|_| |_\__, | / / / /
200
+
=========|_|==============|___/=/_/_/_/
201
+
:: Spring Boot :: (v3.1.5)
199
202
200
-
:: Spring Boot :: (v3.3.4)
203
+
2023-11-07T12:47:46.126-06:00 INFO 98687 --- [ main] c.e.a.AiCompletionApplication : No active profile set, falling back to 1 default profile: "default"
204
+
2023-11-07T12:47:46.823-06:00 INFO 98687 --- [ main] c.e.a.AiCompletionApplication : Started AiCompletionApplication in 0.925 seconds (process running for 1.238)
205
+
Sending completion prompt to AI service. One moment please...
201
206
202
-
2025-01-09T13:51:48.426-05:00 INFO 8264 --- [AICompletion] [ main] c.e.a.AiCompletionApplication : Starting AiCompletionApplication using Java 17.0.12 with PID 8264 (/Users/vega/dev/msft/spring-ai-samples/ai-completion-demo/target/classes started by vega in /Users/vega/dev/msft/spring-ai-samples/ai-completion-demo)
203
-
2025-01-09T13:51:48.427-05:00 INFO 8264 --- [AICompletion] [ main] c.e.a.AiCompletionApplication : No active profile set, falling back to 1 default profile: "default"
204
-
2025-01-09T13:51:48.781-05:00 INFO 8264 --- [AICompletion] [ main] c.e.a.AiCompletionApplication : Started AiCompletionApplication in 0.465 seconds (process running for 0.624)
205
-
2025-01-09T13:51:48.782-05:00 INFO 8264 --- [AICompletion] [ main] c.e.a.AiCompletionApplication : Sending completion prompt to AI service. One moment please...
206
-
2025-01-09T13:51:50.447-05:00 INFO 8264 --- [AICompletion] [ main] c.e.a.AiCompletionApplication : Response: Microsoft was founded on April 4, 1975, by Bill Gates and Paul Allen.
207
+
Prompt created 1 generated response(s).
208
+
Generated respose from "assistant": Microsoft was founded on April 4, 1975.
0 commit comments