|
NeoGraph 0.10.0
A C++17 Graph Agent Engine Library — LangGraph for C++
|
Foundation types for NeoGraph: messages, tool calls, and LLM completions. More...
Go to the source code of this file.
Classes | |
| struct | neograph::ChatCompletion |
| LLM completion response including the message and token usage. More... | |
| struct | neograph::ChatMessage |
| A message in the conversation history. More... | |
| struct | neograph::ChatTool |
| Tool definition metadata sent to the LLM. More... | |
| struct | neograph::ToolCall |
| Represents a single tool invocation requested by the LLM. More... | |
| struct | neograph::ChatCompletion::Usage |
| Token usage statistics for the completion. More... | |
Functions | |
| void | neograph::from_json (const json &j, ChatMessage &msg) |
| Deserialize a ChatMessage from JSON. | |
| void | neograph::from_json (const json &j, ToolCall &tc) |
| Deserialize a ToolCall from JSON. | |
| json | neograph::messages_to_json (const std::vector< ChatMessage > &messages) |
| Convert a vector of ChatMessages to OpenAI-compatible JSON format. | |
| ChatMessage | neograph::parse_response_message (const json &choice) |
| Parse an OpenAI API response choice into a ChatMessage. | |
| void | neograph::to_json (json &j, const ChatMessage &msg) |
| Serialize a ChatMessage to JSON. | |
| void | neograph::to_json (json &j, const ToolCall &tc) |
| Serialize a ToolCall to JSON. | |
| json | neograph::tools_to_json (const std::vector< ChatTool > &tools) |
| Convert a vector of ChatTools to OpenAI-compatible JSON format. | |
Foundation types for NeoGraph: messages, tool calls, and LLM completions.
Defines the core data structures shared across all NeoGraph modules, including ChatMessage, ToolCall, ChatCompletion, and their JSON serialization helpers (ADL-based, nlohmann/json compatible).
Definition in file types.h.
|
inline |
Deserialize a ChatMessage from JSON.
| [in] | j | Source JSON object. |
| [out] | msg | Target ChatMessage. |
Definition at line 112 of file types.h.
References neograph::ChatMessage::content, neograph::ChatMessage::image_urls, neograph::ChatMessage::role, neograph::ChatMessage::tool_call_id, neograph::ChatMessage::tool_calls, and neograph::ChatMessage::tool_name.
|
inline |
Deserialize a ToolCall from JSON.
| [in] | j | Source JSON object. |
| [out] | tc | Target ToolCall. |
Definition at line 84 of file types.h.
References neograph::ToolCall::arguments, neograph::ToolCall::id, and neograph::ToolCall::name.
|
inline |
Convert a vector of ChatMessages to OpenAI-compatible JSON format.
Handles tool call messages, tool result messages, and multi-modal messages (text + images in OpenAI Vision format).
| messages | Vector of ChatMessage objects to convert. |
Definition at line 140 of file types.h.
References neograph::messages_to_json().
Referenced by neograph::messages_to_json().
|
inline |
Parse an OpenAI API response choice into a ChatMessage.
Extracts the message content, role, and any tool calls from the choices[n] object of an OpenAI completion response.
| choice | A single choice object from the OpenAI response (must contain "message"). |
| json::exception | If required fields are missing. |
Definition at line 210 of file types.h.
References neograph::ToolCall::arguments, neograph::ChatMessage::content, neograph::ToolCall::id, neograph::ToolCall::name, neograph::parse_response_message(), neograph::ChatMessage::role, and neograph::ChatMessage::tool_calls.
Referenced by neograph::parse_response_message().
|
inline |
Serialize a ChatMessage to JSON.
| [out] | j | Target JSON object. |
| [in] | msg | ChatMessage to serialize. |
Definition at line 93 of file types.h.
References neograph::ChatMessage::content, neograph::ChatMessage::image_urls, neograph::ChatMessage::role, neograph::ChatMessage::tool_call_id, neograph::ChatMessage::tool_calls, and neograph::ChatMessage::tool_name.
|
inline |
Serialize a ToolCall to JSON.
| [out] | j | Target JSON object. |
| [in] | tc | ToolCall to serialize. |
Definition at line 77 of file types.h.
References neograph::ToolCall::arguments, neograph::ToolCall::id, and neograph::ToolCall::name.
|
inline |
Convert a vector of ChatTools to OpenAI-compatible JSON format.
| tools | Vector of ChatTool objects to convert. |
Definition at line 185 of file types.h.
References neograph::tools_to_json().
Referenced by neograph::tools_to_json().