pub struct Prompt { /* private fields */ }Expand description
Prompt text that has been checked for C-FFI compatibility.
Implementations§
Source§impl Prompt
impl Prompt
Sourcepub fn new(value: impl Into<String>) -> Result<Self, Error>
pub fn new(value: impl Into<String>) -> Result<Self, Error>
Creates a prompt, rejecting text containing interior null bytes.
Use this when you want to validate user-provided prompt text before
constructing a LanguageModelSession or calling respond.
§Examples
use aimx::Prompt;
let prompt = Prompt::new("Summarize this note")?;
assert_eq!(prompt.as_str(), "Summarize this note");§Errors
Returns Error::NullByte if value contains an interior null byte.
Trait Implementations§
Source§impl TryFrom<PromptText> for Prompt
impl TryFrom<PromptText> for Prompt
impl Eq for Prompt
impl StructuralPartialEq for Prompt
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