liveBook · Manning

Assistant

As explained in Spring AI in Action

An assistant message is a message containing a response generated by a language model.

An assistant message contains a response generated by a language model. In a prompt, it represents the model’s contribution to the conversation and appears alongside user, system, and tool messages. section 3.3

Assistant messages serve two distinct purposes:

  • They carry natural-language answers when the model finishes with stop. section 6.1.2
  • They can request tool execution through tool_calls when the model needs application-provided help; content may then be null and finish_reason becomes tool_calls. section 6.1.2
  • They preserve the model’s earlier response when the application sends a follow-up request containing the tool result. section 6.1.2

Tool-driven assistant message

For a question about the current time in Jal, New Mexico, the assistant message requests getCurrentTime with the America/Denver time zone. After the tool result is added, a later assistant message provides the final time. section 6.1.2

Figure 6.1 Tool invocation involves a multipart conversation between the application and the LLM.
figure

Trace the multipart conversation linking the user question, assistant tool request, tool result, and final assistant answer. section 6.1.2

How Spring AI in Action covers it

How deep it goes
Defines the role and shows response and tool-call payloads, but defers broader conversation implementation to later treatment.
Examples
Uses a current-time question, a getCurrentTime tool request, a tool result, and a final time answer.
What it assumes
Assumes message roles and prompt submission, while distinguishing assistant messages from user, system, and tool messages.
What you can do after
Evaluate assistant payloads and follow tool_calls through the application’s multipart conversation.
How it connects
Connects assistant messages to user messages, system messages, tool messages, multiturn conversations, and tool calling.

Also explained in

Compare how 3 books explain assistant →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Spring AI in Action. The section links point to the parts of the book it draws on.