pub struct CloudProvider { /* private fields */ }Expand description
Frontier LLM cloud backend. Construct one per session; it owns a
reqwest::blocking::Client that reuses the TCP connection pool.
§Air-gap guarantee (ADR-004)
A CloudProvider is only ever created if the host app explicitly opts
in. Apps that never construct this type have zero outbound network surface.
§Event emission (ADR-010)
After each successful chat() or chat_stream() call, emits
DomainEvent::FrontierLlmConsulted via the optional sink registered
with CloudProvider::with_event_sink.
Implementations§
Source§impl CloudProvider
impl CloudProvider
Sourcepub fn new() -> Self
pub fn new() -> Self
Builds the provider with explicit network timeouts: [CONNECT_TIMEOUT]
for the handshake, [IDLE_TIMEOUT] per read (stream-friendly), and a
[REQUEST_TIMEOUT] total applied per non-streaming request. A stalled
provider can therefore never block an FFI caller indefinitely.
Sourcepub fn with_event_sink(
self,
sink: impl Fn(DomainEvent) + Send + Sync + 'static,
) -> Self
pub fn with_event_sink( self, sink: impl Fn(DomainEvent) + Send + Sync + 'static, ) -> Self
Register a callback that receives DomainEvents (e.g. to feed a
[el_telemetry::MetricsCollector]).
Trait Implementations§
Source§impl Default for CloudProvider
impl Default for CloudProvider
Source§impl LlmProvider for CloudProvider
impl LlmProvider for CloudProvider
Source§fn chat(&self, req: &ChatRequest) -> Result<ChatResponse>
fn chat(&self, req: &ChatRequest) -> Result<ChatResponse>
Source§fn chat_stream(
&self,
req: &ChatRequest,
on_token: &mut dyn FnMut(ChatToken),
) -> Result<()>
fn chat_stream( &self, req: &ChatRequest, on_token: &mut dyn FnMut(ChatToken), ) -> Result<()>
on_token for each fragment as it arrives.
Returns when generation is complete or on error. The final call will
have ChatToken::is_final == true.