Skip to main content

codelens_engine/
embedding_types.rs

1//! Pure data types for semantic search results.
2//! Unconditional — available whether or not the `semantic` feature is enabled.
3
4use crate::embedding_store::ScoredChunk;
5use serde::Serialize;
6
7/// Result of a semantic search query.
8#[derive(Debug, Clone, Serialize)]
9pub struct SemanticMatch {
10    pub file_path: String,
11    pub symbol_name: String,
12    pub kind: String,
13    pub line: usize,
14    pub signature: String,
15    pub name_path: String,
16    pub score: f64,
17}
18
19impl From<ScoredChunk> for SemanticMatch {
20    fn from(c: ScoredChunk) -> Self {
21        Self {
22            file_path: c.file_path,
23            symbol_name: c.symbol_name,
24            kind: c.kind,
25            line: c.line,
26            signature: c.signature,
27            name_path: c.name_path,
28            score: c.score,
29        }
30    }
31}
32
33#[derive(Debug, Clone, Serialize, PartialEq, Eq)]
34pub struct EmbeddingIndexInfo {
35    pub model_name: String,
36    pub indexed_symbols: usize,
37}
38
39#[derive(Debug, Clone, Serialize, PartialEq, Eq)]
40pub struct EmbeddingRuntimeInfo {
41    pub runtime_preference: String,
42    pub backend: String,
43    pub threads: usize,
44    pub max_length: usize,
45    pub coreml_model_format: Option<String>,
46    pub coreml_compute_units: Option<String>,
47    pub coreml_static_input_shapes: Option<bool>,
48    pub coreml_profile_compute_plan: Option<bool>,
49    pub coreml_specialization_strategy: Option<String>,
50    pub coreml_model_cache_dir: Option<String>,
51    pub fallback_reason: Option<String>,
52}