pub trait DirectDataFetcher: Send + Sync {
// Required method
fn try_fetch<'life0, 'life1, 'async_trait>(
&'life0 self,
utterance: &'life1 str,
) -> Pin<Box<dyn Future<Output = Option<Result<String, String>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
}Expand description
Foreign-implemented data fetcher. When attached, the sidecar task
gives this fetcher the utterance first; on Some(Ok(text)) the
LLM is skipped entirely and the text becomes the sidecar’s answer.
On None (no match) or Some(Err(e)) (match but fetch failed),
the sidecar falls through to the LLM path. Use this for the
“fast data path” optimization in quip’s playbook: email/calendar
queries that are pure data lookups don’t need an LLM round trip.
Implementations are typically host-side (calendar API, mail API)
and should already format their output for voice narration —
short, no markdown. See car_voice::format_for_voice for a
minimal helper.
Required Methods§
Sourcefn try_fetch<'life0, 'life1, 'async_trait>(
&'life0 self,
utterance: &'life1 str,
) -> Pin<Box<dyn Future<Output = Option<Result<String, String>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn try_fetch<'life0, 'life1, 'async_trait>(
&'life0 self,
utterance: &'life1 str,
) -> Pin<Box<dyn Future<Output = Option<Result<String, String>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Try to satisfy the utterance directly without invoking the LLM.
Some(Ok(text))→ use this as the sidecar answer.Some(Err(msg))→ match recognised but fetch failed; fall through to LLM (msg is logged, not surfaced).None→ not a fast-data candidate; fall through to LLM.