pub struct Prompts { /* private fields */ }Expand description
The task-prompt table.
Implementations§
Source§impl Prompts
impl Prompts
Sourcepub fn from_st_config(cfg: &Value) -> Option<Prompts>
pub fn from_st_config(cfg: &Value) -> Option<Prompts>
From a sentence-transformers config ({"prompts": {name: prefix}}).
Sourcepub fn get(&self, name: &str) -> Option<&str>
pub fn get(&self, name: &str) -> Option<&str>
The prefix for name: exact match first, then case-insensitive.
pub fn names(&self) -> Vec<&str>
Sourcepub fn format(
&self,
text: &str,
prompt_name: Option<&str>,
title: Option<&str>,
prompt: Option<&str>,
) -> Result<String, String>
pub fn format( &self, text: &str, prompt_name: Option<&str>, title: Option<&str>, prompt: Option<&str>, ) -> Result<String, String>
The text the model sees for one input.
prompt(a raw prefix) wins over everything;- a named prompt is prepended; a Document prompt takes
title(title: {title} | text:,title: nonewithout one); - a
titlewith no prompt name means the Document prompt; - neither: the text as given (the release sets no default prompt).
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Prompts
impl RefUnwindSafe for Prompts
impl Send for Prompts
impl Sync for Prompts
impl Unpin for Prompts
impl UnsafeUnpin for Prompts
impl UnwindSafe for Prompts
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