pub struct HarmonyEncoding { /* private fields */ }
Implementations§
Source§impl HarmonyEncoding
impl HarmonyEncoding
Sourcepub fn render_conversation_into<'a, I, B>(
&self,
conversation: I,
into: &mut B,
config: Option<&RenderConversationConfig>,
) -> Result<()>
pub fn render_conversation_into<'a, I, B>( &self, conversation: I, into: &mut B, config: Option<&RenderConversationConfig>, ) -> Result<()>
Renders a conversation into a collection of tokens.
Sourcepub fn render_conversation_for_completion_into<'a, I, B>(
&self,
conversation: I,
next_turn_role: Role,
into: &mut B,
config: Option<&RenderConversationConfig>,
) -> Result<()>
pub fn render_conversation_for_completion_into<'a, I, B>( &self, conversation: I, next_turn_role: Role, into: &mut B, config: Option<&RenderConversationConfig>, ) -> Result<()>
Renders a conversation into a collection of tokens, adding the next turn role.
This method is used to prepare a conversation for inference.
pub fn render_conversation_for_completion<'a, I>(
&self,
conversation: I,
next_turn_role: Role,
config: Option<&RenderConversationConfig>,
) -> Result<Vec<u32>>where
I: IntoIterator<Item = &'a Message>,
Sourcepub fn render_conversation_for_training<'a, I>(
&self,
conversation: I,
config: Option<&RenderConversationConfig>,
) -> Result<Vec<u32>>where
I: IntoIterator<Item = &'a Message>,
pub fn render_conversation_for_training<'a, I>(
&self,
conversation: I,
config: Option<&RenderConversationConfig>,
) -> Result<Vec<u32>>where
I: IntoIterator<Item = &'a Message>,
Render a conversation for training.
If the last message in the conversation is an assistant message to the
final
channel, replace the trailing <|end|>
token with <|return|>
.
Sourcepub fn render_conversation<'a, I>(
&self,
conversation: I,
config: Option<&RenderConversationConfig>,
) -> Result<Vec<u32>>where
I: IntoIterator<Item = &'a Message>,
pub fn render_conversation<'a, I>(
&self,
conversation: I,
config: Option<&RenderConversationConfig>,
) -> Result<Vec<u32>>where
I: IntoIterator<Item = &'a Message>,
Render a conversation without appending a new role.
Source§impl HarmonyEncoding
impl HarmonyEncoding
pub fn parse_messages_from_completion_tokens<I>(
&self,
tokens: I,
role: Option<Role>,
) -> Result<Vec<Message>>where
I: IntoIterator<Item = u32>,
Trait Implementations§
Source§impl Clone for HarmonyEncoding
impl Clone for HarmonyEncoding
Source§fn clone(&self) -> HarmonyEncoding
fn clone(&self) -> HarmonyEncoding
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 HarmonyEncoding
impl Debug for HarmonyEncoding
Auto Trait Implementations§
impl Freeze for HarmonyEncoding
impl RefUnwindSafe for HarmonyEncoding
impl Send for HarmonyEncoding
impl Sync for HarmonyEncoding
impl Unpin for HarmonyEncoding
impl UnwindSafe for HarmonyEncoding
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<T> ToStringFallible for Twhere
T: Display,
impl<T> ToStringFallible for Twhere
T: Display,
Source§fn try_to_string(&self) -> Result<String, TryReserveError>
fn try_to_string(&self) -> Result<String, TryReserveError>
ToString::to_string
, but without panic on OOM.