pub struct ScriptedProviderBuilder { /* private fields */ }Expand description
Collects steps and capabilities for a ScriptedProvider.
Implementations§
Source§impl ScriptedProviderBuilder
impl ScriptedProviderBuilder
Sourcepub fn capabilities(self, capabilities: ProviderCapabilities) -> Self
pub fn capabilities(self, capabilities: ProviderCapabilities) -> Self
Declares capabilities, replacing the defaults.
They may be dishonest on purpose: a test of the no-silent-downgrade rule needs a profile that claims more than it delivers.
Sourcepub fn streaming(self) -> Self
pub fn streaming(self) -> Self
Declares streaming support, which ModelProvider::stream refuses
without.
Sourcepub fn structured_output(self, capability: StructuredOutputCapability) -> Self
pub fn structured_output(self, capability: StructuredOutputCapability) -> Self
Declares a structured-output transport.
Sourcepub fn region(self, region: impl Into<String>) -> Self
pub fn region(self, region: impl Into<String>) -> Self
Declares a region, so residency routing can be exercised.
Sourcepub fn cost(self, input: MicroCents, output: MicroCents) -> Self
pub fn cost(self, input: MicroCents, output: MicroCents) -> Self
Declares per-million prices, so cost ceilings can be exercised.
Sourcepub fn usage(self, usage: TokenUsage) -> Self
pub fn usage(self, usage: TokenUsage) -> Self
Reports this usage on every successful answer.
Sourcepub fn latency(self, latency: Duration) -> Self
pub fn latency(self, latency: Duration) -> Self
Reports this latency on every successful answer.
Sourcepub fn step(self, step: ScriptStep) -> Self
pub fn step(self, step: ScriptStep) -> Self
Appends one step.
Sourcepub fn reply(self, reply: ScriptedReply) -> Self
pub fn reply(self, reply: ScriptedReply) -> Self
Appends a reply that accepts any purpose.
Sourcepub fn reply_to(self, purpose: ModelPurpose, reply: ScriptedReply) -> Self
pub fn reply_to(self, purpose: ModelPurpose, reply: ScriptedReply) -> Self
Appends a reply that only accepts calls made for purpose.
Sourcepub fn acknowledging(self, text: impl Into<String>) -> Self
pub fn acknowledging(self, text: impl Into<String>) -> Self
Appends the acknowledgement a turn writes, text, and the review that passes it.
Sourcepub fn malformed_json(self, body: impl Into<String>) -> Self
pub fn malformed_json(self, body: impl Into<String>) -> Self
Appends a body that is not JSON.
Sourcepub fn timing_out(self) -> Self
pub fn timing_out(self) -> Self
Appends a timeout.
Sourcepub fn rate_limited(self, retry_after: Option<Duration>) -> Self
pub fn rate_limited(self, retry_after: Option<Duration>) -> Self
Appends a rate limit.
Sourcepub fn failing(self, error: ProviderError) -> Self
pub fn failing(self, error: ProviderError) -> Self
Appends a normalized failure.
Sourcepub fn streaming_chunks<I, S>(self, chunks: I) -> Self
pub fn streaming_chunks<I, S>(self, chunks: I) -> Self
Appends a stream delivered in these chunks.
Sourcepub fn build(self) -> ScriptedProvider
pub fn build(self) -> ScriptedProvider
Builds the provider.
Builds the provider behind an Arc, the shape routing and fallback
take.