pub struct SourceCitation { /* private fields */ }Expand description
A normalized citation associated with assistant text and an external source.
Implementations§
Source§impl SourceCitation
impl SourceCitation
Sourcepub fn new(source: ExternalSource) -> Self
pub fn new(source: ExternalSource) -> Self
Creates a citation with no text range or provider continuation.
Sourcepub const fn with_tool_call_id(self, tool_call_id: ToolCallId) -> Self
pub const fn with_tool_call_id(self, tool_call_id: ToolCallId) -> Self
Links the citation to one hosted tool activity.
Sourcepub fn with_range(
self,
start_index: u32,
end_index: u32,
) -> Result<Self, ExternalContentError>
pub fn with_range( self, start_index: u32, end_index: u32, ) -> Result<Self, ExternalContentError>
Adds a half-open UTF-8 byte range in the associated assistant text.
§Errors
Returns an error when the range is empty or reversed.
Sourcepub fn with_cited_text(
self,
cited_text: impl Into<String>,
) -> Result<Self, ExternalContentError>
pub fn with_cited_text( self, cited_text: impl Into<String>, ) -> Result<Self, ExternalContentError>
Adds bounded provider-supplied cited text.
§Errors
Returns an error for empty, oversized, or null-containing text.
Sourcepub fn with_continuation(self, continuation: ProviderContinuation) -> Self
pub fn with_continuation(self, continuation: ProviderContinuation) -> Self
Adds opaque provider citation state for same-provider continuation.
Sourcepub const fn tool_call_id(&self) -> Option<ToolCallId>
pub const fn tool_call_id(&self) -> Option<ToolCallId>
Returns the linked hosted tool activity, when known.
Sourcepub const fn source(&self) -> &ExternalSource
pub const fn source(&self) -> &ExternalSource
Returns the normalized cited source.
Sourcepub fn cited_text(&self) -> Option<&str>
pub fn cited_text(&self) -> Option<&str>
Returns optional cited text supplied by the provider.
Sourcepub const fn continuation(&self) -> Option<&ProviderContinuation>
pub const fn continuation(&self) -> Option<&ProviderContinuation>
Returns opaque provider citation state.
Trait Implementations§
Source§impl Clone for SourceCitation
impl Clone for SourceCitation
Source§fn clone(&self) -> SourceCitation
fn clone(&self) -> SourceCitation
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 SourceCitation
impl Debug for SourceCitation
Source§impl<'de> Deserialize<'de> for SourceCitation
impl<'de> Deserialize<'de> for SourceCitation
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
impl Eq for SourceCitation
Source§impl PartialEq for SourceCitation
impl PartialEq for SourceCitation
Source§impl Serialize for SourceCitation
impl Serialize for SourceCitation
impl StructuralPartialEq for SourceCitation
Auto Trait Implementations§
impl Freeze for SourceCitation
impl RefUnwindSafe for SourceCitation
impl Send for SourceCitation
impl Sync for SourceCitation
impl Unpin for SourceCitation
impl UnsafeUnpin for SourceCitation
impl UnwindSafe for SourceCitation
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