Skip to main content

Citation

Defined in the RAG module.
Rust AI Agent SDK A citation referencing a source document.

Fields

NameTypeDescription
idStringCitation ID (e.g., “[1]“)
sourceStringSource document or URL
textStringRelevant text snippet
pageOption<u32>Page number if applicable
scoreOption<f32>Relevance score (0.0 to 1.0)
metadataHashMap<StringAdditional metadata

Methods

new

fn new(id: impl Into<String>, source: impl Into<String>, text: impl Into<String>) -> Self
Create a new citation Parameters:
NameType
idimpl Into&lt;String&gt;
sourceimpl Into&lt;String&gt;
textimpl Into&lt;String&gt;

page

fn page(mut self, page: u32) -> Self
Set the page number Parameters:
NameType
pageu32

score

fn score(mut self, score: f32) -> Self
Set the relevance score Parameters:
NameType
scoref32

metadata

fn metadata(mut self, key: impl Into<String>, value: impl Into<String>) -> Self
Add metadata Parameters:
NameType
keyimpl Into&lt;String&gt;
valueimpl Into&lt;String&gt;

Source

View on GitHub

praisonai/src/rag/mod.rs at line 34