TypeScript client for Hindsight - Semantic memory system with personality-driven thinking
npm install @vectorize-io/hindsight-clientTypeScript client library for the Hindsight API.
``bash`
npm install @vectorize-io/hindsight-clientor
yarn add @vectorize-io/hindsight-client
`typescript
import { HindsightClient } from '@vectorize-io/hindsight-client';
const client = new HindsightClient({ baseUrl: 'http://localhost:8888' });
// Retain information
await client.retain('my-bank', 'Alice works at Google in Mountain View.');
// Recall memories
const results = await client.recall('my-bank', 'Where does Alice work?');
// Reflect and get an opinion
const response = await client.reflect('my-bank', 'What do you think about Alice\'s career?');
`
Store a single memory.
`typescript`
await client.retain('my-bank', 'User prefers dark mode', {
timestamp: new Date(),
context: 'Settings conversation',
metadata: { source: 'chat' }
});
Store multiple memories in batch.
`typescript`
await client.retainBatch('my-bank', [
{ content: 'Alice loves hiking' },
{ content: 'Alice visited Paris last summer' }
], { async: true });
Recall memories matching a query.
`typescript`
const results = await client.recall('my-bank', 'What are Alice\'s hobbies?', {
budget: 'mid'
});
Generate a contextual answer using the bank's identity and memories.
`typescript`
const response = await client.reflect('my-bank', 'What should I do this weekend?', {
budget: 'low'
});
console.log(response.text);
Create or update a memory bank with personality.
`typescript``
await client.createBank('my-bank', {
name: 'My Assistant',
background: 'A helpful assistant that remembers everything.'
});
For full documentation, visit hindsight.