pub trait CloudAiProvider: Send + Sync {
// Required methods
fn name(&self) -> &str;
fn env_var(&self) -> &str;
fn default_models(&self) -> &[&str];
fn invoke<'life0, 'life1, 'async_trait>(
&'life0 self,
req: &'life1 CloudAiRequest,
) -> Pin<Box<dyn Future<Output = Result<CloudAiResponse, CloudAiError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
// Provided methods
fn model_capabilities(&self) -> Vec<ModelCapabilityInfo> { ... }
fn category(&self) -> ProviderCategory { ... }
fn invoke_stream<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
req: &'life1 CloudAiRequest,
sink: &'life2 dyn LlmStreamSink,
) -> Pin<Box<dyn Future<Output = Result<CloudAiResponse, CloudAiError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait { ... }
fn invoke_tools<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
req: &'life1 CloudAiRequest,
_tools: &'life2 [ToolSpec],
_dispatcher: &'life3 dyn ToolDispatcher,
_max_iters: usize,
) -> Pin<Box<dyn Future<Output = Result<CloudAiResponse, CloudAiError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait { ... }
fn embed<'life0, 'life1, 'async_trait>(
&'life0 self,
_req: &'life1 CloudAiRequest,
) -> Pin<Box<dyn Future<Output = Result<EmbeddingResponse, CloudAiError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait { ... }
}Expand description
Cloud-AI provider abstraction. Cloud implementations make outbound
network calls - the egress is intentional and gated by the
allow_cloud_ai setting at the executor layer. Local implementations
target a user-configured localhost endpoint and are gated by
allow_local_ai.
Required Methods§
fn name(&self) -> &str
Sourcefn env_var(&self) -> &str
fn env_var(&self) -> &str
Convention-based environment variable name for this provider’s API key.
Sourcefn default_models(&self) -> &[&str]
fn default_models(&self) -> &[&str]
Default models suggested in the UI dropdown. Users can also type any model name the provider accepts.
fn invoke<'life0, 'life1, 'async_trait>(
&'life0 self,
req: &'life1 CloudAiRequest,
) -> Pin<Box<dyn Future<Output = Result<CloudAiResponse, CloudAiError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Provided Methods§
Sourcefn model_capabilities(&self) -> Vec<ModelCapabilityInfo>
fn model_capabilities(&self) -> Vec<ModelCapabilityInfo>
Per-model capability tags advertised to the UI, using the same
vocabulary as the Hub catalog (code | tool_use | reasoning | vision | embedding). The node inspector gates capability-specific fields (image
input, thinking, tool binding) on these the same way it does for local
models resolved from the Hub. Cloud providers override this; the default
advertises nothing, so the inspector falls back to showing every field.
Sourcefn category(&self) -> ProviderCategory
fn category(&self) -> ProviderCategory
Local vs cloud. Defaults to Cloud so existing providers need no
change; the local OpenAI-compatible provider overrides it.
Sourcefn invoke_stream<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
req: &'life1 CloudAiRequest,
sink: &'life2 dyn LlmStreamSink,
) -> Pin<Box<dyn Future<Output = Result<CloudAiResponse, CloudAiError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn invoke_stream<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
req: &'life1 CloudAiRequest,
sink: &'life2 dyn LlmStreamSink,
) -> Pin<Box<dyn Future<Output = Result<CloudAiResponse, CloudAiError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Streaming variant of invoke. Providers that support real
streaming override this to push tokens through sink as they
arrive; the default impl wraps invoke and emits a single
done = true event so non-streaming providers are still
observable on the chip without per-call branching at the call
site.
Implementations MUST emit exactly one event with done = true
(either with the final partial delta or alone), even on failure.
Sourcefn invoke_tools<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
req: &'life1 CloudAiRequest,
_tools: &'life2 [ToolSpec],
_dispatcher: &'life3 dyn ToolDispatcher,
_max_iters: usize,
) -> Pin<Box<dyn Future<Output = Result<CloudAiResponse, CloudAiError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
fn invoke_tools<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
req: &'life1 CloudAiRequest,
_tools: &'life2 [ToolSpec],
_dispatcher: &'life3 dyn ToolDispatcher,
_max_iters: usize,
) -> Pin<Box<dyn Future<Output = Result<CloudAiResponse, CloudAiError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Tool-use / function-calling loop. Providers that support tools override
this: they expose tools to the model, run each requested call through
dispatcher, feed the results back, and repeat until the model stops
asking (or max_iters is hit). The default ignores tools and does a
single invoke, so providers without tool support degrade gracefully.
Sourcefn embed<'life0, 'life1, 'async_trait>(
&'life0 self,
_req: &'life1 CloudAiRequest,
) -> Pin<Box<dyn Future<Output = Result<EmbeddingResponse, CloudAiError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn embed<'life0, 'life1, 'async_trait>(
&'life0 self,
_req: &'life1 CloudAiRequest,
) -> Pin<Box<dyn Future<Output = Result<EmbeddingResponse, CloudAiError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Embeddings call for task: "embedding". Providers with an embeddings
endpoint override this; the default reports the capability unsupported
(e.g. Anthropic exposes no embeddings API).