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
| Name | Type | Description |
|---|---|---|
id | String | Document ID |
content | String | Document content |
metadata | HashMap<String | Document metadata |
source | Option<String> | Source path or URL |
filename | Option<String> | Filename if from file |
created_at | Option<u64> | Creation timestamp |
updated_at | Option<u64> | Update timestamp |
Methods
new
fn new(content: impl Into<String>) -> SelfCreate a new document
Parameters:
| Name | Type |
|---|---|
content | impl Into<String> |
metadata
fn metadata(mut self, key: impl Into<String>, value: impl Into<String>) -> SelfSet metadata
Parameters:
| Name | Type |
|---|---|
key | impl Into<String> |
value | impl Into<String> |
source
fn source(mut self, source: impl Into<String>) -> SelfSet source
Parameters:
| Name | Type |
|---|---|
source | impl Into<String> |
filename
fn filename(mut self, filename: impl Into<String>) -> SelfSet filename
Parameters:
| Name | Type |
|---|---|
filename | impl Into<String> |
Source
View on GitHubpraisonai/src/knowledge/mod.rs at line 36