systemprompt (Facade)
Public API facade crate that re-exports all SystemPrompt functionality
On this page
The facade crate provides the public API for SystemPrompt, re-exporting functionality from all internal crates with a unified interface.
Overview
The systemprompt crate is the primary dependency for projects using SystemPrompt as a library. It provides feature-gated access to all functionality through a single dependency.
Installation
Add to your Cargo.toml:
[dependencies]
systemprompt = { version = "0.0.14", features = ["full"] }
Feature Flags
| Feature | Description | Dependencies |
|---|---|---|
core |
Traits, models, identifiers, extension | (default) |
database |
Database abstraction | core |
api |
HTTP server | core, database |
cli |
CLI entry point | core, database |
mcp |
Model Context Protocol | core |
sync |
Cloud synchronization | core |
cloud |
Cloud infrastructure | core |
full |
All functionality | all |
Minimal (Core Only)
[dependencies]
systemprompt = "0.0.14" # Just core features
API Server
[dependencies]
systemprompt = { version = "0.0.14", features = ["api"] }
Full Installation
[dependencies]
systemprompt = { version = "0.0.14", features = ["full"] }
Re-exports
The facade crate re-exports from these internal crates:
Always Available (core)
pub use systemprompt_models::*;
pub use systemprompt_traits::*;
pub use systemprompt_identifiers::*;
pub use systemprompt_extension::*;
pub use systemprompt_provider_contracts::*;
With database Feature
pub use systemprompt_database::*;
With api Feature
pub use systemprompt_api::*;
pub use systemprompt_runtime::*;
With mcp Feature
pub use systemprompt_mcp::*;
Usage Examples
Building an Extension
use systemprompt::{Extension, ApiExtension, register_extension};
pub struct MyExtension;
impl Extension for MyExtension {
fn id(&self) -> &'static str { "my-extension" }
fn name(&self) -> &'static str { "My Extension" }
fn version(&self) -> &'static str { env!("CARGO_PKG_VERSION") }
fn dependencies(&self) -> Vec<&'static str> { vec![] }
}
register_extension!(MyExtension);
Using Models
use systemprompt::{User, UserId, Content, ContentId};
fn process_user(user: User) {
println!("User: {} ({})", user.name, user.id);
}
Database Access
use systemprompt::{DatabasePool, DatabaseConfig};
async fn connect() -> Result<DatabasePool, Error> {
let config = DatabaseConfig::load()?;
DatabasePool::connect(&config).await
}
Provider Implementation
use systemprompt::{LlmProvider, LlmRequest, LlmResponse};
pub struct MyProvider;
#[async_trait]
impl LlmProvider for MyProvider {
fn id(&self) -> &'static str { "my-provider" }
async fn complete(&self, request: LlmRequest) -> Result<LlmResponse> {
// Your implementation
}
}
Version Compatibility
The facade crate version matches the core version:
| Facade Version | Core Version | Min Rust |
|---|---|---|
| 0.0.14 | 0.0.14 | 1.75+ |
Prelude
For convenience, import the prelude:
use systemprompt::prelude::*;
This imports commonly used types and traits.
Related Documentation
- Crate Reference - All crate documentation
- Building Extensions - Extension guide
- Architecture - System design