MCPcopy Create free account
hub / github.com/CaviraOSS/OpenReason / memoryExamples

Function memoryExamples

examples/code/memory-example.ts:16–31  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

14});
15
16async function memoryExamples() {
17 console.log("\n=== first run ===");
18 const first = await openreason.reason("what is photosynthesis?");
19 console.log({ verdict: first.verdict, confidence: first.confidence, metadata: first.metadata });
20
21 console.log("\n=== repeated query (should hit cache) ===");
22 const second = await openreason.reason("what is photosynthesis?");
23 console.log({ verdict: second.verdict, cached: second.metadata?.cached, cacheSimilarity: second.metadata?.cacheSimilarity });
24
25 console.log("\n=== similar query ===");
26 const third = await openreason.reason("explain plant energy production");
27 console.log({ verdict: third.verdict, mode: third.mode, metadata: third.metadata });
28
29 console.log("\n=== memory stats ===");
30 console.log(get_memory_stats());
31}
32
33memoryExamples().catch(console.error);

Callers 1

memory-example.tsFile · 0.85

Calls 1

get_memory_statsFunction · 0.85

Tested by

no test coverage detected