![]() |
LlamaLib
v2.0.2
Cross-platform library for local LLMs
|
Structure representing a single chat message. More...
#include <LLM_agent.h>
Public Member Functions | |
| ChatMessage ()=default | |
| Default constructor. | |
| ChatMessage (const std::string &role_, const std::string &content_) | |
| Parameterized constructor. | |
| json | to_json () const |
| Convert message to JSON representation. | |
| bool | operator== (const ChatMessage &other) const |
| Equality comparison operator. | |
Static Public Member Functions | |
| static ChatMessage | from_json (const json &j) |
| Create message from JSON representation. | |
Public Attributes | |
| std::string | role |
| Message role (e.g., "user", "assistant", "system") | |
| std::string | content |
| Message content text. | |
Structure representing a single chat message.
Encapsulates a conversation message with role and content, providing JSON serialization and comparison functionality
Definition at line 15 of file LLM_agent.h.
|
inline |
Parameterized constructor.
| role_ | Message role identifier |
| content_ | Message content text |
Definition at line 26 of file LLM_agent.h.
|
inlinestatic |
Create message from JSON representation.
| j | JSON object containing message data |
Deserializes a message from JSON format
| json::exception | if required fields are missing |
Definition at line 42 of file LLM_agent.h.
|
inline |
Equality comparison operator.
| other | Another ChatMessage to compare with |
Definition at line 50 of file LLM_agent.h.
|
inline |
Convert message to JSON representation.
Serializes the message for storage or transmission
Definition at line 32 of file LLM_agent.h.
| std::string ChatMessage::content |
Message content text.
Definition at line 18 of file LLM_agent.h.
| std::string ChatMessage::role |
Message role (e.g., "user", "assistant", "system")
Definition at line 17 of file LLM_agent.h.