pub struct ChatRequestWithImages {
pub request: ChatRequest,
pub images: Vec<ImageData>,
pub provider_format: ProviderImageFormat,
}Expand description
Extended chat request with image support.
This wraps the standard ChatRequest and adds image data that can be serialized for different providers.
Fields§
§request: ChatRequestThe base chat request
images: Vec<ImageData>Images to include in the request
provider_format: ProviderImageFormatProvider-specific image handling
Implementations§
Source§impl ChatRequestWithImages
impl ChatRequestWithImages
Sourcepub fn new(request: ChatRequest, provider_name: &str) -> Self
pub fn new(request: ChatRequest, provider_name: &str) -> Self
Create a new chat request with images.
Sourcepub fn add_images(&mut self, images: Vec<ImageData>)
pub fn add_images(&mut self, images: Vec<ImageData>)
Add multiple images to the request.
Sourcepub fn serialize_for_provider(&self) -> ImageResult<ChatRequest>
pub fn serialize_for_provider(&self) -> ImageResult<ChatRequest>
Serialize the request for the target provider.
This converts the images into the format expected by the provider and updates the message content accordingly.
Sourcepub fn image_count(&self) -> usize
pub fn image_count(&self) -> usize
Get the number of images in this request.
Sourcepub fn has_images(&self) -> bool
pub fn has_images(&self) -> bool
Check if this request has any images.
Trait Implementations§
Source§impl Clone for ChatRequestWithImages
impl Clone for ChatRequestWithImages
Source§fn clone(&self) -> ChatRequestWithImages
fn clone(&self) -> ChatRequestWithImages
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 ChatRequestWithImages
impl Debug for ChatRequestWithImages
Source§impl<'de> Deserialize<'de> for ChatRequestWithImages
impl<'de> Deserialize<'de> for ChatRequestWithImages
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
Auto Trait Implementations§
impl Freeze for ChatRequestWithImages
impl RefUnwindSafe for ChatRequestWithImages
impl Send for ChatRequestWithImages
impl Sync for ChatRequestWithImages
impl Unpin for ChatRequestWithImages
impl UnwindSafe for ChatRequestWithImages
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more