Skip to main content

Crate systemprompt_ai

Crate systemprompt_ai 

Source
Expand description

§systemprompt-ai

Provider-agnostic LLM integration for systemprompt.io.

systemprompt-ai is a domain layer crate that unifies Anthropic, OpenAI, Gemini, and image-generation providers behind a single governed pipeline with cost tracking, audit-trail persistence, and structured-output validation.

It exposes:

§Error model

All public service signatures return error::Result<T> (an alias for Result<T, AiError>). AiError composes:

The provider-trait surface (AiProvider) used over the wire bridges to the boxed ProviderResult in services::core::ai_service.

§Feature flags

This crate has no Cargo features — all functionality is always compiled. [package.metadata.docs.rs] sets all-features = true for parity with sibling crates that do.

Re-exports§

pub use services::core::AiService;
pub use services::core::ImageService;
pub use services::gateway::Finding;
pub use services::gateway::GATEWAY_POLICIES_FILE;
pub use services::gateway::GatewayPolicyConfig;
pub use services::gateway::GatewayPolicyEntry;
pub use services::gateway::GatewayPolicyIngestionService;
pub use services::gateway::GatewayPolicySpec;
pub use services::gateway::HeuristicScanner;
pub use services::gateway::IngestOptions as GatewayPolicyIngestOptions;
pub use services::gateway::IngestReport as GatewayPolicyIngestReport;
pub use services::gateway::NullScanner;
pub use services::gateway::QuotaWindow;
pub use services::gateway::SafetyConfig;
pub use services::gateway::SafetyScanner;
pub use services::gateway::SafetyScannerRegistration;
pub use services::gateway::Severity;
pub use services::gateway::load_from_yaml as load_gateway_policies_from_yaml;
pub use services::storage::ImageStorage;
pub use services::storage::StorageConfig;
pub use services::tools::NoopToolProvider;
pub use models::image_generation::AspectRatio;
pub use models::image_generation::GeneratedImageRecord;
pub use models::image_generation::ImageGenerationRequest;
pub use models::image_generation::ImageGenerationResponse;
pub use models::image_generation::ImageResolution;
pub use models::image_generation::ReferenceImage;
pub use services::providers::GeminiImageProvider;
pub use services::providers::ImageProvider;
pub use services::providers::ImageProviderCapabilities;
pub use repository::AiGatewayPolicyRepository;
pub use repository::AiQuotaBucketRepository;
pub use repository::AiRequestPayloadRepository;
pub use repository::AiRequestRepository;
pub use repository::AiSafetyFindingRepository;
pub use repository::GatewayPolicyRow;
pub use repository::IncrementParams;
pub use repository::InsertSafetyFinding;
pub use repository::QuotaBucketDelta;
pub use repository::QuotaBucketState;
pub use repository::UpsertPayloadParams;
pub use services::tooled::ToolResultFormatter;

Modules§

error
Typed error hierarchy for the systemprompt-ai crate.
models
Domain data types for the AI crate.
repository
Repository layer for AI domain persistence.
services
Service orchestration layer for the AI domain crate.

Macros§

register_safety_scanner
Register a SafetyScanner implementation with the gateway.

Structs§

AiConfig
AiExtension
AiMessage
AiRequest
AiRequestBuilder
AiResponse
CallToolResult
The result of a tool call operation.
GenerateResponseParams
GoogleSearchParams
McpTool
ModelConfig
ModelPreferences
ProviderConfig
SamplingParams
SearchGroundedResponse
StructuredOutputOptions
ToolCall
ToolExecution

Enums§

MessageRole
ModelHint
ResponseFormat

Traits§

AiProvider
#[async_trait] is required: this trait is consumed exclusively as DynAiProvider (Arc<dyn AiProvider>), and a dyn-compatible trait cannot use native async fn.

Type Aliases§

DynAiProvider