Rust SDK for TinyHumans Neocortex memory APIs.
- Rust 1.70+
- Tokio runtime for async usage
Add to Cargo.toml:
[dependencies]
tinyhumansai = "0.1"
tokio = { version = "1", features = ["macros", "rt-multi-thread"] }- Sign in to your TinyHumans account.
- Create a server API key in the TinyHumans dashboard.
- Export it before running examples:
export TINYHUMANS_TOKEN="your_api_key"
# optional custom API URL
export TINYHUMANS_BASE_URL="https://api.tinyhumans.ai"use tinyhumansai::{
InsertMemoryParams, QueryMemoryParams, TinyHumanConfig, TinyHumansMemoryClient,
};
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let token = std::env::var("TINYHUMANS_TOKEN")?;
let client = TinyHumansMemoryClient::new(TinyHumanConfig::new(token))?;
client.insert_memory(InsertMemoryParams {
title: "User preference".into(),
content: "User prefers dark mode".into(),
namespace: "preferences".into(),
..Default::default()
}).await?;
let query = client.query_memory(QueryMemoryParams {
query: "What does the user prefer?".into(),
namespace: Some("preferences".into()),
max_chunks: Some(10.0),
..Default::default()
}).await?;
println!("{:?}", query.data.response);
Ok(())
}examples/test_routes.rs is the comprehensive example and exercises all currently implemented methods.
cd packages/sdk-rust
cargo run --example test_routes
# optional env file override:
ENV_FILE=../sdk-python/.env cargo run --example test_routesTinyHumanConfig::new(token) supports optional .with_base_url(url).
Base URL resolution: explicit config -> TINYHUMANS_BASE_URL -> NEOCORTEX_BASE_URL -> https://api.tinyhumans.ai.
Core memory routes:
insert_memoryquery_memorydelete_memoryrecall_memoryrecall_memories
Memories/context/chat routes:
recall_memories_contextmemory_thoughtsinteract_memoryrecord_interactionsquery_memoriesmemory_conversationmemory_chat
Documents and admin routes:
ingest_documentingest_documents_batchlist_documentsget_documentdelete_documentingestion_job_statusmemory_healthsync_memory
cargo test