1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
//! In-process embedder client — wraps `trusty_common::embedder::FastEmbedder`.
//!
//! Why: the default mode for existing deployments; no external process needed,
//! zero change in observable behaviour. Users who have not set
//! `TRUSTY_EMBEDDER` get this path automatically.
//!
//! What: `InProcessEmbedderClient` holds an `Arc<FastEmbedder>` and delegates
//! `embed_batch` to the underlying `trusty_common::embedder::Embedder` trait
//! impl. The conversion from `anyhow::Error` to `EmbedderError::ModelError`
//! preserves the error message for logs.
//!
//! Test: `in_process_embed_batch_empty` (unit, no model required) verifies
//! the happy-path zero-input case. ONNX-backed round-trip is covered by the
//! `bit_identical` integration test in `trusty-embedderd`.
use Arc;
use async_trait;
use crateFastEmbedder;
use ;
/// Embedder client backed by the in-process ONNX `FastEmbedder`.
///
/// Why: preserves the existing trusty-search behaviour for users who have not
/// opted into the standalone `trusty-embedderd` process. Wrapping the
/// `FastEmbedder` behind the `EmbedderClient` trait means trusty-search's
/// call sites are identical regardless of which concrete implementation is
/// active.
///
/// What: holds a shared `Arc<FastEmbedder>` so multiple callers (e.g. the
/// embed pool workers) can clone the client without re-loading the model.
///
/// Test: `in_process_embed_batch_empty` below; ONNX tests are
/// `#[ignore]`-tagged in `trusty-embedderd/tests/bit_identical.rs`.