From d0f67c9f8b24b3b4d5b8fb486899f8daa307710f Mon Sep 17 00:00:00 2001 From: Van Vuong Ngo <20791239+vanvuongngo@users.noreply.github.com> Date: Sat, 7 Feb 2026 10:02:41 +0100 Subject: [PATCH] doc: improve Node.js client example (#320) Fix doc to increase the developer experience... - if the code is intended to be a CommonJS by using `require` then you have to wrap `await` calls in an async function - calling `client.recall` with using the results --- README.md | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 313aad33..d981a41f 100644 --- a/README.md +++ b/README.md @@ -116,10 +116,16 @@ npm install @vectorize-io/hindsight-client ```javascript const { HindsightClient } = require('@vectorize-io/hindsight-client'); -const client = new HindsightClient({ baseUrl: 'http://localhost:8888' }); +const example = async () => { + const client = new HindsightClient({ baseUrl: 'http://localhost:8888' }); -await client.retain('my-bank', 'Alice loves hiking in Yosemite'); -await client.recall('my-bank', 'What does Alice like?'); + await client.retain('my-bank', 'Alice loves hiking in Yosemite'); + + const results = await client.recall('my-bank', 'What does Alice like?'); + console.log(results); +} + +example(); ``` ---