pub struct Prompt { /* private fields */ }Expand description
Content of the user message sent in a run: text and media, in order.
Build it with Prompt::text and the with_* methods. Whether the model can read images
or other media depends on the model; agentai does not check it, a model without vision
support usually answers with an error.
Implementations§
Source§impl Prompt
impl Prompt
Sourcepub fn with_media(self, media: Media) -> Self
pub fn with_media(self, media: Media) -> Self
Adds an image, audio or other file.
Sourcepub fn with_image_url(self, url: impl Into<String>) -> Self
pub fn with_image_url(self, url: impl Into<String>) -> Self
Adds an image the provider downloads from url. See Media::image_url.
Sourcepub fn with_image_bytes(
self,
content_type: impl Into<String>,
bytes: impl AsRef<[u8]>,
) -> Self
pub fn with_image_bytes( self, content_type: impl Into<String>, bytes: impl AsRef<[u8]>, ) -> Self
Adds an image from its bytes, for example image/png. See Media::from_bytes.
Sourcepub fn parts(&self) -> &[Part]
pub fn parts(&self) -> &[Part]
Returns the parts of the prompt: Part::Text and Part::Media, in order.
Trait Implementations§
Source§impl IntoPrompt for Prompt
impl IntoPrompt for Prompt
Source§fn into_prompt(self) -> Prompt
fn into_prompt(self) -> Prompt
Converts the value into a prompt.
impl StructuralPartialEq for Prompt
Auto Trait Implementations§
impl Forget for Prompt
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