Entropic 2.14.3
Local-first agentic inference engine
Loading...
Searching...
No Matches
entropic::GenerationResult Struct Reference

Result of a single generation call. More...

#include <entropic/types/generation_result.h>

Collaboration diagram for entropic::GenerationResult:

Public Member Functions

bool ok () const
 True if generation completed without error.
 

Public Attributes

std::string content
 Generated text (cleaned by adapter)
 
std::string raw_content
 Raw model output before adapter processing.
 
std::vector< ToolCall > tool_calls
 Tool calls parsed from content.
 
std::string finish_reason = "stop"
 Finish reason: "stop", "length", "error".
 
int token_count = 0
 Generated token count.
 
double generation_time_ms = 0.0
 Wall-clock generation time.
 
int prefill_tokens = 0
 Prompt tokens actually pushed through llama_decode during this run's prefill (gh#144, v2.12.0).
 
double routing_ms = 0.0
 Router classification time.
 
double swap_ms = 0.0
 Model swap time.
 
double total_ms = 0.0
 Total end-to-end time.
 
double throughput_tok_s = 0.0
 Measured throughput for this generation (tok/s).
 
bool time_limited = false
 true if generation was terminated by time limit rather than EOS/stop sequence/max_tokens.
 
int original_max_tokens = 0
 Original max_tokens before auto-adaptation reduced it.
 
int seq_id = 0
 Sequence identifier for multi-sequence backends.
 
int n_drafted = 0
 Tokens proposed by the draft/MTP head across all rounds.
 
int n_accepted = 0
 Draft tokens the target accepted (≤ n_drafted).
 
GrammarProvenance grammar
 What constrained this decode and who asked for it.
 
entropic_error_t error_code = ENTROPIC_OK
 Error code (ENTROPIC_OK if no error)
 
std::string error_message
 Error description (empty if no error)
 

Detailed Description

Result of a single generation call.

Maps to Python GenerationResult dataclass.

Version
1.8.2

Definition at line 64 of file generation_result.h.

Member Function Documentation

◆ ok()

bool entropic::GenerationResult::ok ( ) const
inline

True if generation completed without error.

Returns
true when error_code == ENTROPIC_OK. @utility
Version
1.8.2

Definition at line 143 of file generation_result.h.

Member Data Documentation

◆ content

std::string entropic::GenerationResult::content

Generated text (cleaned by adapter)

Definition at line 65 of file generation_result.h.

◆ error_code

entropic_error_t entropic::GenerationResult::error_code = ENTROPIC_OK

Error code (ENTROPIC_OK if no error)

Definition at line 134 of file generation_result.h.

◆ error_message

std::string entropic::GenerationResult::error_message

Error description (empty if no error)

Definition at line 135 of file generation_result.h.

◆ finish_reason

std::string entropic::GenerationResult::finish_reason = "stop"

Finish reason: "stop", "length", "error".

Definition at line 68 of file generation_result.h.

◆ generation_time_ms

double entropic::GenerationResult::generation_time_ms = 0.0

Wall-clock generation time.

Definition at line 70 of file generation_result.h.

◆ grammar

GrammarProvenance entropic::GenerationResult::grammar

What constrained this decode and who asked for it.

Populated by the orchestrator from the SAME inputs the sampler's application site uses, so the record cannot disagree with what ran.

Version
2.13.0

Definition at line 131 of file generation_result.h.

◆ n_accepted

int entropic::GenerationResult::n_accepted = 0

Draft tokens the target accepted (≤ n_drafted).

>0 proves the head's drafts are lossless-verified hits, not just proposed.

Version
2.9.0

Definition at line 123 of file generation_result.h.

◆ n_drafted

int entropic::GenerationResult::n_drafted = 0

Tokens proposed by the draft/MTP head across all rounds.

0 when no speculative kernel ran (plain decode). The instrumentation signal that MTP/speculative actually engaged vs silently fell back.

Version
2.9.0

Definition at line 118 of file generation_result.h.

◆ original_max_tokens

int entropic::GenerationResult::original_max_tokens = 0

Original max_tokens before auto-adaptation reduced it.

0 if no adaptation occurred.

Version
1.9.7

Definition at line 102 of file generation_result.h.

◆ prefill_tokens

int entropic::GenerationResult::prefill_tokens = 0

Prompt tokens actually pushed through llama_decode during this run's prefill (gh#144, v2.12.0).

The instrumentation every prefill-reuse claim rests on. A correctness test passes via full-reprefill fallback even when reuse is completely dead, so "the answer was right" says nothing about whether a prefix was reused — this does. Zero when the path does not report it.

Version
2.12.0

Definition at line 80 of file generation_result.h.

◆ raw_content

std::string entropic::GenerationResult::raw_content

Raw model output before adapter processing.

Definition at line 66 of file generation_result.h.

◆ routing_ms

double entropic::GenerationResult::routing_ms = 0.0

Router classification time.

Definition at line 83 of file generation_result.h.

◆ seq_id

int entropic::GenerationResult::seq_id = 0

Sequence identifier for multi-sequence backends.

0 for single-sequence backends (default). Set by generate_seq() to track which sequence produced this result.

Version
1.9.13

Definition at line 110 of file generation_result.h.

◆ swap_ms

double entropic::GenerationResult::swap_ms = 0.0

Model swap time.

Definition at line 84 of file generation_result.h.

◆ throughput_tok_s

double entropic::GenerationResult::throughput_tok_s = 0.0

Measured throughput for this generation (tok/s).

Computed from token_count / generation_time_ms. 0.0 if either is 0.

Version
1.9.7

Definition at line 92 of file generation_result.h.

◆ time_limited

bool entropic::GenerationResult::time_limited = false

true if generation was terminated by time limit rather than EOS/stop sequence/max_tokens.

Version
1.9.7

Definition at line 97 of file generation_result.h.

◆ token_count

int entropic::GenerationResult::token_count = 0

Generated token count.

Definition at line 69 of file generation_result.h.

◆ tool_calls

std::vector<ToolCall> entropic::GenerationResult::tool_calls

Tool calls parsed from content.

Definition at line 67 of file generation_result.h.

◆ total_ms

double entropic::GenerationResult::total_ms = 0.0

Total end-to-end time.

Definition at line 85 of file generation_result.h.


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