pub struct WorkflowProvider<P> { /* private fields */ }Expand description
LLM provider wrapper that tracks costs per workflow
Implementations§
Source§impl<P> WorkflowProvider<P>
impl<P> WorkflowProvider<P>
Sourcepub fn new(
provider: P,
tracker: WorkflowTracker,
workflow_id: String,
budget: Option<BudgetLimit>,
) -> Self
pub fn new( provider: P, tracker: WorkflowTracker, workflow_id: String, budget: Option<BudgetLimit>, ) -> Self
Create a new workflow provider
Sourcepub fn with_pricing(self, pricing: ModelPricing) -> Self
pub fn with_pricing(self, pricing: ModelPricing) -> Self
Set the pricing model for cost calculation
Sourcepub fn tracker(&self) -> &WorkflowTracker
pub fn tracker(&self) -> &WorkflowTracker
Get the workflow tracker
Sourcepub fn workflow_id(&self) -> &str
pub fn workflow_id(&self) -> &str
Get the workflow ID
Sourcepub fn stats(&self) -> WorkflowStats
pub fn stats(&self) -> WorkflowStats
Get statistics for this workflow
Trait Implementations§
Source§impl<P: LlmProvider> LlmProvider for WorkflowProvider<P>
impl<P: LlmProvider> LlmProvider for WorkflowProvider<P>
fn complete<'life0, 'async_trait>(
&'life0 self,
request: LlmRequest,
) -> Pin<Box<dyn Future<Output = Result<LlmResponse>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Source§impl<P: StreamingLlmProvider> StreamingLlmProvider for WorkflowProvider<P>
impl<P: StreamingLlmProvider> StreamingLlmProvider for WorkflowProvider<P>
Source§fn complete_stream<'life0, 'async_trait>(
&'life0 self,
request: LlmRequest,
) -> Pin<Box<dyn Future<Output = Result<LlmStream>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn complete_stream<'life0, 'async_trait>(
&'life0 self,
request: LlmRequest,
) -> Pin<Box<dyn Future<Output = Result<LlmStream>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Stream completion responses token-by-token
Auto Trait Implementations§
impl<P> Freeze for WorkflowProvider<P>where
P: Freeze,
impl<P> RefUnwindSafe for WorkflowProvider<P>where
P: RefUnwindSafe,
impl<P> Send for WorkflowProvider<P>where
P: Send,
impl<P> Sync for WorkflowProvider<P>where
P: Sync,
impl<P> Unpin for WorkflowProvider<P>where
P: Unpin,
impl<P> UnwindSafe for WorkflowProvider<P>where
P: UnwindSafe,
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