Rust client for the Cortex graph memory engine.
Thin wrapper over the tonic-generated gRPC client with ergonomic convenience methods.
Example
use CortexClient;
use CreateNodeRequest;
async
Rust client for the Cortex graph memory engine.
Thin wrapper over the tonic-generated gRPC client with ergonomic convenience methods.
use cortex_client::CortexClient;
use cortex_proto::cortex::v1::CreateNodeRequest;
#[tokio::main]
async fn main() -> anyhow::Result<()> {
let mut client = CortexClient::connect("http://localhost:9090").await?;
let node = client.create_node(CreateNodeRequest {
kind: "decision".into(),
title: "Use Rust for performance-critical paths".into(),
body: "Go for I/O-bound, Rust for CPU-bound.".into(),
importance: 0.8,
..Default::default()
}).await?;
let results = client.search("language choices", 5).await?;
let briefing = client.briefing("kai").await?;
println!("Node: {}", node.id);
println!("Briefing:\n{}", briefing);
Ok(())
}