Skip to main content

Crate cortex_memory_client

Crate cortex_memory_client 

Source
Expand description

Rust client for the Cortex graph memory engine.

Thin wrapper over the tonic-generated gRPC client with ergonomic convenience methods.

§Example

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(())
}

Modules§

proto
Re-export generated proto types for callers that need raw access.

Structs§

CortexClient
A connected Cortex client.