pub struct Prompt { /* private fields */ }Expand description
统一的 Prompt 表示 — 同时是 Builder。
Prompt::new() 创建空 Prompt,链式添加层后 build() 产出 Message::System。
简单文本通过 From<&str> / From<String> 自动转换。
§示例
use lellm_core::{Prompt, Message};
// 分层构建 — 最大化前缀缓存
let msg = Prompt::new()
.stable("核心身份…")
.stable("工具指南…")
.dynamic("会话上下文: …")
.build();
// 简单文本 — 自动转换
let msg: Message = Prompt::from("hello").build();Implementations§
Source§impl Prompt
impl Prompt
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Prompt
impl RefUnwindSafe for Prompt
impl Send for Prompt
impl Sync for Prompt
impl Unpin for Prompt
impl UnsafeUnpin for Prompt
impl UnwindSafe for Prompt
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