pub struct RuntimeExecutor { /* private fields */ }Expand description
Runtime executor with plugin support.
This is the main entry point for making AI requests. It provides high-level APIs (generate_text, generate_object) that internally use the provider’s chat_completion API with appropriate strategy selection.
Implementations§
Source§impl RuntimeExecutor
impl RuntimeExecutor
Sourcepub fn builder<P: Provider>(provider: P) -> RuntimeExecutorBuilder<P>
pub fn builder<P: Provider>(provider: P) -> RuntimeExecutorBuilder<P>
Create a new builder
Sourcepub fn info(&self) -> Arc<ProviderInfo>
pub fn info(&self) -> Arc<ProviderInfo>
Get provider information
Sourcepub fn plugin_engine(&self) -> &PluginEngine
pub fn plugin_engine(&self) -> &PluginEngine
Get reference to the plugin engine
Sourcepub async fn generate_text(
&self,
model: impl Into<String>,
params: TextParams,
) -> Result<TextResult, AiError>
pub async fn generate_text( &self, model: impl Into<String>, params: TextParams, ) -> Result<TextResult, AiError>
Generate text using chat completion
This is a high-level API that converts the request to a chat completion request and extracts the text content from the response.
Sourcepub async fn generate_object(
&self,
model: impl Into<String>,
params: ObjectParams,
) -> Result<ObjectResult, AiError>
pub async fn generate_object( &self, model: impl Into<String>, params: ObjectParams, ) -> Result<ObjectResult, AiError>
Generate object using chat completion with JSON output
This is a high-level API that handles provider-specific JSON output strategies. It automatically selects the appropriate strategy (JSON Schema or JSON Mode) based on the provider capabilities.
Auto Trait Implementations§
impl Freeze for RuntimeExecutor
impl !RefUnwindSafe for RuntimeExecutor
impl Send for RuntimeExecutor
impl Sync for RuntimeExecutor
impl Unpin for RuntimeExecutor
impl !UnwindSafe for RuntimeExecutor
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more