Skip to main content

GenerateRequest

Struct GenerateRequest 

Source
pub struct GenerateRequest { /* private fields */ }
Expand description

Generates text with the native endpoint. Build with Client::generate.

Implementations§

Source§

impl GenerateRequest

Source

pub fn gpu(self, gpu: impl Into<String>) -> Self

Route to a machine profile, optionally pool-qualified as "pool/profile".

Source

pub fn wait_for_capacity(self, wait: bool) -> Self

Whether to wait out provisioning and model loading, or fail fast.

Source

pub fn provision_timeout(self, timeout: Duration) -> Self

Total wall-clock budget for this call, retries included.

Source

pub fn max_oom_retries(self, retries: u32) -> Self

Cap on RESOURCE_EXHAUSTED retries. Zero fails fast.

Source

pub fn temperature(self, value: f64) -> Self

Sampling temperature.

Source

pub fn top_p(self, value: f64) -> Self

Nucleus sampling cutoff.

Source

pub fn frequency_penalty(self, value: f64) -> Self

Penalty applied per prior occurrence of a token.

Source

pub fn presence_penalty(self, value: f64) -> Self

Penalty applied once a token has appeared at all.

Source

pub fn grammar(self, value: Grammar) -> Self

Constrain the output’s shape.

Source

pub fn seed(self, value: i64) -> Self

Seed the sampler for reproducible output.

Source

pub fn logit_bias(self, value: Value) -> Self

Per-token logit adjustments, as a {token_id: bias} object.

Source

pub fn options(self, value: Value) -> Self

Adapter-specific runtime options.

Source

pub fn routing_key(self, value: impl Into<String>) -> Self

Pin related requests to the same worker, to reuse its prefix cache.

Source

pub fn prompt_cache_key(self, value: impl Into<String>) -> Self

Explicit prefix-cache key.

Source

pub fn safety_identifier(self, value: impl Into<String>) -> Self

End-user identifier forwarded to safety tooling.

Source

pub fn lora_adapter(self, value: impl Into<String>) -> Self

LoRA adapter to apply.

Source

pub fn stop(self, stop: impl IntoIterator<Item = impl Into<String>>) -> Self

Sequences that end the generation.

Source

pub fn images(self, images: impl IntoIterator<Item = ImageInput>) -> Self

Attach images to a multimodal prompt.

Source

pub fn extra_body(self, extra: Value) -> Self

Merge extra fields into the request body, overriding anything the builder set.

Source

pub async fn send(self) -> Result<GenerateResult>

Send the request and wait for the whole generation.

Source

pub async fn estimate(self) -> Result<CostEstimate>

Estimate what this request would cost.

Source§

impl GenerateRequest

Source

pub fn stream(self) -> Result<ChunkStream<GenerateChunk>>

Stream the generation token by token.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more