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

Function examples

examples/code/basic-examples.ts:19–47  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

17});
18
19async function examples() {
20 console.log("\n=== example 1: quick math ===");
21 const math = await openreason.reason("what is 144 * 12?");
22 console.log({ verdict: math.verdict, confidence: math.confidence, mode: math.mode, latency: math.latency });
23
24 console.log("\n=== example 2: logic chain ===");
25 const logic = await openreason.reason("if all humans are mortal and socrates is human, is socrates mortal?");
26 console.log({ verdict: logic.verdict, confidence: logic.confidence, mode: logic.mode, domain: logic.domain });
27
28 console.log("\n=== example 3: factual lookup ===");
29 const fact = await openreason.reason("what is the capital of france?");
30 console.log({ verdict: fact.verdict, metadata: fact.metadata });
31
32 console.log("\n=== example 4: technical explanation ===");
33 const tech = await openreason.reason("explain recursion in programming");
34 console.log({ verdict: tech.verdict, confidence: tech.confidence, structure: tech.metadata?.structure });
35
36 console.log("\n=== example 5: ethics prompt ===");
37 const ethics = await openreason.reason("is it ethical for autonomous vehicles to make life-or-death decisions?");
38 console.log({ verdict: ethics.verdict, confidence: ethics.confidence, mode: ethics.mode, violations: ethics.violations });
39
40 console.log("\n=== example 6: comparison question ===");
41 const compare = await openreason.reason("what are the tradeoffs between typescript and javascript?");
42 console.log({ verdict: compare.verdict, confidence: compare.confidence, complexity: compare.complexity });
43
44 console.log("\n=== example 7: metadata inspection ===");
45 const meta = await openreason.reason("should we colonize mars?");
46 console.log({ verdict: meta.verdict, mode: meta.mode, metadata: meta.metadata });
47}
48
49examples().catch(console.error);

Callers 1

basic-examples.tsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected