Skip to content

Commit 57cb27c

Browse files
authored
Merge pull request #68 from glroland/main
Fixes and Improvements to Prompt Module
2 parents f1a3956 + 2ce468c commit 57cb27c

File tree

4 files changed

+23
-16
lines changed

4 files changed

+23
-16
lines changed
296 KB
Loading
Binary file not shown.
-91.2 KB
Loading

content/modules/ROOT/pages/module-prompt.adoc

Lines changed: 23 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -391,19 +391,6 @@ If you run into challenges while drafting the prompt, ask your instructor for as
391391

392392
=== Test emails to speed up prompt development
393393

394-
[IMPORTANT]
395-
====
396-
If you haven't created *a new Gen AI email service* in the previous module yet, create the new email service by running the following magic bash script in VS Code terminal. If you're still running the Quarkus dev mode, open a new terminal window to run the script.
397-
398-
[.console-input]
399-
[source,shell,subs="+attributes,macros+"]
400-
----
401-
sh ${PROJECT_SOURCE}/scripts/create-email-ai-service.sh
402-
----
403-
404-
Access the https://parasol-app-{user}-dev-parasol-app-{user}-dev.{openshift_cluster_ingress_domain}[Parasol web page^],to verify the Gen AI email service. To access the email service, click on the `Email Generate` tab on the left and use it in the following sections:
405-
====
406-
407394
==== Generate an email for `new claim #1` to the [email protected]
408395

409396
[.console-input]
@@ -536,6 +523,19 @@ image::prompt/output_example_existing_2.png[output_example_existing_2]
536523

537524
Now that you've developed a working prompt that can help satisfy leadership objectives with its first Generative AI initiative, you need to incorporate this logic into the Parasol Insurance application so that ongoing business value may be realized. For this exercise that involves updating the Email Response REST service and UI to provide an recommended recipient, email subject, and automated response based on a given customer email.
538525

526+
[IMPORTANT]
527+
====
528+
If you haven't created *a new Gen AI email service* in the previous module yet, create the new email service by running the following magic bash script in VS Code terminal. If you're still running the Quarkus dev mode, open a new terminal window to run the script.
529+
530+
[.console-input]
531+
[source,shell,subs="+attributes,macros+"]
532+
----
533+
sh ${PROJECT_SOURCE}/scripts/create-email-ai-service.sh
534+
----
535+
536+
Access the https://parasol-app-{user}-dev-parasol-app-{user}-dev.{openshift_cluster_ingress_domain}[Parasol web page^],to verify the Gen AI email service. To access the email service, click on the `Email Generate` tab on the left and use it in the following sections:
537+
====
538+
539539
=== Integrate Prompt with the Parasol Insurance Application
540540

541541
Now that we've developed a robust prompt that helps address the Parasol Insurance use case for email handling, we must integrate that prompt into the Parasol application.
@@ -666,16 +666,23 @@ Add the following html to the `email-response` div block:
666666
</div>
667667
----
668668

669-
image::prompt/email_response_addresse.png[email_response_addresse]
669+
image::prompt/email_response_address.png[email_response_address]
670670

671671
Additionally, we must add the address field to the REST Service's JSON Response.
672672

673-
Open the `src/main/java/org/parasol/model/EmailResponse.java` file to `replace` the constructor with the following code.
673+
Open the `src/main/java/org/parasol/model/EmailResponse.java` file and `replace` the Java record signature with the following code.
674+
675+
[IMPORTANT]
676+
====
677+
The new field you are adding for email address must be first in the EmailResponse method signature.
678+
679+
LangChain4j uses this to suggest JSON response syntax to the LLM and our examples in the system prompt have the email address first in the response. If the examples do not match LangChain4j's suggestion, the effect is that email address is sometimes left off the response and will be blank in the UI.
680+
====
674681

675682
[.console-input]
676683
[source,java,subs="+attributes,macros+"]
677684
----
678-
public record EmailResponse(String subject, String message, String address) { }
685+
public record EmailResponse(String address, String subject, String message) { }
679686
----
680687

681688
image::prompt/new-field-added-to-email-response.png[Add "address" field to EmailResponse Record]

0 commit comments

Comments
 (0)