pub struct DocumentBlock {
pub source: DocumentSource,
pub cache_control: Option<CacheControlEphemeral>,
pub citations: Option<CitationsConfig>,
pub context: Option<String>,
pub title: Option<String>,
}Expand description
Parameters for a document block.
Fields§
§source: DocumentSourceThe source of the document.
cache_control: Option<CacheControlEphemeral>Create a cache control breakpoint at this content block.
citations: Option<CitationsConfig>Configuration for citations in this document.
context: Option<String>Optional context for the document.
title: Option<String>Optional title for the document.
Implementations§
Source§impl DocumentBlock
impl DocumentBlock
Sourcepub fn new(source: DocumentSource) -> Self
pub fn new(source: DocumentSource) -> Self
Create a new DocumentBlock with the given source.
Sourcepub fn new_with_base64_pdf(source: Base64PdfSource) -> Self
pub fn new_with_base64_pdf(source: Base64PdfSource) -> Self
Create a new DocumentBlock with a Base64 PDF source.
Sourcepub fn new_with_plain_text(source: PlainTextSource) -> Self
pub fn new_with_plain_text(source: PlainTextSource) -> Self
Create a new DocumentBlock with a plain text source.
Sourcepub fn new_with_content_block(source: ContentBlockSourceParam) -> Self
pub fn new_with_content_block(source: ContentBlockSourceParam) -> Self
Create a new DocumentBlock with a content block source.
Sourcepub fn new_with_url_pdf(source: UrlPdfSource) -> Self
pub fn new_with_url_pdf(source: UrlPdfSource) -> Self
Create a new DocumentBlock with a URL PDF source.
Sourcepub fn with_cache_control(self, cache_control: CacheControlEphemeral) -> Self
pub fn with_cache_control(self, cache_control: CacheControlEphemeral) -> Self
Add a cache control to this document block.
Sourcepub fn with_citations(self, citations: CitationsConfig) -> Self
pub fn with_citations(self, citations: CitationsConfig) -> Self
Add citations configuration to this document block.
Sourcepub fn with_context(self, context: String) -> Self
pub fn with_context(self, context: String) -> Self
Add context to this document block.
Sourcepub fn with_title(self, title: String) -> Self
pub fn with_title(self, title: String) -> Self
Add a title to this document block.
Trait Implementations§
Source§impl Clone for DocumentBlock
impl Clone for DocumentBlock
Source§fn clone(&self) -> DocumentBlock
fn clone(&self) -> DocumentBlock
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · 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 DocumentBlock
impl Debug for DocumentBlock
Source§impl<'de> Deserialize<'de> for DocumentBlock
impl<'de> Deserialize<'de> for DocumentBlock
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
Source§impl From<DocumentBlock> for ContentBlock
impl From<DocumentBlock> for ContentBlock
Source§fn from(block: DocumentBlock) -> Self
fn from(block: DocumentBlock) -> Self
Converts to this type from the input type.
Source§impl PartialEq for DocumentBlock
impl PartialEq for DocumentBlock
Source§fn eq(&self, other: &DocumentBlock) -> bool
fn eq(&self, other: &DocumentBlock) -> bool
Tests for
self and other values to be equal, and is used by ==.Source§impl Serialize for DocumentBlock
impl Serialize for DocumentBlock
impl StructuralPartialEq for DocumentBlock
Auto Trait Implementations§
impl Freeze for DocumentBlock
impl RefUnwindSafe for DocumentBlock
impl Send for DocumentBlock
impl Sync for DocumentBlock
impl Unpin for DocumentBlock
impl UnsafeUnpin for DocumentBlock
impl UnwindSafe for DocumentBlock
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