Entropic 2.14.3
Local-first agentic inference engine
Loading...
Searching...
No Matches
response_generator.cpp File Reference

Response generation implementation. More...

#include <entropic/core/response_generator.h>
#include "prompt_log_util.h"
#include <entropic/mcp/utf8_sanitize.h>
#include <entropic/types/error.h>
#include <entropic/types/logging.h>
#include <entropic/types/run_scope.h>
#include <nlohmann/json.hpp>
#include <atomic>
#include <chrono>
#include <cstring>
#include <functional>
#include <thread>
#include <unordered_map>
Include dependency graph for response_generator.cpp:

Go to the source code of this file.

Classes

struct  entropic::StreamAccumulator
 Context passed to the streaming token callback. More...
 

Namespaces

namespace  entropic
 Activate model on GPU (WARM → ACTIVE).
 

Functions

static bool entropic::generation_cancelled (const GenerationEvents &events)
 Whether the generation in progress must stop (gh#158).
 
static void entropic::log_system_message (size_t i, const Message &msg, const std::string &tier)
 Log the system message, in full only when it has changed.
 
static void entropic::log_other_message (size_t i, const Message &msg, entropic::PromptLogDedup &dedup)
 Log one non-system message, in full the first time only.
 
static void entropic::log_prompt (const std::vector< Message > &messages, const std::string &tier)
 Log the assembled prompt, each distinct body in full exactly once.
 
static void entropic::stream_token_callback (const char *token, size_t len, void *user_data)
 Token callback for streaming generation.
 
static std::string entropic::resolve_stream_finish_reason (int rc, size_t content_size)
 Resolve a stream's finish_reason from rc + content size.
 
static bool entropic::flag_raised (const std::atomic< bool > *flag)
 Whether a nullable stop flag is set (gh#158).
 
static bool entropic::apply_terminal_batch_rc (int rc, const char *result_json, GenerateResult &result)
 Map a TERMINAL batch return code onto the result, if it is one.
 
static void entropic::json_escape_into (const std::string &s, std::string &out)
 Serialize messages to JSON for inference interface.
 
static void entropic::serialize_content_parts (const std::vector< ContentPart > &parts, std::string &out)
 Serialize a single multimodal content_parts array (gh#37, v2.1.8).
 

Variables

static auto logger = entropic::log::get("core.response_generator")
 
static std::unordered_map< std::string, size_t > entropic::s_tier_system_hash
 Per-tier system prompt hash for diff detection across delegations.
 
static std::unordered_map< std::string, entropic::PromptLogDedup > entropic::s_tier_prompt_dedup
 gh#152: bodies already shown in this tier's prompt log.
 

Detailed Description

Response generation implementation.

Version
1.8.4

Definition in file response_generator.cpp.

Variable Documentation

◆ logger

auto logger = entropic::log::get("core.response_generator")
static

Definition at line 25 of file response_generator.cpp.