Safety Request Processing#

class SafetyRequestProcessing#

Family-specific artifact parsing, chat formatting, and request shaping selected by the model recipe.

Subclassed by trt_edgellm::safety::InternVL3RequestProcessing

Public Functions

virtual ~SafetyRequestProcessing() = default#
virtual SafetyStatus configure(
SafetyRuntimeArtifactBundle const &artifacts,
nlohmann::json const &llmConfig,
nlohmann::json const &visualConfig
) noexcept = 0#

Load tokenizer/template/embedding configuration and validate artifact compatibility before allocation.

virtual ProcessingConfiguration const &configuration(
) const noexcept = 0#
virtual ProcessingCapabilitySet capabilities() noexcept = 0#
virtual SafetyStatus prepareRequest(
LLMGenerationRequest const &request,
ProcessingRequest &prepared
) noexcept = 0#

Validate all requested features before SDK work; write into prepared, bounded input storage. The returned views remain valid until the next request.

virtual SafetyStatus validateResponse(
LLMGenerationRequest const &request,
LLMGenerationResponse const &response
) const noexcept = 0#

Validate caller-owned output capacities before any request execution.

virtual SafetyStatus formatResponse(
ModelInferenceResult const &result,
LLMGenerationResponse &response
) noexcept = 0#

Decode text into caller-prepared storage without allocation. Called only after successful generation.

std::unique_ptr<SafetyRequestProcessing> trt_edgellm::safety::createSafetyRequestProcessing(
ModelInferenceDefinition const &definition
)#

Internal Initialization factory for the family adapter and recipe-selected capabilities. Returns nullptr when the selected implementations are unavailable; allocation failures may throw.