NeuralPlus 0.2.0
An open-source, provider-independent C++17 AI SDK and LLM client library
Loading...
Searching...
No Matches
neuralplus::Message Class Referencefinal

A valid conversation message with one normalized role. More...

#include <types.hpp>

Public Types

using Contents = std::vector< Content >
 Ordered content-part collection used by multimodal messages.
 

Public Member Functions

Role role () const noexcept
 Returns the normalized role of this message.
 
const Contents & contents () const noexcept
 Returns the ordered multimodal content parts.
 
const std::vector< ToolCall > & tool_calls () const noexcept
 Returns tool calls requested by an assistant message.
 
const std::string & tool_call_id () const noexcept
 Returns the correlated call ID for a tool-result message.
 
const std::string & tool_name () const noexcept
 Returns the invoked tool name for a tool-result message.
 
bool is_tool_error () const noexcept
 Returns whether a tool-result message represents a failure.
 
std::string text () const
 Concatenates text parts without discarding non-text parts from the message.
 
const JsonValue & provider_metadata () const noexcept
 Returns opaque data needed to replay provider-native continuation state.
 
Message & set_provider_metadata (JsonValue metadata)
 Attaches provider-native continuation data and returns this message.
 

Static Public Member Functions

static Message system (std::string text)
 Creates a system message. Sessions normally use Session::set_system.
 
static Message user (std::string text)
 Creates a text user message.
 
static Message user (Contents contents)
 Creates a multimodal user message.
 
static Message assistant (std::string text, std::vector< ToolCall > tool_calls={})
 Creates a text assistant message, optionally containing tool calls.
 
static Message assistant (Contents contents, std::vector< ToolCall > tool_calls={})
 Creates a multimodal assistant message.
 
static Message tool (std::string call_id, std::string tool_name, Contents contents, bool is_error=false)
 Creates a tool result message.
 
static Message tool_json (std::string call_id, std::string tool_name, JsonValue value, bool is_error=false)
 Creates a JSON tool result serialized as one text content part.
 

Detailed Description

A valid conversation message with one normalized role.

Examples
simple_session.cpp.

The documentation for this class was generated from the following file: