pub struct ModelRecommendation { /* private fields */ }Expand description
Model recommendation helper
Provides recommendations for which Claude model to use based on task type. You can use the default recommendations or provide custom mappings.
Implementations§
Source§impl ModelRecommendation
impl ModelRecommendation
Sourcepub fn with_defaults() -> Self
pub fn with_defaults() -> Self
Create with default recommendations
Default mappings:
- “simple” / “fast” / “cheap” → claude-3-5-haiku-20241022 (fastest, cheapest)
- “balanced” / “general” → sonnet (balanced performance/cost)
- “complex” / “best” / “quality” → opus (most capable)
§Example
use cc_sdk::model_recommendation::ModelRecommendation;
let recommender = ModelRecommendation::default();
let model = recommender.suggest("simple").unwrap();
assert_eq!(model, "claude-3-5-haiku-20241022");Sourcepub fn custom(recommendations: HashMap<String, String>) -> Self
pub fn custom(recommendations: HashMap<String, String>) -> Self
Create with custom recommendations
§Example
use cc_sdk::model_recommendation::ModelRecommendation;
use std::collections::HashMap;
let mut custom_map = HashMap::new();
custom_map.insert("code_review".to_string(), "sonnet".to_string());
custom_map.insert("documentation".to_string(), "claude-3-5-haiku-20241022".to_string());
let recommender = ModelRecommendation::custom(custom_map);Sourcepub fn suggest(&self, task_type: &str) -> Option<&str>
pub fn suggest(&self, task_type: &str) -> Option<&str>
Get a model suggestion for a given task type
Returns the recommended model name, or None if no recommendation exists.
§Example
use cc_sdk::model_recommendation::ModelRecommendation;
let recommender = ModelRecommendation::default();
// For simple tasks, use Haiku
assert_eq!(recommender.suggest("simple"), Some("claude-3-5-haiku-20241022"));
// For complex tasks, use Opus
assert_eq!(recommender.suggest("complex"), Some("opus"));Sourcepub fn add(&mut self, task_type: impl Into<String>, model: impl Into<String>)
pub fn add(&mut self, task_type: impl Into<String>, model: impl Into<String>)
Add or update a recommendation
§Example
use cc_sdk::model_recommendation::ModelRecommendation;
let mut recommender = ModelRecommendation::default();
recommender.add("my_task", "sonnet");
assert_eq!(recommender.suggest("my_task"), Some("sonnet"));Sourcepub fn task_types(&self) -> Vec<&str>
pub fn task_types(&self) -> Vec<&str>
Get all task types with recommendations
Sourcepub fn all_recommendations(&self) -> &HashMap<String, String>
pub fn all_recommendations(&self) -> &HashMap<String, String>
Get all available recommendations
Trait Implementations§
Source§impl Clone for ModelRecommendation
impl Clone for ModelRecommendation
Source§fn clone(&self) -> ModelRecommendation
fn clone(&self) -> ModelRecommendation
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ModelRecommendation
impl Debug for ModelRecommendation
Auto Trait Implementations§
impl Freeze for ModelRecommendation
impl RefUnwindSafe for ModelRecommendation
impl Send for ModelRecommendation
impl Sync for ModelRecommendation
impl Unpin for ModelRecommendation
impl UnwindSafe for ModelRecommendation
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more