| Crates.io | neomemx |
| lib.rs | neomemx |
| version | 0.1.2 |
| created_at | 2025-12-12 23:52:25.495682+00 |
| updated_at | 2025-12-13 00:49:57.593492+00 |
| description | A high-performance memory library for AI agents with semantic search |
| homepage | https://github.com/smafjal/neomemx |
| repository | https://github.com/smafjal/neomemx |
| max_upload_size | |
| id | 1982375 |
| size | 398,655 |
neomemx is a high-performance, multi-tenant memory layer for AI agents build with a Rust.
store, search, retrieve_all).docker run -d -p 8000:8000 chromadb/chroma
or
chroma run --host 0.0.0.0 --port 8000
export GROQ_API_KEY=your_key # or OPENAI_API_KEY, JINA_API_KEY
Cargo.toml:
[dependencies]
neomemx = "0.1"
tokio = { version = "1", features = ["full"] }
Example:
use neomemx::prelude::*;
#[tokio::main]
async fn main() -> Result<()> {
dotenvy::dotenv().ok(); // .env - keep your api-key
println!("Initializing NeomemxEngine...");
let engine = NeomemxEngine::new().await?;
let user_id = "afjal";
let scope = ScopeIdentifiers::for_user(user_id);
println!("Storing memories...");
let outcome = engine
.store("I'm Afjal, a software engineer.")
.with_scope(scope.clone())
.execute()
.await?;
for op in outcome.operations {
println!(
"Fact operation: {:?} -> {} ({})",
op.change_type, op.fact_id, op.content
);
}
let outcome = engine
.store("I enjoy playing football.")
.with_scope(scope.clone())
.execute()
.await?;
for op in outcome.operations {
println!(
"Fact operation: {:?} -> {} ({})",
op.change_type, op.fact_id, op.content
);
}
// Search memories
println!("\nSearching for 'What does Afjal do?'...");
let results = engine
.search("What does Afjal do?")
.with_scope(scope.clone())
.limit(5)
.execute()
.await?;
for fact in results.facts {
println!(
" - {} (score: {:.2})",
fact.content,
fact.relevance_score.unwrap_or(0.0)
);
}
// Retrieve all
println!("\nRetrieving all facts for user...");
let all = engine
.retrieve_all()
.with_scope(scope.clone())
.limit(10)
.execute()
.await?;
for fact in all.facts {
println!(" - [{}] {}", &fact.id[..8], fact.content);
}
// Cleanup
println!("\nCleaning up...");
let count = engine.clear(scope).await?;
println!("Deleted {} facts.", count);
println!("Done!");
Ok(())
}
| Variable | Description | Required |
|---|---|---|
GROQ_API_KEY |
Groq API key | If using Groq |
JINA_API_KEY |
Jina API key | If using Jina |
OPENAI_API_KEY |
OpenAI API key | If using OpenAI |
CHROMA_HOST |
ChromaDB host | No (default: localhost) |
CHROMA_PORT |
ChromaDB port | No (default: 8000) |
MIT - see LICENSE