Skip to content
Ameen Abozaid
Planned lessonJNR-056-L07

Demo: an AI product-description helper for Shop API

  • Lesson 7 of 7
  • Junior
On This Lesson 3 topics

This lesson is planned. The outline below lists the topics it will cover. The full lesson has not been published yet.

In this lesson

build the helper end to end. Prepares JNR-056-LAB1.

Draft outline details

Step by step

  1. Define ProductDescriptionAssistant and the Description record with validation annotations.
  2. Add the Spring AI starter and set provider and model in configuration; the key comes from an environment variable.
  3. Implement it with ChatClient, .entity(Description.class), a timeout, and a max-token limit.
  4. Planned mistake: the first version asks for plain text and splits it by newline; the model adds extra lines and parsing breaks. Fix: request structured output and validate it.
  5. Add POST /products/{id}/description-suggestion that returns the record, or a Problem Details error for invalid output.
  6. Write controller and service tests with the fake; confirm they pass offline.

Practice

Apply this lesson with the module's lab, exercises and quiz.

Lab and exercises Quiz

Marking a lesson complete is optional and you can undo it any time. Your progress stays in this browser.

Type to search levels, phases, modules and lessons.