pub struct GenerateRequest {
pub request_id: RequestId,
pub model: Option<ModelId>,
pub prompt: PromptInput,
pub sampling: SamplingParams,
pub stream: bool,
pub echo: bool,
pub n: u32,
pub logprobs: Option<u32>,
}Expand description
Request for text generation.
Fields§
§request_id: RequestIdUnique request identifier.
model: Option<ModelId>Model to use for generation.
prompt: PromptInputInput prompt.
sampling: SamplingParamsSampling parameters.
stream: boolWhether to stream the response.
echo: boolWhether to echo the prompt in the response.
n: u32Number of completions to generate.
logprobs: Option<u32>Include log probabilities for top tokens.
Implementations§
Source§impl GenerateRequest
impl GenerateRequest
Sourcepub fn new(prompt: impl Into<PromptInput>) -> Self
pub fn new(prompt: impl Into<PromptInput>) -> Self
Creates a new generation request with the given prompt.
Sourcepub fn with_model(self, model: impl Into<ModelId>) -> Self
pub fn with_model(self, model: impl Into<ModelId>) -> Self
Sets the model to use.
Sourcepub fn with_sampling(self, sampling: SamplingParams) -> Self
pub fn with_sampling(self, sampling: SamplingParams) -> Self
Sets the sampling parameters.
Sourcepub fn with_stream(self) -> Self
pub fn with_stream(self) -> Self
Enables streaming.
Sourcepub fn with_logprobs(self, top_logprobs: u32) -> Self
pub fn with_logprobs(self, top_logprobs: u32) -> Self
Enables log probabilities.
Trait Implementations§
Source§impl Clone for GenerateRequest
impl Clone for GenerateRequest
Source§fn clone(&self) -> GenerateRequest
fn clone(&self) -> GenerateRequest
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for GenerateRequest
impl Debug for GenerateRequest
Source§impl<'de> Deserialize<'de> for GenerateRequest
impl<'de> Deserialize<'de> for GenerateRequest
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for GenerateRequest
impl RefUnwindSafe for GenerateRequest
impl Send for GenerateRequest
impl Sync for GenerateRequest
impl Unpin for GenerateRequest
impl UnwindSafe for GenerateRequest
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