pub trait LowLevelClient:
Send
+ Sync
+ Debug {
// Required methods
fn ask_raw<'life0, 'async_trait>(
&'life0 self,
prompt: String,
) -> Pin<Box<dyn Future<Output = Result<String, AIError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn clone_box(&self) -> Box<dyn LowLevelClient>;
// Provided method
fn ask_json<'life0, 'async_trait>(
&'life0 self,
prompt: String,
) -> Pin<Box<dyn Future<Output = Result<String, AIError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait { ... }
}
Expand description
Low-level client trait that only requires implementing ask_raw. This trait can be used as dyn LowLevelClient for dynamic dispatch. JSON processing is handled by utility functions with a convenience method.
Required Methods§
Sourcefn ask_raw<'life0, 'async_trait>(
&'life0 self,
prompt: String,
) -> Pin<Box<dyn Future<Output = Result<String, AIError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn ask_raw<'life0, 'async_trait>(
&'life0 self,
prompt: String,
) -> Pin<Box<dyn Future<Output = Result<String, AIError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
The only method that implementations must provide
Sourcefn clone_box(&self) -> Box<dyn LowLevelClient>
fn clone_box(&self) -> Box<dyn LowLevelClient>
Clone this client into a boxed trait object
Provided Methods§
Trait Implementations§
Source§impl Clone for Box<dyn LowLevelClient>
impl Clone for Box<dyn LowLevelClient>
Source§impl LowLevelClient for Box<dyn LowLevelClient>
impl LowLevelClient for Box<dyn LowLevelClient>
Source§fn ask_raw<'life0, 'async_trait>(
&'life0 self,
prompt: String,
) -> Pin<Box<dyn Future<Output = Result<String, AIError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn ask_raw<'life0, 'async_trait>(
&'life0 self,
prompt: String,
) -> Pin<Box<dyn Future<Output = Result<String, AIError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
The only method that implementations must provide
Source§fn clone_box(&self) -> Box<dyn LowLevelClient>
fn clone_box(&self) -> Box<dyn LowLevelClient>
Clone this client into a boxed trait object