Spring AI concepts: ChatClient, prompts, advisors
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.
ChatClienthas 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
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.
Marking a lesson complete is optional and you can undo it any time. Your progress stays in this browser.