Entropic 2.9.4
Local-first agentic inference engine
Loading...
Searching...
No Matches
sampler.h File Reference

Abstract Sampler seam for backend testability (v2.3.10). More...

#include <entropic/types/config.h>
#include <cstdint>
#include <memory>
Include dependency graph for sampler.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  entropic::Sampler
 Pure-virtual per-generation sampler used by the decode loop. More...
 
class  entropic::SamplerFactory
 Factory that materializes a Sampler from GenerationParams. More...
 

Namespaces

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

Detailed Description

Abstract Sampler seam for backend testability (v2.3.10).

Pre-v2.3.10 LlamaCppBackend built its llama_sampler_chain inline from GenerationParams and invoked llama_sampler_sample directly in the decode loop. Every line of chain construction was therefore unreachable under the CPU-only unit-test coverage gate (no real model, no real context). This abstract seam relocates chain construction behind a SamplerFactory and relocates per-token sampling behind a Sampler — both mockable. The production backend wires LlamaCppSamplerFactory (which builds the real llama.cpp chain); unit tests inject a mock factory + mock sampler and assert behavior without a loaded model.

Pairs structurally with the v2.3.10 Tokenizer seam (see tokenizer.h).

Version
2.3.10

Definition in file sampler.h.