org.llm4s.llmconnect.model.AssistantMessage
See theAssistantMessage companion object
case class AssistantMessage(contentOpt: Option[String], toolCalls: Seq[ToolCall]) extends Message
A response from the LLM, optionally containing text, tool-call requests, or both.
content always returns a non-null String; it returns "" when the LLM response contains only tool calls and no accompanying text (contentOpt is None). Code that displays assistant output should check for an empty string rather than null-guarding.
A well-formed AssistantMessage must satisfy at least one of:
contentOpt.exists(_.trim.nonEmpty)— the LLM produced text.toolCalls.nonEmpty— the LLM requested one or more tool invocations.
Value parameters
- contentOpt
-
Text portion of the response;
Nonewhen the model produced only tool calls. - toolCalls
-
Tool invocations requested by the model; each carries an
idthat must be matched by a subsequent ToolMessage.
Attributes
- Companion
- object
- Graph
-
- Supertypes
Members list
In this article