Document • Rust AI Agent SDK

Document: A document in the knowledge base.

Document

Defined in the knowledge module.

Rust AI Agent SDK

A document in the knowledge base.

Fields

NameTypeDescription
idStringDocument ID
contentStringDocument content
metadataHashMap<StringDocument metadata
sourceOption<String>Source path or URL
filenameOption<String>Filename if from file
created_atOption<u64>Creation timestamp
updated_atOption<u64>Update timestamp

Methods

new

rust
fn new(content: impl Into<String>) -> Self

Create a new document

Parameters:

NameType
contentimpl Into&lt;String&gt;

metadata

rust
fn metadata(mut self, key: impl Into<String>, value: impl Into<String>) -> Self

Set metadata

Parameters:

NameType
keyimpl Into&lt;String&gt;
valueimpl Into&lt;String&gt;

source

rust
fn source(mut self, source: impl Into<String>) -> Self

Set source

Parameters:

NameType
sourceimpl Into&lt;String&gt;

filename

rust
fn filename(mut self, filename: impl Into<String>) -> Self

Set filename

Parameters:

NameType
filenameimpl Into&lt;String&gt;

Source

View on GitHub

praisonai/src/knowledge/mod.rs at line 36


Related Documentation