pub struct ScriptedTasks { /* private fields */ }Expand description
Answers each task from its own queue of JSON documents.
Implementations§
Source§impl ScriptedTasks
impl ScriptedTasks
Sourcepub fn new(provider: impl Into<ProviderKey>, model: impl Into<ModelKey>) -> Self
pub fn new(provider: impl Into<ProviderKey>, model: impl Into<ModelKey>) -> Self
A provider with native schema support and no answers yet.
Sourcepub fn answer(self, task: &str, answer: Value) -> Self
pub fn answer(self, task: &str, answer: Value) -> Self
Queues answer for the task or call task.
Sourcepub fn failing(self, task: &str, error: ProviderError) -> Self
pub fn failing(self, task: &str, error: ProviderError) -> Self
Queues a provider failure for the task or call task.
Sourcepub fn tagged(self, tag: impl Into<String>) -> Self
pub fn tagged(self, tag: impl Into<String>) -> Self
Adds a tag to the profile, for routing by tag.
Sourcepub fn calls(&self) -> Vec<ModelRequest>
pub fn calls(&self) -> Vec<ModelRequest>
Every request received, in order.
Sourcepub fn unanswered(&self) -> Vec<String>
pub fn unanswered(&self) -> Vec<String>
Tasks with answers never asked for.
Trait Implementations§
Source§impl Debug for ScriptedTasks
impl Debug for ScriptedTasks
Source§impl ModelProvider for ScriptedTasks
impl ModelProvider for ScriptedTasks
Source§fn provider_key(&self) -> ProviderKey
fn provider_key(&self) -> ProviderKey
The configured provider key, e.g.
"openai". Labels every metric,
attempt record and replay entry this provider produces.Source§fn capabilities(&self) -> ProviderCapabilities
fn capabilities(&self) -> ProviderCapabilities
What this provider-model pair can actually do (spec §20.3). Read more
Source§fn profile(&self) -> ModelProfile
fn profile(&self) -> ModelProfile
The full routing profile: keys, capabilities, and the cost, region and
tags routing filters on. Read more
Source§fn generate<'life0, 'async_trait>(
&'life0 self,
request: ModelRequest,
) -> Pin<Box<dyn Future<Output = Result<ModelResponse, ProviderError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn generate<'life0, 'async_trait>(
&'life0 self,
request: ModelRequest,
) -> Pin<Box<dyn Future<Output = Result<ModelResponse, ProviderError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Runs one model call and returns the whole answer. Read more
Source§fn reference(&self) -> ModelRef
fn reference(&self) -> ModelRef
The provider-model pair, as routing and health tracking key it.
Source§fn supports(
&self,
requirements: &CapabilityRequirements,
) -> Result<(), CapabilityMismatch>
fn supports( &self, requirements: &CapabilityRequirements, ) -> Result<(), CapabilityMismatch>
Checks the declared capabilities against
requirements. Read moreSource§fn stream<'life0, 'async_trait>(
&'life0 self,
request: ModelRequest,
) -> Pin<Box<dyn Future<Output = Result<ModelStream, ProviderError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
fn stream<'life0, 'async_trait>(
&'life0 self,
request: ModelRequest,
) -> Pin<Box<dyn Future<Output = Result<ModelStream, ProviderError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
Runs one model call and returns its answer incrementally. Read more
Auto Trait Implementations§
impl !Freeze for ScriptedTasks
impl RefUnwindSafe for ScriptedTasks
impl Send for ScriptedTasks
impl Sync for ScriptedTasks
impl Unpin for ScriptedTasks
impl UnsafeUnpin for ScriptedTasks
impl UnwindSafe for ScriptedTasks
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