Skip to main content

sqlite_graphrag/extract/
none_backend.rs

1//! No-op extraction backend (v1.0.75 — G21 auxiliary)
2//!
3//! Returns empty output for pipelines that want to skip extraction entirely.
4
5use super::{BackendHealth, BackendKind, ExtractionBackend, ExtractionHints, ExtractionOutput};
6use crate::errors::AppError;
7use async_trait::async_trait;
8
9pub struct NoneBackend;
10
11impl NoneBackend {
12    pub fn new() -> Self {
13        Self
14    }
15}
16
17impl Default for NoneBackend {
18    fn default() -> Self {
19        Self::new()
20    }
21}
22
23#[async_trait]
24impl ExtractionBackend for NoneBackend {
25    fn kind(&self) -> BackendKind {
26        BackendKind::None
27    }
28
29    fn model_name(&self) -> String {
30        "none".to_string()
31    }
32
33    async fn extract(
34        &self,
35        _content: &str,
36        _hints: &ExtractionHints,
37    ) -> Result<ExtractionOutput, AppError> {
38        Ok(ExtractionOutput {
39            backend: self.kind().as_str().to_string(),
40            elapsed_ms: 0,
41            ..Default::default()
42        })
43    }
44
45    async fn health(&self) -> Result<BackendHealth, AppError> {
46        Ok(BackendHealth {
47            kind: self.kind(),
48            healthy: true,
49            model_name: "none".to_string(),
50            message: "no-op backend always healthy".to_string(),
51        })
52    }
53}