adk_model/anthropic/config.rs
1//! Configuration types for Anthropic provider.
2
3use adk_anthropic::{ThinkingDisplay, ToolSearchConfig};
4use serde::{Deserialize, Serialize};
5
6/// Thinking mode configuration for Anthropic models.
7#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
8#[serde(tag = "type", rename_all = "snake_case")]
9pub enum ThinkingMode {
10 /// Budget-based thinking (legacy, deprecated on 4.6 models,
11 /// **rejected on Opus 4.7**).
12 /// Requires `budget_tokens` < `max_tokens`.
13 Enabled {
14 /// Token budget for thinking (must be ≥ 1024).
15 budget_tokens: u32,
16 },
17 /// Adaptive thinking, the thinking mode of Claude 4.6 and later models.
18 /// Claude decides when and how much to think.
19 /// Control depth via `effort` on `AnthropicConfig`, and whether the thinking text is
20 /// returned via [`AnthropicConfig::with_thinking_display`].
21 Adaptive,
22 /// No thinking before the response, only short updates between tool calls: the way to
23 /// turn thinking off on Claude Sonnet 5.5, which rejects disabled thinking. The API
24 /// accepts it at effort `high` or below; Claude Fable 5.x and Opus 5.5 always think, so
25 /// lower `effort` on those instead.
26 BetweenTools,
27}
28
29/// Effort level controlling response thoroughness.
30/// Passed via `output_config.effort` in the API.
31#[derive(Debug, Clone, Copy, Serialize, Deserialize, PartialEq, Eq)]
32#[serde(rename_all = "lowercase")]
33pub enum Effort {
34 /// Minimal reasoning effort.
35 Low,
36 /// Moderate reasoning effort.
37 Medium,
38 /// Thorough reasoning effort.
39 High,
40 /// Very deep reasoning, for the hardest long-running work where a gain over `High` is
41 /// measured. One turn can think for more than fifteen minutes, so the client sends a
42 /// task budget at this level; see [`AnthropicConfig::with_task_budget`]. Opus 4.7 and
43 /// later.
44 XHigh,
45 /// Uncapped reasoning, for measuring a model's ceiling or a task where time and tokens
46 /// do not matter: one turn can think for more than fifteen minutes and spend the
47 /// model's whole 128,000-token output limit before it answers. The client sends a
48 /// task budget at this level so the model paces itself; see
49 /// [`AnthropicConfig::with_task_budget`]. Opus 4.6 and later.
50 Max,
51}
52
53/// The harness effort levels (spec 3.1 §7.23): `Low`, `Medium` and `High` map to the
54/// Anthropic levels of the same name; `XHigh` and `Max` stay reachable only through
55/// [`AnthropicConfig::with_effort`].
56///
57/// # Example
58///
59/// ```rust
60/// use adk_model::anthropic::Effort;
61///
62/// assert_eq!(Effort::from(adk_core::Effort::High), Effort::High);
63/// ```
64impl From<adk_core::Effort> for Effort {
65 fn from(effort: adk_core::Effort) -> Self {
66 match effort {
67 adk_core::Effort::Low => Self::Low,
68 adk_core::Effort::Medium => Self::Medium,
69 adk_core::Effort::High => Self::High,
70 }
71 }
72}
73
74/// Configuration for Anthropic API.
75///
76/// # Example
77///
78/// ```rust
79/// use adk_model::anthropic::{AnthropicConfig, ThinkingMode, Effort};
80///
81/// // Adaptive thinking at high effort: the level to start from on a hard task
82/// let config = AnthropicConfig::new("sk-ant-xxx", "claude-opus-5-5")
83/// .with_thinking_mode(ThinkingMode::Adaptive)
84/// .with_effort(Effort::High);
85///
86/// // Adaptive thinking with medium effort (recommended for Sonnet 4.6)
87/// let config = AnthropicConfig::new("sk-ant-xxx", "claude-sonnet-4-6")
88/// .with_thinking_mode(ThinkingMode::Adaptive)
89/// .with_effort(Effort::Medium);
90///
91/// // Budget-based thinking (legacy, rejected on Opus 4.7)
92/// let config = AnthropicConfig::new("sk-ant-xxx", "claude-sonnet-4-5")
93/// .with_thinking_mode(ThinkingMode::Enabled { budget_tokens: 8192 });
94///
95/// // Prompt caching (enabled by default, can be disabled)
96/// let config = AnthropicConfig::new("sk-ant-xxx", "claude-sonnet-4-6")
97/// .with_prompt_caching(false); // opt out
98/// ```
99///
100/// The API key is redacted from `Debug` output and omitted when serializing.
101#[derive(Clone, Serialize, Deserialize)]
102pub struct AnthropicConfig {
103 /// Anthropic API key. Never serialized; deserializing a config without it
104 /// yields an empty key.
105 #[serde(skip_serializing, default)]
106 pub api_key: String,
107 /// Model name (e.g., `"claude-opus-5"`, `"claude-sonnet-5-5"`).
108 pub model: String,
109 /// Maximum tokens to generate. `None` uses
110 /// [`anthropic_default_max_tokens`](crate::catalog::anthropic_default_max_tokens)
111 /// for the model: 64,000 for Claude 5, Opus 4.6 to 4.8 and Sonnet 4.6, whose thinking
112 /// counts toward this cap, 32,000 for earlier Claude 4 models, and 4,096 for older or
113 /// unrecognized ones. At `xhigh` or `max` effort the 64,000 becomes 128,000, the
114 /// models' output limit.
115 #[serde(default, skip_serializing_if = "Option::is_none")]
116 pub max_tokens: Option<u32>,
117 /// Bound on a whole non-streaming request, and on the wait for the response
118 /// headers of a streaming one, in seconds. `None` uses 600 (10 minutes).
119 #[serde(default, skip_serializing_if = "Option::is_none")]
120 pub request_timeout_secs: Option<u64>,
121 /// Optional custom base URL (for proxies, Ollama, Vercel Gateway, etc.).
122 #[serde(skip_serializing_if = "Option::is_none")]
123 pub base_url: Option<String>,
124
125 /// Accept a plain `http://` [`base_url`](AnthropicConfig::base_url) on a
126 /// non-loopback host.
127 ///
128 /// Defaults to `false`. Set with
129 /// [`allow_insecure_http`](AnthropicConfig::allow_insecure_http).
130 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
131 pub allow_insecure_http: bool,
132
133 /// Enable prompt caching with `cache_control` blocks.
134 ///
135 /// Defaults to `true`. Anthropic prompt caching reduces costs and latency
136 /// by reusing previously processed context. Disable with
137 /// [`with_prompt_caching(false)`](AnthropicConfig::with_prompt_caching).
138 #[serde(default = "default_prompt_caching")]
139 pub prompt_caching: bool,
140
141 /// Lifetime of the prompt cache entries this client writes. `None` uses the
142 /// API default of 5 minutes. Set with
143 /// [`with_prompt_cache_ttl`](AnthropicConfig::with_prompt_cache_ttl).
144 #[serde(default, skip_serializing_if = "Option::is_none")]
145 pub prompt_cache_ttl: Option<adk_anthropic::CacheTtl>,
146
147 /// Thinking mode configuration.
148 #[serde(skip_serializing_if = "Option::is_none")]
149 pub thinking: Option<ThinkingMode>,
150
151 /// Whether responses carry the thinking text (`thinking.display`), for the configured
152 /// [`thinking`](AnthropicConfig::thinking) mode. `None` uses the model's default: Opus 4.7
153 /// and later, Sonnet 5 and later, and Haiku 5.5 omit the text and return only the
154 /// signature; Opus 4.6 and Sonnet 4.6 return a summary.
155 #[serde(default, skip_serializing_if = "Option::is_none")]
156 pub thinking_display: Option<ThinkingDisplay>,
157
158 /// Effort level (goes into `output_config.effort`).
159 /// Works with or without thinking enabled.
160 #[serde(skip_serializing_if = "Option::is_none")]
161 pub effort: Option<Effort>,
162
163 /// Enable fast mode for Claude Opus 5 or Claude Opus 4.8 (research preview).
164 /// Delivers up to 2.5× higher output tokens/sec at premium pricing.
165 #[serde(default)]
166 pub fast_mode: bool,
167
168 /// Enable citations on documents in requests.
169 #[serde(default)]
170 pub citations: bool,
171
172 /// Geographic routing for data residency (e.g., `"US"`, `"EU"`).
173 #[serde(skip_serializing_if = "Option::is_none")]
174 pub inference_geo: Option<String>,
175
176 /// Server-side context management (tool result clearing, thinking block clearing).
177 /// Requires beta header (auto-injected by adk-anthropic).
178 #[serde(skip_serializing_if = "Option::is_none")]
179 pub context_management: Option<adk_anthropic::ContextManagement>,
180
181 /// Service tier (`"auto"` or `"standard_only"`).
182 #[serde(skip_serializing_if = "Option::is_none")]
183 pub service_tier: Option<String>,
184
185 /// Beta feature headers (e.g., `"prompt-caching-2024-07-31"`).
186 #[serde(default, skip_serializing_if = "Vec::is_empty")]
187 pub beta_features: Vec<String>,
188
189 /// Custom API version header override.
190 #[serde(skip_serializing_if = "Option::is_none")]
191 pub api_version: Option<String>,
192
193 /// Tool search configuration for regex-based dynamic tool discovery.
194 /// When set, only tools whose names match the regex pattern are loaded.
195 /// When `None`, all available tools are loaded.
196 #[serde(skip)]
197 pub tool_search: Option<ToolSearchConfig>,
198
199 /// Whether a conversation keeps the `tools` array it started with and sends later tool
200 /// changes as `tool_addition` / `tool_removal` blocks (beta `inline-tools-2026-09-15`), so a
201 /// tool added mid-conversation does not miss the prompt cache. Applies to the Claude API
202 /// models that support mid-conversation tool changes.
203 #[serde(default)]
204 pub inline_tool_changes: bool,
205
206 /// Whether requests continue a message thread the API keeps (beta
207 /// `message-threads-2026-08-12`), so each sends only the messages since the previous
208 /// response. Threads are not ZDR eligible.
209 #[serde(default)]
210 pub message_threads: bool,
211 /// Tokens the model paces a task against (`output_config.task_budget`, beta
212 /// `task-budgets-2026-03-13`). `None` sends half of `max_tokens` at `xhigh` and `max`
213 /// effort on a model that accepts task budgets, and nothing otherwise; see
214 /// [`with_task_budget`](Self::with_task_budget).
215 #[serde(default, skip_serializing_if = "Option::is_none")]
216 pub task_budget: Option<u32>,
217 /// Whether `xhigh` and `max` effort send a task budget when [`task_budget`](Self::task_budget) is
218 /// `None`. On by default.
219 #[serde(default = "default_prompt_caching")]
220 pub automatic_task_budget: bool,
221}
222
223impl std::fmt::Debug for AnthropicConfig {
224 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
225 f.debug_struct("AnthropicConfig")
226 .field("api_key", &"[REDACTED]")
227 .field("model", &self.model)
228 .field("max_tokens", &self.max_tokens)
229 .field("request_timeout_secs", &self.request_timeout_secs)
230 .field("base_url", &self.base_url)
231 .field("allow_insecure_http", &self.allow_insecure_http)
232 .field("prompt_caching", &self.prompt_caching)
233 .field("prompt_cache_ttl", &self.prompt_cache_ttl)
234 .field("thinking", &self.thinking)
235 .field("thinking_display", &self.thinking_display)
236 .field("effort", &self.effort)
237 .field("fast_mode", &self.fast_mode)
238 .field("citations", &self.citations)
239 .field("inference_geo", &self.inference_geo)
240 .field("context_management", &self.context_management)
241 .field("service_tier", &self.service_tier)
242 .field("beta_features", &self.beta_features)
243 .field("api_version", &self.api_version)
244 .field("tool_search", &self.tool_search)
245 .field("inline_tool_changes", &self.inline_tool_changes)
246 .field("message_threads", &self.message_threads)
247 .field("task_budget", &self.task_budget)
248 .field("automatic_task_budget", &self.automatic_task_budget)
249 .finish()
250 }
251}
252
253fn default_prompt_caching() -> bool {
254 true
255}
256
257impl Default for AnthropicConfig {
258 fn default() -> Self {
259 Self {
260 api_key: String::new(),
261 model: crate::catalog::ANTHROPIC_DEFAULT.to_string(),
262 max_tokens: None,
263 request_timeout_secs: None,
264 base_url: None,
265 allow_insecure_http: false,
266 prompt_caching: true,
267 prompt_cache_ttl: None,
268 thinking: None,
269 thinking_display: None,
270 effort: None,
271 fast_mode: false,
272 citations: false,
273 inference_geo: None,
274 context_management: None,
275 service_tier: None,
276 beta_features: Vec::new(),
277 api_version: None,
278 tool_search: None,
279 inline_tool_changes: false,
280 message_threads: false,
281 task_budget: None,
282 automatic_task_budget: true,
283 }
284 }
285}
286
287impl AnthropicConfig {
288 /// Create a new Anthropic config with the given API key and model.
289 pub fn new(api_key: impl Into<String>, model: impl Into<String>) -> Self {
290 Self { api_key: api_key.into(), model: model.into(), ..Default::default() }
291 }
292
293 /// Set the maximum tokens to generate, replacing the model-aware default.
294 pub fn with_max_tokens(mut self, max_tokens: u32) -> Self {
295 self.max_tokens = Some(max_tokens);
296 self
297 }
298
299 /// Bound each request, replacing the 10-minute default.
300 ///
301 /// The bound covers a whole non-streaming request, such as an agent called
302 /// through `AgentTool`, and the wait for the response headers of a streaming
303 /// request. Sub-second precision is rounded up to the next second.
304 ///
305 /// # Example
306 ///
307 /// ```rust
308 /// use std::time::Duration;
309 /// use adk_model::anthropic::AnthropicConfig;
310 ///
311 /// let config = AnthropicConfig::new("sk-ant-xxx", "claude-opus-5-5")
312 /// .with_request_timeout(Duration::from_secs(1_800));
313 /// assert_eq!(config.request_timeout_secs, Some(1_800));
314 /// ```
315 pub fn with_request_timeout(mut self, timeout: std::time::Duration) -> Self {
316 self.request_timeout_secs = Some(timeout.as_secs() + u64::from(timeout.subsec_nanos() > 0));
317 self
318 }
319
320 /// Set a custom base URL.
321 ///
322 /// The URL is validated when [`AnthropicClient::new`](super::AnthropicClient::new)
323 /// builds the client: it must use `https://`, or `http://` with a loopback host,
324 /// unless [`allow_insecure_http`](Self::allow_insecure_http) is set.
325 pub fn with_base_url(mut self, base_url: impl Into<String>) -> Self {
326 self.base_url = Some(base_url.into());
327 self
328 }
329
330 /// Allow a plain `http://` base URL on a non-loopback host.
331 ///
332 /// Use this for a trusted internal gateway that is reachable only over plain
333 /// HTTP. Every request attaches the API key, which then crosses the network
334 /// unencrypted. The base URL is validated when
335 /// [`AnthropicClient::new`](super::AnthropicClient::new) builds the client, so
336 /// this method and [`with_base_url`](Self::with_base_url) can be called in
337 /// either order. Accepting a non-loopback `http://` URL logs a warning with
338 /// the host.
339 ///
340 /// The opt-in applies to the configured base URL. Without one, the client
341 /// reads `ANTHROPIC_BASE_URL`, and a plain-HTTP URL from that variable is
342 /// acknowledged by `ANTHROPIC_ALLOW_INSECURE_HTTP=1` instead.
343 ///
344 /// # Example
345 ///
346 /// ```rust
347 /// use adk_model::anthropic::{AnthropicClient, AnthropicConfig};
348 ///
349 /// let config = AnthropicConfig::new("sk-ant-xxx", "claude-sonnet-5-5")
350 /// .allow_insecure_http()
351 /// .with_base_url("http://10.60.1.20:8080/api/v1/llm/anthropic");
352 /// let client = AnthropicClient::new(config)?;
353 /// # Ok::<(), adk_core::AdkError>(())
354 /// ```
355 pub fn allow_insecure_http(mut self) -> Self {
356 self.allow_insecure_http = true;
357 self
358 }
359
360 /// Enable or disable prompt caching.
361 pub fn with_prompt_caching(mut self, enabled: bool) -> Self {
362 self.prompt_caching = enabled;
363 self
364 }
365
366 /// Set the lifetime of the prompt cache entries this client writes.
367 ///
368 /// Applies to both the system-prompt breakpoint and the automatic breakpoint
369 /// on the conversation tail. A 1-hour entry costs more to write than a
370 /// 5-minute one and pays off when requests sharing a prefix are more than five
371 /// minutes apart, such as a conversation waiting on a person.
372 ///
373 /// # Example
374 ///
375 /// ```rust
376 /// use adk_model::anthropic::{AnthropicConfig, CacheTtl};
377 ///
378 /// let config = AnthropicConfig::new("sk-ant-xxx", "claude-sonnet-5-5")
379 /// .with_prompt_cache_ttl(CacheTtl::one_hour());
380 /// assert_eq!(config.prompt_cache_ttl, Some(CacheTtl::one_hour()));
381 /// ```
382 pub fn with_prompt_cache_ttl(mut self, ttl: adk_anthropic::CacheTtl) -> Self {
383 self.prompt_cache_ttl = Some(ttl);
384 self
385 }
386
387 /// Set the thinking mode.
388 pub fn with_thinking_mode(mut self, mode: ThinkingMode) -> Self {
389 self.thinking = Some(mode);
390 self
391 }
392
393 /// Set whether responses carry the thinking text, for the configured thinking mode.
394 ///
395 /// Current models omit it by default; [`ThinkingDisplay::Summarized`] returns a summary.
396 ///
397 /// # Example
398 ///
399 /// ```
400 /// use adk_model::anthropic::{AnthropicConfig, ThinkingDisplay, ThinkingMode};
401 ///
402 /// let config = AnthropicConfig::new("sk-ant-xxx", "claude-opus-5-5")
403 /// .with_thinking_mode(ThinkingMode::Adaptive)
404 /// .with_thinking_display(ThinkingDisplay::Summarized);
405 /// assert_eq!(config.thinking_display, Some(ThinkingDisplay::Summarized));
406 /// ```
407 pub fn with_thinking_display(mut self, display: ThinkingDisplay) -> Self {
408 self.thinking_display = Some(display);
409 self
410 }
411
412 /// Convenience: enable budget-based thinking with the given token budget.
413 pub fn with_thinking(mut self, budget_tokens: u32) -> Self {
414 self.thinking = Some(ThinkingMode::Enabled { budget_tokens });
415 self
416 }
417
418 /// Set the effort level (goes into `output_config.effort`).
419 pub fn with_effort(mut self, effort: Effort) -> Self {
420 self.effort = Some(effort);
421 self
422 }
423
424 /// Sets the tokens the model paces a task against (`output_config.task_budget`).
425 ///
426 /// `max_tokens` is enforced but invisible to the model, so a turn at `xhigh` or `max`
427 /// effort can spend all of it on thinking and stop before the answer. A task budget is
428 /// advisory and visible: the model sees a countdown of its thinking, tool calls and
429 /// output and wraps up as it runs down. The API takes at least 20,000 tokens, on Claude
430 /// Opus 4.7 and later Opus models, Sonnet 5.5, Haiku 5.5, and Fable and Mythos 5.
431 ///
432 /// Without this call the client sends half of `max_tokens` at `xhigh` and `max` effort
433 /// on those models; [`without_automatic_task_budget`](Self::without_automatic_task_budget)
434 /// turns that off.
435 ///
436 /// # Example
437 ///
438 /// ```rust
439 /// use adk_model::anthropic::{AnthropicConfig, Effort, ThinkingMode};
440 ///
441 /// let config = AnthropicConfig::new("sk-ant-xxx", "claude-opus-5-5")
442 /// .with_thinking_mode(ThinkingMode::Adaptive)
443 /// .with_effort(Effort::XHigh)
444 /// .with_task_budget(48_000);
445 /// assert_eq!(config.task_budget, Some(48_000));
446 /// ```
447 pub fn with_task_budget(mut self, tokens: u32) -> Self {
448 self.task_budget = Some(tokens);
449 self
450 }
451
452 /// Stops the client sending a task budget of its own at `xhigh` and `max` effort, for an
453 /// endpoint that rejects the `task-budgets-2026-03-13` beta.
454 ///
455 /// # Example
456 ///
457 /// ```rust
458 /// use adk_model::anthropic::AnthropicConfig;
459 ///
460 /// let config = AnthropicConfig::new("sk-ant-xxx", "claude-opus-5-5")
461 /// .without_automatic_task_budget();
462 /// assert!(!config.automatic_task_budget);
463 /// ```
464 pub fn without_automatic_task_budget(mut self) -> Self {
465 self.automatic_task_budget = false;
466 self
467 }
468
469 /// Enable fast mode for Claude Opus 5 or Claude Opus 4.8.
470 pub fn with_fast_mode(mut self, enabled: bool) -> Self {
471 self.fast_mode = enabled;
472 self
473 }
474
475 /// Enable citations on documents.
476 pub fn with_citations(mut self, enabled: bool) -> Self {
477 self.citations = enabled;
478 self
479 }
480
481 /// Set geographic routing for data residency.
482 pub fn with_inference_geo(mut self, geo: impl Into<String>) -> Self {
483 self.inference_geo = Some(geo.into());
484 self
485 }
486
487 /// Set the service tier.
488 pub fn with_service_tier(mut self, tier: impl Into<String>) -> Self {
489 self.service_tier = Some(tier.into());
490 self
491 }
492
493 /// Set context management (tool result clearing, thinking block clearing).
494 pub fn with_context_management(mut self, cm: adk_anthropic::ContextManagement) -> Self {
495 self.context_management = Some(cm);
496 self
497 }
498
499 /// Add a beta feature header value.
500 pub fn with_beta_feature(mut self, feature: impl Into<String>) -> Self {
501 self.beta_features.push(feature.into());
502 self
503 }
504
505 /// Set a custom API version header.
506 pub fn with_api_version(mut self, version: impl Into<String>) -> Self {
507 self.api_version = Some(version.into());
508 self
509 }
510
511 /// Set tool search configuration for dynamic tool discovery.
512 ///
513 /// When set, only tools whose names match the regex pattern are loaded per request.
514 /// When not set, all available tools are loaded.
515 ///
516 /// # Example
517 ///
518 /// ```rust
519 /// use adk_model::anthropic::AnthropicConfig;
520 /// use adk_anthropic::{ThinkingDisplay, ToolSearchConfig};
521 ///
522 /// let config = AnthropicConfig::new("sk-ant-xxx", "claude-sonnet-4-6")
523 /// .with_tool_search(ToolSearchConfig::new("^(search|fetch)_.*"));
524 /// ```
525 pub fn with_tool_search(mut self, config: ToolSearchConfig) -> Self {
526 self.tool_search = Some(config);
527 self
528 }
529
530 /// Sends tools added, redefined or removed mid-conversation as inline tool changes, so the
531 /// conversation's `tools` array, and the cached prefix it opens, stays as first sent.
532 ///
533 /// The client remembers each conversation's tools in memory for an hour; a conversation it
534 /// does not remember, or whose history changed, sends its tools as they are.
535 ///
536 /// # Example
537 ///
538 /// ```rust
539 /// use adk_model::anthropic::AnthropicConfig;
540 ///
541 /// let config = AnthropicConfig::new("sk-ant-xxx", "claude-sonnet-5-5")
542 /// .with_inline_tool_changes(true);
543 /// assert!(config.inline_tool_changes);
544 /// ```
545 pub fn with_inline_tool_changes(mut self, enabled: bool) -> Self {
546 self.inline_tool_changes = enabled;
547 self
548 }
549
550 /// Continues a message thread the API keeps for each conversation, so a request sends only
551 /// the messages since the previous response: smaller requests and a steadier time to first
552 /// token in long tool loops, at the same price.
553 ///
554 /// The session stays the source of truth: a request continues its thread only when the
555 /// conversation it sends starts with exactly what the thread holds, and creates a new one
556 /// otherwise. A conversation that carries a compaction is sent without a thread, and a
557 /// thread the API cannot continue is replaced by sending the whole conversation. Threads
558 /// are not ZDR eligible.
559 ///
560 /// # Example
561 ///
562 /// ```rust
563 /// use adk_model::anthropic::AnthropicConfig;
564 ///
565 /// let config = AnthropicConfig::new("sk-ant-xxx", "claude-sonnet-5-5").with_message_threads(true);
566 /// assert!(config.message_threads);
567 /// ```
568 pub fn with_message_threads(mut self, enabled: bool) -> Self {
569 self.message_threads = enabled;
570 self
571 }
572}
573
574#[cfg(test)]
575mod effort_tests {
576 use super::Effort;
577
578 /// The harness levels map to their namesakes; `XHigh` and `Max` are never produced.
579 #[test]
580 fn every_harness_effort_maps_to_its_namesake() {
581 for (core, provider) in [
582 (adk_core::Effort::Low, Effort::Low),
583 (adk_core::Effort::Medium, Effort::Medium),
584 (adk_core::Effort::High, Effort::High),
585 ] {
586 assert_eq!(Effort::from(core), provider);
587 }
588 }
589}