NeuralPlus 0.2.0
A small C++17 SDK for AI clients, sessions, tools, and tracing
Loading...
Searching...
No Matches
neuralplus::Session Class Referencefinal

#include <session.hpp>

Public Types

using Messages = std::vector< Message >
 Ordered collection used for conversation snapshots.
 

Public Member Functions

 Session (SessionOptions options={})
 Creates or restores a session from options.
 
const std::string & id () const noexcept
 Returns the stable session identifier.
 
void set_system (std::string message)
 
std::optional< std::string > system () const
 Returns a thread-safe copy of the system instruction.
 
void append (Message message)
 Appends restored or application-managed history outside a generation.
 
Messages messages () const
 Returns a thread-safe snapshot of conversation messages.
 
void clear_messages ()
 Clears conversation messages while retaining the system instruction and cache.
 
SessionStatestate () noexcept
 Returns the session-scoped generic cache.
 
const SessionStatestate () const noexcept
 Returns the read-only session-scoped generic cache.
 

Friends

class AIClient
 

Detailed Description

Thread-safe conversation history and tool cache.

Exactly one AIClient generation may own a Session at a time. Concurrent attempts fail immediately with SessionInUseError.

Examples
anthropic_chatbot.cpp, gemini_chatbot.cpp, openai_chatbot.cpp, openai_compatible_chatbot.cpp, and simple_session.cpp.

Member Function Documentation

◆ set_system()

void neuralplus::Session::set_system ( std::string  message)

Sets the provider-independent system instruction.

It may be changed while the current conversation history is empty.


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