nemo_flow_adaptive/acg/passthrough.rs
1// SPDX-FileCopyrightText: Copyright (c) 2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
2// SPDX-License-Identifier: Apache-2.0
3
4//! Passthrough plugin that applies no transformations.
5//!
6//! Used as a baseline for A/B testing, as the default when no
7//! provider-specific plugin is configured, and for backends with no
8//! explicit cache control APIs.
9//!
10//! [`PassthroughPlugin`] implements [`ProviderPlugin`] by cloning the
11//! rewritten request unchanged and generating a [`TranslationReport`]
12//! where every intent is marked [`TranslationStatus::Ignored`] with
13//! [`ReasonCode::NotRelevant`].
14
15use crate::acg::capability::BackendCapabilities;
16use crate::acg::plugin::{PluginInput, PluginOutput, ProviderPlugin};
17use crate::acg::types::{ReasonCode, TranslationReport};
18
19/// A no-op provider plugin that passes requests through unchanged.
20///
21/// Returns the `rewritten_request` as-is (cloned) and generates a
22/// [`TranslationReport`] where every intent is marked
23/// [`TranslationStatus::Ignored`] with [`ReasonCode::NotRelevant`].
24///
25/// # Usage
26///
27/// - Default plugin when no provider-specific plugin is configured
28/// - Baseline for A/B testing (compare against optimized plugins)
29/// - Backends with no explicit cache control APIs
30pub struct PassthroughPlugin;
31
32impl ProviderPlugin for PassthroughPlugin {
33 fn plugin_id(&self) -> &str {
34 "passthrough"
35 }
36
37 fn plugin_name(&self) -> &str {
38 "Passthrough (No-Op)"
39 }
40
41 fn translate(&self, input: &PluginInput<'_>) -> crate::acg::error::Result<PluginOutput> {
42 let translated_request = input.rewritten_request.clone();
43 let translation_report = TranslationReport::all_ignored(
44 input.intent_bundle,
45 "passthrough",
46 ReasonCode::NotRelevant,
47 Some("passthrough plugin applies no transformations".to_string()),
48 );
49 Ok(PluginOutput {
50 translated_request,
51 translation_report,
52 })
53 }
54
55 fn capabilities(&self) -> BackendCapabilities {
56 BackendCapabilities::none("passthrough")
57 }
58}
59
60#[cfg(test)]
61#[path = "../../tests/unit/acg/passthrough_tests.rs"]
62mod tests;