pub trait InferenceEngine:
Send
+ Sync
+ 'static {
// Required methods
fn id(&self) -> InferenceEngineId;
fn capabilities(&self) -> InferenceCapabilities;
fn list_models<'life0, 'life1, 'async_trait>(
&'life0 self,
ctx: InferenceProviderContext<'life1>,
) -> Pin<Box<dyn Future<Output = Result<Vec<ModelDescriptor>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn stream_turn<'life0, 'life1, 'async_trait>(
&'life0 self,
ctx: InferenceTurnContext<'life1>,
request: AgentInferenceRequest,
) -> Pin<Box<dyn Future<Output = Result<InferenceEventStream>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
// Provided methods
fn metadata(&self) -> InferenceProviderMetadata { ... }
fn tool_result_image_input(&self, _model: &str) -> bool { ... }
fn requires_native_compaction(&self) -> bool { ... }
fn compact_turn<'life0, 'life1, 'async_trait>(
&'life0 self,
_ctx: InferenceTurnContext<'life1>,
_request: AgentInferenceRequest,
) -> Pin<Box<dyn Future<Output = Result<Option<InferenceEventStream>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait { ... }
}Required Methods§
fn id(&self) -> InferenceEngineId
fn capabilities(&self) -> InferenceCapabilities
fn list_models<'life0, 'life1, 'async_trait>(
&'life0 self,
ctx: InferenceProviderContext<'life1>,
) -> Pin<Box<dyn Future<Output = Result<Vec<ModelDescriptor>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn stream_turn<'life0, 'life1, 'async_trait>(
&'life0 self,
ctx: InferenceTurnContext<'life1>,
request: AgentInferenceRequest,
) -> Pin<Box<dyn Future<Output = Result<InferenceEventStream>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Provided Methods§
fn metadata(&self) -> InferenceProviderMetadata
Sourcefn tool_result_image_input(&self, _model: &str) -> bool
fn tool_result_image_input(&self, _model: &str) -> bool
Whether this engine puts the image a tool result carries under
crate::transcript::VIEW_IMAGE_DISPLAY_KEY in front of model.
This is separate from InferenceCapabilities::image_input, which is
about images the user attaches. An engine returns true only when its
request mapping forwards tool-result images. Everywhere else the
runtime sends the request without the image, appends a one-line notice
to that tool result, hides screenshot-only tools and does not charge
image tokens for it. The stored transcript is never changed, so
switching to an engine that returns true shows it the same images.
Sourcefn requires_native_compaction(&self) -> bool
fn requires_native_compaction(&self) -> bool
Whether compaction must remain provider-owned, without local pruning or text-summary fallback. Native failures propagate to the caller.
Sourcefn compact_turn<'life0, 'life1, 'async_trait>(
&'life0 self,
_ctx: InferenceTurnContext<'life1>,
_request: AgentInferenceRequest,
) -> Pin<Box<dyn Future<Output = Result<Option<InferenceEventStream>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn compact_turn<'life0, 'life1, 'async_trait>(
&'life0 self,
_ctx: InferenceTurnContext<'life1>,
_request: AgentInferenceRequest,
) -> Pin<Box<dyn Future<Output = Result<Option<InferenceEventStream>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Native, opaque provider compaction. Unsupported engines return None. The stream must publish a completed boundary and one terminal completion.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".