pub trait ModelExecutor: Send + Sync {
// Required methods
fn execute<'life0, 'async_trait>(
&'life0 self,
request: Value,
) -> Pin<Box<dyn Future<Output = Result<MessageResponse, String>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn open_stream<'life0, 'async_trait>(
&'life0 self,
request: Value,
) -> Pin<Box<dyn Future<Output = Result<Box<dyn ModelStream>, String>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
}Expand description
Performs a model call on behalf of a client-driven run. Injected by the
embedding binary, exactly like AgentFactory.
Required Methods§
Sourcefn execute<'life0, 'async_trait>(
&'life0 self,
request: Value,
) -> Pin<Box<dyn Future<Output = Result<MessageResponse, String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn execute<'life0, 'async_trait>(
&'life0 self,
request: Value,
) -> Pin<Box<dyn Future<Output = Result<MessageResponse, String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Perform a single (non-streaming) model call and return the response.
§Errors
A human message when the provider call fails. The server maps it to the error envelope and records no completion.
Sourcefn open_stream<'life0, 'async_trait>(
&'life0 self,
request: Value,
) -> Pin<Box<dyn Future<Output = Result<Box<dyn ModelStream>, String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn open_stream<'life0, 'async_trait>(
&'life0 self,
request: Value,
) -> Pin<Box<dyn Future<Output = Result<Box<dyn ModelStream>, String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Open a streaming model call, returning a ModelStream of provider
events the server pumps for the live ticker.
§Errors
A human message when the stream cannot be opened.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".