pub struct ContentBuilder { /* private fields */ }Expand description
Fluent builder for MultiModalContent.
§Example
use tokio_prompt_orchestrator::multi_modal::ContentBuilder;
let content = ContentBuilder::new()
.add_text("Hello!")
.add_image("https://example.com/img.png", Some("a cat"), None, None)
.build();
assert!(content.has_images());Implementations§
Source§impl ContentBuilder
impl ContentBuilder
Sourcepub fn add_image(
self,
url: impl Into<String>,
alt_text: Option<impl Into<String>>,
width: Option<u32>,
height: Option<u32>,
) -> Self
pub fn add_image( self, url: impl Into<String>, alt_text: Option<impl Into<String>>, width: Option<u32>, height: Option<u32>, ) -> Self
Append an image-URL part.
Sourcepub fn add_code(
self,
language: impl Into<String>,
code: impl Into<String>,
filename: Option<impl Into<String>>,
) -> Self
pub fn add_code( self, language: impl Into<String>, code: impl Into<String>, filename: Option<impl Into<String>>, ) -> Self
Append a code-snippet part.
Sourcepub fn add_table(self, headers: Vec<String>, rows: Vec<Vec<String>>) -> Self
pub fn add_table(self, headers: Vec<String>, rows: Vec<Vec<String>>) -> Self
Append a data-table part.
Sourcepub fn add_audio(
self,
text: impl Into<String>,
language: impl Into<String>,
confidence: f64,
) -> Self
pub fn add_audio( self, text: impl Into<String>, language: impl Into<String>, confidence: f64, ) -> Self
Append an audio-transcript part.
Sourcepub fn build(self) -> MultiModalContent
pub fn build(self) -> MultiModalContent
Consume the builder and return the MultiModalContent.
Trait Implementations§
Source§impl Debug for ContentBuilder
impl Debug for ContentBuilder
Source§impl Default for ContentBuilder
impl Default for ContentBuilder
Source§fn default() -> ContentBuilder
fn default() -> ContentBuilder
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for ContentBuilder
impl RefUnwindSafe for ContentBuilder
impl Send for ContentBuilder
impl Sync for ContentBuilder
impl Unpin for ContentBuilder
impl UnsafeUnpin for ContentBuilder
impl UnwindSafe for ContentBuilder
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request