Skip to main content

store_document

Function store_document 

Source
pub async fn store_document(
    engine: &MemexEngine,
    id: String,
    text: String,
    metadata: Value,
) -> Result<ToolResult>
Expand description

Store text in memory with automatic embedding generation.

§Arguments

  • engine - The MemexEngine instance
  • id - Unique document identifier
  • text - Text content to embed and store
  • metadata - Additional metadata (JSON object)

§Returns

ToolResult indicating success or failure

§Example

let result = store_document(
    &engine,
    "visit-123".to_string(),
    "Patient presented with lethargy...".to_string(),
    json!({"patient_id": "P-456", "visit_type": "checkup"}),
).await?;