pub struct Message { /* private fields */ }Implementations§
Source§impl Message
impl Message
pub fn new(issuer: Issuer, text: impl Into<String>) -> Self
pub fn new_system(system: &str, text: impl Into<String>) -> Self
pub fn new_user(user: &str, text: impl Into<String>) -> Self
pub fn with_context(self, context: bool) -> Self
Sourcepub fn is_context(&self) -> bool
pub fn is_context(&self) -> bool
Indicates if the message is part of a context. Only avaiable for system messages. If backend receives a message is marked as context , it should be treated as a context message. E.g: OpenAI’s role should be “system” instead of “assistant”.
pub fn with_id(self, id: impl Into<String>) -> Self
pub fn with_created_at(self, timestamp: DateTime<Utc>) -> Self
pub fn with_text(self, text: impl Into<String>) -> Self
pub fn with_token_count(self, token_count: usize) -> Self
pub fn set_token_count(&mut self, token_count: usize)
pub fn token_count(&self) -> usize
pub fn id(&self) -> &str
pub fn is_system(&self) -> bool
pub fn issuer(&self) -> &Issuer
pub fn text(&self) -> &str
pub fn created_at(&self) -> DateTime<Utc>
pub fn issuer_str(&self) -> &str
pub fn append(&mut self, text: impl Into<String>)
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Message
impl RefUnwindSafe for Message
impl Send for Message
impl Sync for Message
impl Unpin for Message
impl UnsafeUnpin for Message
impl UnwindSafe for Message
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,
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> 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