pub struct RuntimeExecutorBuilder<P> { /* private fields */ }Expand description
Builder for composing AI providers with layers and plugins.
This builder allows for flexible composition following OpenDAL’s pattern:
- Layers wrap the provider (static dispatch during building)
- Plugins extend the runtime (stored for execution)
§Example
ⓘ
let executor = RuntimeExecutor::builder(openai_provider)
.layer(LoggingLayer::new())
.layer(RetryLayer::new())
.plugin(Arc::new(ToolUsePlugin::new()))
.finish();Implementations§
Source§impl<P: Provider> RuntimeExecutorBuilder<P>
impl<P: Provider> RuntimeExecutorBuilder<P>
Sourcepub fn layer<L>(self, layer: L) -> RuntimeExecutorBuilder<L::LayeredProvider>where
L: Layer<P>,
pub fn layer<L>(self, layer: L) -> RuntimeExecutorBuilder<L::LayeredProvider>where
L: Layer<P>,
Add a layer to wrap the provider
This uses static dispatch - each call to layer() creates a new
concrete type by wrapping the previous provider.
Sourcepub fn json_strategy(self, strategy: Box<dyn JsonOutputStrategy>) -> Self
pub fn json_strategy(self, strategy: Box<dyn JsonOutputStrategy>) -> Self
Set a custom JSON output strategy
If not set, the strategy will be auto-detected based on the provider ID.
Sourcepub fn finish(self) -> RuntimeExecutor
pub fn finish(self) -> RuntimeExecutor
Finish building and create a RuntimeExecutor
Auto Trait Implementations§
impl<P> Freeze for RuntimeExecutorBuilder<P>where
P: Freeze,
impl<P> !RefUnwindSafe for RuntimeExecutorBuilder<P>
impl<P> Send for RuntimeExecutorBuilder<P>where
P: Send,
impl<P> Sync for RuntimeExecutorBuilder<P>where
P: Sync,
impl<P> Unpin for RuntimeExecutorBuilder<P>where
P: Unpin,
impl<P> !UnwindSafe for RuntimeExecutorBuilder<P>
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