pub struct Prompt {
pub instruction: String,
pub input: String,
pub max_output_tokens: u32,
pub temperature: f32,
}Expand description
What the application asks a model to do.
Deliberately not a chat transcript: most product features are one instruction over one piece of content, and modelling them as conversations invites state nobody needs.
Fields§
§instruction: StringWhat the model should do.
input: StringWhat it should do it to.
max_output_tokens: u32Upper bound on the answer. A product that does not cap this is one bad prompt away from a surprising bill.
temperature: f320.0 for extraction and classification, higher for drafting.
Implementations§
Source§impl Prompt
impl Prompt
Sourcepub fn new(instruction: impl Into<String>, input: impl Into<String>) -> Self
pub fn new(instruction: impl Into<String>, input: impl Into<String>) -> Self
A deterministic prompt: temperature zero, short answer.
The right default for classification and extraction, which is most of what a desktop application actually needs.
pub fn with_max_output_tokens(self, max_output_tokens: u32) -> Self
Sourcepub fn with_temperature(self, temperature: f32) -> Self
pub fn with_temperature(self, temperature: f32) -> Self
Allow variation. Use for drafting, never for extraction.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Prompt
impl<'de> Deserialize<'de> for Prompt
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 Prompt
impl RefUnwindSafe for Prompt
impl Send for Prompt
impl Sync for Prompt
impl Unpin for Prompt
impl UnsafeUnpin for Prompt
impl UnwindSafe for Prompt
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