systemprompt-template-provider 0.2.1

Template provider traits for systemprompt.io AI governance infrastructure. Config-as-code foundation for the AI governance template registry.
Documentation

systemprompt-template-provider

Template provider traits and abstractions for systemprompt.io.

Crates.io Documentation License: BUSL-1.1

Overview

Provides template loading abstractions and dynamic type aliases for template-related providers. Includes an embedded loader for compile-time templates and a filesystem loader for runtime template discovery. Re-exports provider contracts for template, component, and page data handling.

Part of the Shared layer in the systemprompt.io architecture. Integrations · Extensible Architecture

Installation

Add to your Cargo.toml:

[dependencies]
systemprompt-template-provider = "0.0.1"

Feature Flags

Feature Default Description
tokio No Enables FileSystemLoader for async file-based template loading

Quick Example

use systemprompt_template_provider::{
    TemplateLoader, TemplateLoaderResult, EmbeddedLoader,
    DynTemplateProvider, DynTemplateLoader,
};
use async_trait::async_trait;

let loader: DynTemplateLoader = std::sync::Arc::new(EmbeddedLoader::new());

Core Types

Type Description
TemplateLoader Trait for loading templates by name
EmbeddedLoader Loader for compile-time embedded templates
FileSystemLoader Async filesystem template loader (requires tokio feature)
DynTemplateProvider Arc<dyn TemplateProvider> type alias
DynTemplateLoader Arc<dyn TemplateLoader> type alias
DynComponentRenderer Arc<dyn ComponentRenderer> type alias

Dependencies

Internal

Crate Purpose
systemprompt-provider-contracts Provider trait definitions

External

Crate Purpose
async-trait Async trait support
tokio Async filesystem operations (optional)

Usage

use std::sync::Arc;
use systemprompt_template_provider::{DynTemplateProvider, TemplateProvider};

fn register(provider: Arc<dyn TemplateProvider>) -> DynTemplateProvider {
    // Hand the provider to the runtime as a type-erased Arc.
    provider
}

License

Business Source License 1.1 - See LICENSE for details.