Expand description
Intelligent model selection based on cost / quality / latency tradeoffs.
§Key types
ModelProfile— static description of a model’s characteristics.SelectionCriteria— caller-supplied hard constraints (max cost, min quality, …).SelectionStrategy— ranking algorithm applied to the candidate set.ModelSelector— registry + selection engine.ModelUsageTracker— records actual runtime usage to compare with predictions.
§Example
use tokio_prompt_orchestrator::model_selector::{
ModelProfile, ModelSelector, SelectionCriteria, SelectionStrategy,
};
let mut selector = ModelSelector::new(SelectionStrategy::CheapestFirst);
selector.register(ModelProfile {
id: "fast-cheap".to_string(),
cost_per_1k_tokens: 0.001,
avg_latency_ms: 200.0,
quality_score: 0.75,
max_context_tokens: 8192,
supports_streaming: true,
supports_tools: false,
});
let criteria = SelectionCriteria::default();
let model = selector.select(&criteria).unwrap();
assert_eq!(model.id, "fast-cheap");Structs§
- Model
Profile - Static description of a model’s cost, performance, and capability profile.
- Model
Selector - Registry and selection engine for
ModelProfiles. - Model
Usage - Accumulated runtime usage for a single model.
- Model
Usage Tracker - Thread-safe tracker for actual model usage.
- Selection
Criteria - Hard constraints that a model must satisfy to be eligible for selection.
Enums§
- Selection
Strategy - Algorithm used to rank the eligible model candidates.