Skip to content
Ameen Abozaid
Planned lessonJNR-056-L02

Spring AI concepts: ChatClient, prompts, advisors

  • Lesson 2 of 7
  • Junior
On This Lesson 4 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

call a model through Spring AI.

Planned topics

  • Spring AI is a Spring project that gives one API for several model providers.
  • ChatClient has a fluent API: prompt(), system(...), user(...), call().
  • A prompt template fills placeholders, so prompts are not built by string concatenation.
  • Advisors wrap calls to add behavior such as logging or memory; here we only name the idea.
  • The provider and model come from configuration and the starter you add, not from your code.
Draft outline details

Demonstration

java
String text = chatClient.prompt()
    .system("You write short product descriptions.")
    .user(u -> u.text("Describe: {name}, {features}").param("name", name).param("features", features))
    .call()
    .content();

Check your understanding

Where is the provider chosen?

Show answer

In configuration and dependencies, not in business code.

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.

Continue to next lesson

Type to search levels, phases, modules and lessons.