ToolMessage

org.llm4s.llmconnect.model.ToolMessage
See theToolMessage companion object
final case class ToolMessage(content: String, toolCallId: String) extends Message

Represents a message from a tool, typically containing the result of a tool call.

Value parameters

content

Content of the tool message, usually the result of the tool execution, e.g. a json response.

toolCallId

Unique identifier for the tool call (as provided by the ToolCall).

Attributes

Companion
object
Graph
Supertypes
trait Serializable
trait Product
trait Equals
trait Message
class Object
trait Matchable
class Any
Show all

Members list

Value members

Concrete methods

def findToolCallName(contextMessages: Seq[Message]): String

Resolves the tool name for this response by scanning contextMessages for the ToolCall whose id matches toolCallId.

Resolves the tool name for this response by scanning contextMessages for the ToolCall whose id matches toolCallId.

Returns "unknown-tool" when no matching tool call is found, which can happen if contextMessages does not include the assistant message that issued the request (e.g. after context pruning).

Value parameters

contextMessages

The conversation history to search; all AssistantMessage entries are scanned.

Attributes

override def validate: Result[Message]

Validates that this message satisfies its role-specific content constraints.

Validates that this message satisfies its role-specific content constraints.

Returns Left(ValidationError) when content is blank; AssistantMessage additionally requires at least one of content or toolCalls to be present.

Attributes

Definition Classes

Inherited methods

def productElementNames: Iterator[String]

Attributes

Inherited from:
Product
def productIterator: Iterator[Any]

Attributes

Inherited from:
Product
override def toString: String

Returns a string representation of the object.

Returns a string representation of the object.

The default representation is platform dependent.

Attributes

Returns

a string representation of the object.

Definition Classes
Message -> Any
Inherited from:
Message

Concrete fields