pub struct ProcessorPromptConfig {
pub image_start_token: String,
pub image_end_token: String,
pub image_token: String,
}Fields§
§image_start_token: String§image_end_token: String§image_token: StringImplementations§
Source§impl ProcessorPromptConfig
impl ProcessorPromptConfig
pub fn from_model_dir(model_dir: &Path) -> Result<ProcessorPromptConfig, Error>
Sourcepub fn expand_image_placeholder(
&self,
text: &str,
n_image_tokens: usize,
) -> String
pub fn expand_image_placeholder( &self, text: &str, n_image_tokens: usize, ) -> String
Replace <image-1> with <image 1><img>{image_token×N}</img> (HF replace_media_placeholder).
Sourcepub fn build_chat_prompt_string(
&self,
user_body_with_placeholder: &str,
n_image_tokens: usize,
) -> String
pub fn build_chat_prompt_string( &self, user_body_with_placeholder: &str, n_image_tokens: usize, ) -> String
Full string passed to the HF processor tokenizer (system + user + assistant prompt).
Trait Implementations§
Source§impl Clone for ProcessorPromptConfig
impl Clone for ProcessorPromptConfig
Source§fn clone(&self) -> ProcessorPromptConfig
fn clone(&self) -> ProcessorPromptConfig
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · 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 ProcessorPromptConfig
impl Debug for ProcessorPromptConfig
Source§impl<'de> Deserialize<'de> for ProcessorPromptConfig
impl<'de> Deserialize<'de> for ProcessorPromptConfig
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<ProcessorPromptConfig, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<ProcessorPromptConfig, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for ProcessorPromptConfig
impl RefUnwindSafe for ProcessorPromptConfig
impl Send for ProcessorPromptConfig
impl Sync for ProcessorPromptConfig
impl Unpin for ProcessorPromptConfig
impl UnsafeUnpin for ProcessorPromptConfig
impl UnwindSafe for ProcessorPromptConfig
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more