pub struct GenerateRequest { /* private fields */ }Expand description
Generates text with the native endpoint. Build with Client::generate.
Implementations§
Source§impl GenerateRequest
impl GenerateRequest
Sourcepub fn gpu(self, gpu: impl Into<String>) -> Self
pub fn gpu(self, gpu: impl Into<String>) -> Self
Route to a machine profile, optionally pool-qualified as "pool/profile".
Sourcepub fn wait_for_capacity(self, wait: bool) -> Self
pub fn wait_for_capacity(self, wait: bool) -> Self
Whether to wait out provisioning and model loading, or fail fast.
Sourcepub fn provision_timeout(self, timeout: Duration) -> Self
pub fn provision_timeout(self, timeout: Duration) -> Self
Total wall-clock budget for this call, retries included.
Sourcepub fn max_oom_retries(self, retries: u32) -> Self
pub fn max_oom_retries(self, retries: u32) -> Self
Cap on RESOURCE_EXHAUSTED retries. Zero fails fast.
Sourcepub fn temperature(self, value: f64) -> Self
pub fn temperature(self, value: f64) -> Self
Sampling temperature.
Sourcepub fn frequency_penalty(self, value: f64) -> Self
pub fn frequency_penalty(self, value: f64) -> Self
Penalty applied per prior occurrence of a token.
Sourcepub fn presence_penalty(self, value: f64) -> Self
pub fn presence_penalty(self, value: f64) -> Self
Penalty applied once a token has appeared at all.
Sourcepub fn logit_bias(self, value: Value) -> Self
pub fn logit_bias(self, value: Value) -> Self
Per-token logit adjustments, as a {token_id: bias} object.
Sourcepub fn routing_key(self, value: impl Into<String>) -> Self
pub fn routing_key(self, value: impl Into<String>) -> Self
Pin related requests to the same worker, to reuse its prefix cache.
Sourcepub fn prompt_cache_key(self, value: impl Into<String>) -> Self
pub fn prompt_cache_key(self, value: impl Into<String>) -> Self
Explicit prefix-cache key.
Sourcepub fn safety_identifier(self, value: impl Into<String>) -> Self
pub fn safety_identifier(self, value: impl Into<String>) -> Self
End-user identifier forwarded to safety tooling.
Sourcepub fn lora_adapter(self, value: impl Into<String>) -> Self
pub fn lora_adapter(self, value: impl Into<String>) -> Self
LoRA adapter to apply.
Sourcepub fn stop(self, stop: impl IntoIterator<Item = impl Into<String>>) -> Self
pub fn stop(self, stop: impl IntoIterator<Item = impl Into<String>>) -> Self
Sequences that end the generation.
Sourcepub fn images(self, images: impl IntoIterator<Item = ImageInput>) -> Self
pub fn images(self, images: impl IntoIterator<Item = ImageInput>) -> Self
Attach images to a multimodal prompt.
Sourcepub fn extra_body(self, extra: Value) -> Self
pub fn extra_body(self, extra: Value) -> Self
Merge extra fields into the request body, overriding anything the builder set.
Sourcepub async fn send(self) -> Result<GenerateResult>
pub async fn send(self) -> Result<GenerateResult>
Send the request and wait for the whole generation.
Sourcepub async fn estimate(self) -> Result<CostEstimate>
pub async fn estimate(self) -> Result<CostEstimate>
Estimate what this request would cost.
Source§impl GenerateRequest
impl GenerateRequest
Sourcepub fn stream(self) -> Result<ChunkStream<GenerateChunk>>
pub fn stream(self) -> Result<ChunkStream<GenerateChunk>>
Stream the generation token by token.