pub struct UrlAnnotation {
pub url: Url,
pub title: String,
pub content: String,
pub start: usize,
pub end: usize,
}
Expand description
URL annotation metadata.
Contains metadata about a url::Url
referenced in a Message
.
This provides additional context about URLs mentioned in message content,
such as their title, description, and position within the text.
§Fields
url
- The annotated URLtitle
- Human-readable title of the URL resourcecontent
- Description or summary of the URL contentstart
- Start character index of the URL in the message contentend
- End character index of the URL in the message content
Fields§
§url: Url
The annotated URL.
title: String
URL title.
content: String
URL content/description.
start: usize
Start index in message content.
end: usize
End index in message content.
Implementations§
Source§impl UrlAnnotation
impl UrlAnnotation
Sourcepub fn new(
url: impl TryInto<Url, Error: Debug>,
title: impl Into<String>,
content: impl Into<String>,
start: usize,
end: usize,
) -> Self
pub fn new( url: impl TryInto<Url, Error: Debug>, title: impl Into<String>, content: impl Into<String>, start: usize, end: usize, ) -> Self
Creates a new URL annotation.
§Arguments
url
- The URL being annotatedtitle
- Human-readable title for the URLcontent
- Description or summary of the URL contentstart
- Start character index in the message contentend
- End character index in the message content
§Example
use ai_types::llm::UrlAnnotation;
use url::Url;
let annotation = UrlAnnotation::new(
"https://example.com",
"Example Site",
"An example website",
0,
10
);
§Panics
Panics if the URL is invalid.
Trait Implementations§
Source§impl Clone for UrlAnnotation
impl Clone for UrlAnnotation
Source§fn clone(&self) -> UrlAnnotation
fn clone(&self) -> UrlAnnotation
Returns a duplicate of the value. Read more
1.0.0 · Source§const fn clone_from(&mut self, source: &Self)
const fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for UrlAnnotation
impl Debug for UrlAnnotation
Source§impl PartialEq for UrlAnnotation
impl PartialEq for UrlAnnotation
impl Eq for UrlAnnotation
impl StructuralPartialEq for UrlAnnotation
Auto Trait Implementations§
impl Freeze for UrlAnnotation
impl RefUnwindSafe for UrlAnnotation
impl Send for UrlAnnotation
impl Sync for UrlAnnotation
impl Unpin for UrlAnnotation
impl UnwindSafe for UrlAnnotation
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