Package net.thevpc.naru.api.model
Class NaruMessage
java.lang.Object
net.thevpc.naru.api.model.NaruMessage
- All Implemented Interfaces:
Cloneable,NToElement,NCopiable
A single message in a chat conversation.
Roles: "system", "user", "assistant", "tool"
-
Constructor Summary
ConstructorsConstructorDescriptionNaruMessage(String sourceName, NaruSource source, NaruRole role, String content, List<String> images, String toolCallId, String toolName, List<NaruToolCall> toolCalls) NaruMessage(NElement element) -
Method Summary
Modifier and TypeMethodDescriptionaddThinkingSegment(NaruThinkingSegment segment) Appends one reasoning segment, assigning it the next position.static NaruMessagestatic NaruMessageassistantWithToolCalls(String content, List<NaruToolCall> calls) protected NaruMessageclone()copy()getRole()All reasoning as one string, regardless of how it was stored.Structured reasoning, or null when the model did not think.booleanWhether this message carries any reasoning at all, in either form.booleanbooleanstatic NaruMessagevoidsetContent(String content) voidvoidsetSource(NaruSource source) setSourceName(String sourceName) setThinking(String thinking) setThinkingSegments(List<NaruThinkingSegment> thinkingSegments) voidsetToolCallId(String toolCallId) voidsetToolCalls(List<NaruToolCall> toolCalls) voidsetToolName(String toolName) setTurnBoundary(boolean turnBoundary) static NaruMessagestatic NaruMessagetoString()static NaruMessagestatic NaruMessagestatic NaruMessageuserWithImages(String content, List<String> base64Images) withContent(String content)
-
Constructor Details
-
NaruMessage
public NaruMessage() -
NaruMessage
public NaruMessage(String sourceName, NaruSource source, NaruRole role, String content, List<String> images, String toolCallId, String toolName, List<NaruToolCall> toolCalls) -
NaruMessage
-
-
Method Details
-
withContent
-
getSourceName
-
setSourceName
-
getSource
-
setSource
-
copy
-
clone
-
of
-
toElement
- Specified by:
toElementin interfaceNToElement
-
system
-
user
-
user
-
userWithImages
-
assistant
-
assistantWithToolCalls
-
tool
-
getRole
-
setRole
-
getContent
-
setContent
-
getImages
-
setImages
-
getToolCallId
-
setToolCallId
-
getToolName
-
setToolName
-
getToolCalls
-
setToolCalls
-
getThinking
All reasoning as one string, regardless of how it was stored.Derives from
getThinkingSegments()when segments are present, so callers written against the original single-string field keep working against messages produced by the structured path. Returns null when there was no reasoning at all, which callers already treat as "did not think". -
getThinkingSegments
Structured reasoning, or null when the model did not think. -
hasThinking
public boolean hasThinking()Whether this message carries any reasoning at all, in either form. -
setThinkingSegments
-
addThinkingSegment
Appends one reasoning segment, assigning it the next position. -
isTurnBoundary
public boolean isTurnBoundary() -
setTurnBoundary
-
setThinking
-
hasToolCalls
public boolean hasToolCalls() -
toString
-