pub struct GenericMessage {
pub message: String,
pub role: GenericRole,
}
Expand description
Lightweight container representing a single chat message that is independent of any specific LLM provider.
message
– the raw UTF-8 content. Markdown is fine, but keep newlines and indentation portable.role
– seeGenericRole
for permitted values.
Fields§
§message: String
§role: GenericRole
Implementations§
Source§impl GenericMessage
impl GenericMessage
Sourcepub fn new(message: String, role: GenericRole) -> Self
pub fn new(message: String, role: GenericRole) -> Self
Convenience constructor mirroring the field order used by common HTTP
APIs (role
, then content
).
use artificial_core::generic::{GenericMessage, GenericRole};
let sys = GenericMessage::new("You are a helpful bot.".into(),
GenericRole::System);
Trait Implementations§
Source§impl Clone for GenericMessage
impl Clone for GenericMessage
Source§fn clone(&self) -> GenericMessage
fn clone(&self) -> GenericMessage
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 GenericMessage
impl Debug for GenericMessage
Source§impl IntoPrompt for GenericMessage
Convenience implementation so a single crate::generic::GenericMessage
can be passed directly to the client without wrapping it in a struct.
impl IntoPrompt for GenericMessage
Convenience implementation so a single crate::generic::GenericMessage
can be passed directly to the client without wrapping it in a struct.
Source§type Message = GenericMessage
type Message = GenericMessage
Chat message representation emitted by the prompt.
Source§fn into_prompt(self) -> Vec<Self::Message>
fn into_prompt(self) -> Vec<Self::Message>
Consume
self
and return all messages in the desired order.Auto Trait Implementations§
impl Freeze for GenericMessage
impl RefUnwindSafe for GenericMessage
impl Send for GenericMessage
impl Sync for GenericMessage
impl Unpin for GenericMessage
impl UnwindSafe for GenericMessage
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