GenerateRequest

Struct GenerateRequest 

Source
pub struct GenerateRequest {
Show 35 fields pub text: Option<String>, pub model: Option<String>, pub input_ids: Option<InputIds>, pub input_embeds: Option<Value>, pub image_data: Option<Value>, pub video_data: Option<Value>, pub audio_data: Option<Value>, pub sampling_params: Option<SamplingParams>, pub return_logprob: Option<bool>, pub logprob_start_len: Option<i32>, pub top_logprobs_num: Option<i32>, pub token_ids_logprob: Option<Vec<u32>>, pub return_text_in_logprobs: bool, pub stream: bool, pub log_metrics: bool, pub return_hidden_states: bool, pub modalities: Option<Vec<String>>, pub session_params: Option<HashMap<String, Value>>, pub lora_path: Option<String>, pub lora_id: Option<String>, pub custom_logit_processor: Option<String>, pub bootstrap_host: Option<String>, pub bootstrap_port: Option<i32>, pub bootstrap_room: Option<i32>, pub bootstrap_pair_key: Option<String>, pub data_parallel_rank: Option<i32>, pub background: bool, pub conversation_id: Option<String>, pub priority: Option<i32>, pub extra_key: Option<String>, pub no_logs: bool, pub custom_labels: Option<HashMap<String, String>>, pub return_bytes: bool, pub return_entropy: bool, pub rid: Option<String>,
}

Fields§

§text: Option<String>

Text input - SGLang native format

§model: Option<String>§input_ids: Option<InputIds>

Input IDs for tokenized input

§input_embeds: Option<Value>

Input embeddings for direct embedding input Can be a 2D array (single request) or 3D array (batch of requests) Placeholder for future use

§image_data: Option<Value>

Image input data Can be an image instance, file name, URL, or base64 encoded string Supports single images, lists of images, or nested lists for batch processing Placeholder for future use

§video_data: Option<Value>

Video input data Can be a file name, URL, or base64 encoded string Supports single videos, lists of videos, or nested lists for batch processing Placeholder for future use

§audio_data: Option<Value>

Audio input data Can be a file name, URL, or base64 encoded string Supports single audio files, lists of audio, or nested lists for batch processing Placeholder for future use

§sampling_params: Option<SamplingParams>

Sampling parameters (sglang style)

§return_logprob: Option<bool>

Whether to return logprobs

§logprob_start_len: Option<i32>

If return logprobs, the start location in the prompt for returning logprobs.

§top_logprobs_num: Option<i32>

If return logprobs, the number of top logprobs to return at each position.

§token_ids_logprob: Option<Vec<u32>>

If return logprobs, the token ids to return logprob for.

§return_text_in_logprobs: bool

Whether to detokenize tokens in text in the returned logprobs.

§stream: bool

Whether to stream the response

§log_metrics: bool

Whether to log metrics for this request (e.g. health_generate calls do not log metrics)

§return_hidden_states: bool

Return model hidden states

§modalities: Option<Vec<String>>

The modalities of the image data [image, multi-images, video]

§session_params: Option<HashMap<String, Value>>

Session parameters for continual prompting

§lora_path: Option<String>

Path to LoRA adapter(s) for model customization

§lora_id: Option<String>

LoRA adapter ID (if pre-loaded)

§custom_logit_processor: Option<String>

Custom logit processor for advanced sampling control. Must be a serialized instance of CustomLogitProcessor in python/sglang/srt/sampling/custom_logit_processor.py Use the processor’s to_str() method to generate the serialized string.

§bootstrap_host: Option<String>

For disaggregated inference

§bootstrap_port: Option<i32>

For disaggregated inference

§bootstrap_room: Option<i32>

For disaggregated inference

§bootstrap_pair_key: Option<String>

For disaggregated inference

§data_parallel_rank: Option<i32>

Data parallel rank routing

§background: bool

Background response

§conversation_id: Option<String>

Conversation ID for tracking

§priority: Option<i32>

Priority for the request

§extra_key: Option<String>

Extra key for classifying the request (e.g. cache_salt)

§no_logs: bool

Whether to disallow logging for this request (e.g. due to ZDR)

§custom_labels: Option<HashMap<String, String>>

Custom metric labels

§return_bytes: bool

Whether to return bytes for image generation

§return_entropy: bool

Whether to return entropy

§rid: Option<String>

Request ID for tracking (inherited from BaseReq in Python)

Trait Implementations§

Source§

impl Clone for GenerateRequest

Source§

fn clone(&self) -> GenerateRequest

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for GenerateRequest

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for GenerateRequest

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl GenerationRequest for GenerateRequest

Source§

fn is_stream(&self) -> bool

Check if the request is for streaming
Source§

fn get_model(&self) -> Option<&str>

Get the model name if specified
Source§

fn extract_text_for_routing(&self) -> String

Extract text content for routing decisions
Source§

impl Normalizable for GenerateRequest

Source§

fn normalize(&mut self)

Normalize the request by applying defaults and transformations
Source§

impl Serialize for GenerateRequest

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl Validate for GenerateRequest

Source§

impl<'v_a> ValidateArgs<'v_a> for GenerateRequest

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<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

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
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,