pub struct GenericMessage {
pub content: Option<String>,
pub role: GenericRole,
pub name: Option<String>,
pub tool_calls: Option<Vec<GenericFunctionCallIntent>>,
pub tool_call_id: Option<String>,
}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– seeGenericRolefor permitted values.
Fields§
§content: Option<String>§role: GenericRole§name: Option<String>§tool_calls: Option<Vec<GenericFunctionCallIntent>>§tool_call_id: Option<String>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);pub fn new_tool_call( tool_call_id: String, tool_calls: Vec<GenericFunctionCallIntent>, ) -> Self
pub fn with_name(self, name: impl ToString) -> Self
pub fn with_tool_call_id(self, tool_call_id: impl ToString) -> Self
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§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<'de> Deserialize<'de> for GenericMessage
impl<'de> Deserialize<'de> for GenericMessage
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
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§
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§unsafe fn clone_to_uninit(&self, dest: *mut u8)
unsafe fn clone_to_uninit(&self, dest: *mut u8)
🔬This is a nightly-only experimental API. (
clone_to_uninit)