Model

Trait Model 

Source
pub trait Model: Send + Sync {
    // Required method
    fn generate<'life0, 'life1, 'async_trait>(
        &'life0 self,
        prompt: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<String, AgentError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;

    // Provided method
    fn get_response<'life0, 'life1, 'life2, 'life3, 'life4, 'life5, 'life6, 'life7, 'life8, 'async_trait>(
        &'life0 self,
        system_instructions: Option<&'life1 str>,
        input: &'life2 str,
        _model_settings: Option<HashMap<String, String>>,
        _messages: Option<&'life3 [Value]>,
        _tools: Option<&'life4 [Value]>,
        _tool_choice: Option<Value>,
        _output_schema: Option<&'life5 str>,
        _handoffs: Option<&'life6 [String]>,
        _tracing_enabled: bool,
        _previous_response_id: Option<&'life7 str>,
        _prompt_config: Option<&'life8 str>,
    ) -> Pin<Box<dyn Future<Output = Result<ModelResponse, AgentError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait,
             'life3: 'async_trait,
             'life4: 'async_trait,
             'life5: 'async_trait,
             'life6: 'async_trait,
             'life7: 'async_trait,
             'life8: 'async_trait { ... }
}
Expand description

Core trait for all model implementations.

Required Methods§

Source

fn generate<'life0, 'life1, 'async_trait>( &'life0 self, prompt: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<String, AgentError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Perform a generation request and return the raw response as a string.

Provided Methods§

Source

fn get_response<'life0, 'life1, 'life2, 'life3, 'life4, 'life5, 'life6, 'life7, 'life8, 'async_trait>( &'life0 self, system_instructions: Option<&'life1 str>, input: &'life2 str, _model_settings: Option<HashMap<String, String>>, _messages: Option<&'life3 [Value]>, _tools: Option<&'life4 [Value]>, _tool_choice: Option<Value>, _output_schema: Option<&'life5 str>, _handoffs: Option<&'life6 [String]>, _tracing_enabled: bool, _previous_response_id: Option<&'life7 str>, _prompt_config: Option<&'life8 str>, ) -> Pin<Box<dyn Future<Output = Result<ModelResponse, AgentError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait, 'life4: 'async_trait, 'life5: 'async_trait, 'life6: 'async_trait, 'life7: 'async_trait, 'life8: 'async_trait,

Rich response method (scaffold) to align with Python’s get_response signature. Default implementation wraps generate with a simple string prompt.

Implementors§