AiGenerator

Trait AiGenerator 

Source
pub trait AiGenerator: Send + Sync {
    // Required method
    fn generate<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        prompt: &'life1 str,
        config: &'life2 AiResponseConfig,
    ) -> Pin<Box<dyn Future<Output = Result<Value>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
}
Expand description

Trait for AI response generation

This trait allows the HTTP layer to provide custom AI generation implementations without creating circular dependencies between crates.

Required Methods§

Source

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

Generate an AI response from a prompt

§Arguments
  • prompt - The expanded prompt to send to the LLM
  • config - The AI response configuration with temperature, max_tokens, etc.
§Returns

A JSON value containing the generated response

Implementors§