@vectorize-io/hindsight-ai-sdk 0.4.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +356 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/tools/index.d.ts +347 -0
- package/dist/tools/index.js +227 -0
- package/package.json +58 -0
package/README.md
ADDED
|
@@ -0,0 +1,356 @@
|
|
|
1
|
+
# Hindsight Memory Integration for Vercel AI SDK
|
|
2
|
+
|
|
3
|
+
Give your AI agents persistent, human-like memory using [Hindsight](https://vectorize.io/hindsight) with the [Vercel AI SDK](https://ai-sdk.dev).
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- **Three Memory Operations**: `retain` (store), `recall` (retrieve), and `reflect` (reason over memories)
|
|
8
|
+
- **Multi-User Support**: Dynamic bank IDs per call for multi-user/multi-tenant scenarios
|
|
9
|
+
- **Full API Coverage**: Complete parameter support for all Hindsight operations
|
|
10
|
+
- **Type-Safe**: Full TypeScript support with Zod schemas for validation
|
|
11
|
+
- **AI SDK 6 Native**: Works seamlessly with `generateText`, `streamText`, and `ToolLoopAgent`
|
|
12
|
+
|
|
13
|
+
## Installation
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
npm install @vectorize-io/hindsight-ai-sdk ai zod
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
You'll also need a Hindsight client. Choose one:
|
|
20
|
+
|
|
21
|
+
**Option A: TypeScript/JavaScript Client**
|
|
22
|
+
```bash
|
|
23
|
+
npm install @vectorize-io/hindsight-client
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
**Option B: Direct HTTP Client** (no additional dependencies)
|
|
27
|
+
```typescript
|
|
28
|
+
// See "HTTP Client Example" below
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## Quick Start
|
|
32
|
+
|
|
33
|
+
### 1. Set up your Hindsight client
|
|
34
|
+
|
|
35
|
+
```typescript
|
|
36
|
+
import { HindsightClient } from '@vectorize-io/hindsight-client';
|
|
37
|
+
|
|
38
|
+
const hindsightClient = new HindsightClient({
|
|
39
|
+
apiUrl: process.env.HINDSIGHT_API_URL || 'http://localhost:8000',
|
|
40
|
+
});
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
### 2. Create Hindsight tools
|
|
44
|
+
|
|
45
|
+
```typescript
|
|
46
|
+
import { createHindsightTools } from '@vectorize-io/hindsight-ai-sdk';
|
|
47
|
+
|
|
48
|
+
const tools = createHindsightTools({
|
|
49
|
+
client: hindsightClient,
|
|
50
|
+
});
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
### 3. Use with AI SDK
|
|
54
|
+
|
|
55
|
+
```typescript
|
|
56
|
+
import { generateText } from 'ai';
|
|
57
|
+
import { anthropic } from '@ai-sdk/anthropic';
|
|
58
|
+
|
|
59
|
+
const result = await generateText({
|
|
60
|
+
model: anthropic('claude-sonnet-4-20250514'),
|
|
61
|
+
tools,
|
|
62
|
+
prompt: 'Remember that Alice loves hiking and prefers spicy food',
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
console.log(result.text);
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
## Full Example: Memory-Enabled Chatbot
|
|
69
|
+
|
|
70
|
+
```typescript
|
|
71
|
+
import { HindsightClient } from '@vectorize-io/hindsight-client';
|
|
72
|
+
import { createHindsightTools } from '@vectorize-io/hindsight-ai-sdk';
|
|
73
|
+
import { streamText } from 'ai';
|
|
74
|
+
import { anthropic } from '@ai-sdk/anthropic';
|
|
75
|
+
|
|
76
|
+
// Initialize Hindsight
|
|
77
|
+
const hindsightClient = new HindsightClient({
|
|
78
|
+
apiUrl: 'http://localhost:8000',
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
const tools = createHindsightTools({ client: hindsightClient });
|
|
82
|
+
|
|
83
|
+
// Chat with memory
|
|
84
|
+
const result = await streamText({
|
|
85
|
+
model: anthropic('claude-sonnet-4-20250514'),
|
|
86
|
+
tools,
|
|
87
|
+
system: `You are a helpful assistant with long-term memory.
|
|
88
|
+
|
|
89
|
+
IMPORTANT:
|
|
90
|
+
- Before answering questions, use the 'recall' tool to check for relevant memories
|
|
91
|
+
- When users share important information, use the 'retain' tool to remember it
|
|
92
|
+
- For complex questions requiring synthesis, use the 'reflect' tool
|
|
93
|
+
- Always pass the user's ID as the bankId parameter
|
|
94
|
+
|
|
95
|
+
Your memory persists across sessions!`,
|
|
96
|
+
prompt: 'Remember that I am Alice and I love hiking',
|
|
97
|
+
});
|
|
98
|
+
|
|
99
|
+
for await (const chunk of result.textStream) {
|
|
100
|
+
process.stdout.write(chunk);
|
|
101
|
+
}
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
## API Reference
|
|
105
|
+
|
|
106
|
+
### `createHindsightTools(options)`
|
|
107
|
+
|
|
108
|
+
Creates AI SDK tool definitions for Hindsight memory operations.
|
|
109
|
+
|
|
110
|
+
**Parameters:**
|
|
111
|
+
|
|
112
|
+
- `options.client`: `HindsightClient` - Hindsight client instance
|
|
113
|
+
- `options.retainDescription`: `string` (optional) - Custom description for the retain tool
|
|
114
|
+
- `options.recallDescription`: `string` (optional) - Custom description for the recall tool
|
|
115
|
+
- `options.reflectDescription`: `string` (optional) - Custom description for the reflect tool
|
|
116
|
+
|
|
117
|
+
**Returns:** Object with three tools: `retain`, `recall`, and `reflect`
|
|
118
|
+
|
|
119
|
+
### Tool: `retain`
|
|
120
|
+
|
|
121
|
+
Store information in long-term memory.
|
|
122
|
+
|
|
123
|
+
**Parameters:**
|
|
124
|
+
- `bankId`: `string` - Memory bank ID (usually the user ID)
|
|
125
|
+
- `content`: `string` - Content to store
|
|
126
|
+
- `documentId`: `string` (optional) - Document ID for grouping/upserting
|
|
127
|
+
- `timestamp`: `string` (optional) - ISO timestamp for when the memory occurred
|
|
128
|
+
- `context`: `string` (optional) - Additional context about the memory
|
|
129
|
+
|
|
130
|
+
**Returns:**
|
|
131
|
+
```typescript
|
|
132
|
+
{
|
|
133
|
+
success: boolean;
|
|
134
|
+
itemsCount: number;
|
|
135
|
+
}
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
### Tool: `recall`
|
|
139
|
+
|
|
140
|
+
Search memory for relevant information.
|
|
141
|
+
|
|
142
|
+
**Parameters:**
|
|
143
|
+
- `bankId`: `string` - Memory bank ID
|
|
144
|
+
- `query`: `string` - What to search for
|
|
145
|
+
- `types`: `string[]` (optional) - Filter by fact types
|
|
146
|
+
- `maxTokens`: `number` (optional) - Maximum tokens to return
|
|
147
|
+
- `budget`: `'low' | 'mid' | 'high'` (optional) - Processing budget
|
|
148
|
+
- `queryTimestamp`: `string` (optional) - Query from a specific time (ISO format)
|
|
149
|
+
- `includeEntities`: `boolean` (optional) - Include entity observations
|
|
150
|
+
- `includeChunks`: `boolean` (optional) - Include raw chunks
|
|
151
|
+
|
|
152
|
+
**Returns:**
|
|
153
|
+
```typescript
|
|
154
|
+
{
|
|
155
|
+
results: Array<{
|
|
156
|
+
id: string;
|
|
157
|
+
text: string;
|
|
158
|
+
type?: string;
|
|
159
|
+
entities?: string[];
|
|
160
|
+
context?: string;
|
|
161
|
+
occurred_start?: string;
|
|
162
|
+
occurred_end?: string;
|
|
163
|
+
mentioned_at?: string;
|
|
164
|
+
document_id?: string;
|
|
165
|
+
metadata?: Record<string, string>;
|
|
166
|
+
chunk_id?: string;
|
|
167
|
+
}>;
|
|
168
|
+
entities?: Record<string, EntityState>;
|
|
169
|
+
}
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
### Tool: `reflect`
|
|
173
|
+
|
|
174
|
+
Analyze memories to form insights and generate contextual answers.
|
|
175
|
+
|
|
176
|
+
**Parameters:**
|
|
177
|
+
- `bankId`: `string` - Memory bank ID
|
|
178
|
+
- `query`: `string` - Question to reflect on
|
|
179
|
+
- `context`: `string` (optional) - Additional context for reflection
|
|
180
|
+
- `budget`: `'low' | 'mid' | 'high'` (optional) - Processing budget
|
|
181
|
+
|
|
182
|
+
**Returns:**
|
|
183
|
+
```typescript
|
|
184
|
+
{
|
|
185
|
+
text: string;
|
|
186
|
+
basedOn?: Array<{
|
|
187
|
+
id?: string;
|
|
188
|
+
text: string;
|
|
189
|
+
type?: string;
|
|
190
|
+
context?: string;
|
|
191
|
+
occurred_start?: string;
|
|
192
|
+
occurred_end?: string;
|
|
193
|
+
}>;
|
|
194
|
+
}
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
## Advanced Usage
|
|
198
|
+
|
|
199
|
+
### Custom Tool Descriptions
|
|
200
|
+
|
|
201
|
+
Customize tool descriptions to guide model behavior:
|
|
202
|
+
|
|
203
|
+
```typescript
|
|
204
|
+
const tools = createHindsightTools({
|
|
205
|
+
client: hindsightClient,
|
|
206
|
+
retainDescription: 'Store user preferences and important facts. Always include context.',
|
|
207
|
+
recallDescription: 'Search past conversations. Use specific queries for best results.',
|
|
208
|
+
reflectDescription: 'Synthesize insights from memories. Use for complex questions.',
|
|
209
|
+
});
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
### Multi-User Scenarios
|
|
213
|
+
|
|
214
|
+
Each tool call accepts a `bankId` parameter, making it easy to support multiple users:
|
|
215
|
+
|
|
216
|
+
```typescript
|
|
217
|
+
const result = await generateText({
|
|
218
|
+
model: anthropic('claude-sonnet-4-20250514'),
|
|
219
|
+
tools,
|
|
220
|
+
prompt: `User ID: ${userId}\n\nRemember that I prefer dark mode`,
|
|
221
|
+
});
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
The model will automatically pass the user ID to the tools.
|
|
225
|
+
|
|
226
|
+
### Using with ToolLoopAgent
|
|
227
|
+
|
|
228
|
+
```typescript
|
|
229
|
+
import { ToolLoopAgent, stopWhen, stepCountIs } from 'ai';
|
|
230
|
+
|
|
231
|
+
const agent = new ToolLoopAgent({
|
|
232
|
+
model: anthropic('claude-sonnet-4-20250514'),
|
|
233
|
+
tools,
|
|
234
|
+
instructions: `You are a personal assistant with long-term memory.
|
|
235
|
+
|
|
236
|
+
Always check memory before responding using the recall tool.
|
|
237
|
+
Store important user preferences with the retain tool.
|
|
238
|
+
Use the reflect tool to analyze patterns in the user's behavior.`,
|
|
239
|
+
stopWhen: stepCountIs(10),
|
|
240
|
+
});
|
|
241
|
+
|
|
242
|
+
const result = await agent.generate({
|
|
243
|
+
prompt: 'What did I say I wanted to work on this week?',
|
|
244
|
+
});
|
|
245
|
+
```
|
|
246
|
+
|
|
247
|
+
## HTTP Client Example
|
|
248
|
+
|
|
249
|
+
If you prefer not to install the full Hindsight client, you can use a simple HTTP client:
|
|
250
|
+
|
|
251
|
+
```typescript
|
|
252
|
+
import type { HindsightClient } from '@vectorize-io/hindsight-ai-sdk';
|
|
253
|
+
|
|
254
|
+
const httpClient: HindsightClient = {
|
|
255
|
+
async retain(bankId, content, options = {}) {
|
|
256
|
+
const response = await fetch(`${HINDSIGHT_URL}/v1/default/banks/${bankId}/memories/retain`, {
|
|
257
|
+
method: 'POST',
|
|
258
|
+
headers: { 'Content-Type': 'application/json' },
|
|
259
|
+
body: JSON.stringify({
|
|
260
|
+
content,
|
|
261
|
+
timestamp: options.timestamp,
|
|
262
|
+
context: options.context,
|
|
263
|
+
metadata: options.metadata,
|
|
264
|
+
document_id: options.documentId,
|
|
265
|
+
async: options.async,
|
|
266
|
+
}),
|
|
267
|
+
});
|
|
268
|
+
return response.json();
|
|
269
|
+
},
|
|
270
|
+
|
|
271
|
+
async recall(bankId, query, options = {}) {
|
|
272
|
+
const response = await fetch(`${HINDSIGHT_URL}/v1/default/banks/${bankId}/memories/recall`, {
|
|
273
|
+
method: 'POST',
|
|
274
|
+
headers: { 'Content-Type': 'application/json' },
|
|
275
|
+
body: JSON.stringify({
|
|
276
|
+
query,
|
|
277
|
+
types: options.types,
|
|
278
|
+
max_tokens: options.maxTokens,
|
|
279
|
+
budget: options.budget,
|
|
280
|
+
trace: options.trace,
|
|
281
|
+
query_timestamp: options.queryTimestamp,
|
|
282
|
+
include_entities: options.includeEntities,
|
|
283
|
+
max_entity_tokens: options.maxEntityTokens,
|
|
284
|
+
include_chunks: options.includeChunks,
|
|
285
|
+
max_chunk_tokens: options.maxChunkTokens,
|
|
286
|
+
}),
|
|
287
|
+
});
|
|
288
|
+
return response.json();
|
|
289
|
+
},
|
|
290
|
+
|
|
291
|
+
async reflect(bankId, query, options = {}) {
|
|
292
|
+
const response = await fetch(`${HINDSIGHT_URL}/v1/default/banks/${bankId}/reflect`, {
|
|
293
|
+
method: 'POST',
|
|
294
|
+
headers: { 'Content-Type': 'application/json' },
|
|
295
|
+
body: JSON.stringify({
|
|
296
|
+
query,
|
|
297
|
+
context: options.context,
|
|
298
|
+
budget: options.budget,
|
|
299
|
+
}),
|
|
300
|
+
});
|
|
301
|
+
return response.json();
|
|
302
|
+
},
|
|
303
|
+
};
|
|
304
|
+
|
|
305
|
+
const tools = createHindsightTools({ client: httpClient });
|
|
306
|
+
```
|
|
307
|
+
|
|
308
|
+
## Running Hindsight Locally
|
|
309
|
+
|
|
310
|
+
The easiest way to run Hindsight for development:
|
|
311
|
+
|
|
312
|
+
```bash
|
|
313
|
+
# Install and run with embedded mode (no setup required)
|
|
314
|
+
uvx hindsight-embed@latest -p myapp daemon start
|
|
315
|
+
|
|
316
|
+
# The API will be available at http://localhost:8000
|
|
317
|
+
```
|
|
318
|
+
|
|
319
|
+
For production deployments, see the [Hindsight Documentation](https://vectorize.io/hindsight).
|
|
320
|
+
|
|
321
|
+
## TypeScript Types
|
|
322
|
+
|
|
323
|
+
All types are exported for your convenience:
|
|
324
|
+
|
|
325
|
+
```typescript
|
|
326
|
+
import type {
|
|
327
|
+
Budget,
|
|
328
|
+
HindsightClient,
|
|
329
|
+
HindsightTools,
|
|
330
|
+
HindsightToolsOptions,
|
|
331
|
+
RecallResult,
|
|
332
|
+
RecallResponse,
|
|
333
|
+
ReflectFact,
|
|
334
|
+
ReflectResponse,
|
|
335
|
+
RetainResponse,
|
|
336
|
+
EntityState,
|
|
337
|
+
ChunkData,
|
|
338
|
+
} from '@vectorize-io/hindsight-ai-sdk';
|
|
339
|
+
```
|
|
340
|
+
|
|
341
|
+
## Documentation & Resources
|
|
342
|
+
|
|
343
|
+
- [Hindsight Documentation](https://vectorize.io/hindsight)
|
|
344
|
+
- [Vercel AI SDK Documentation](https://ai-sdk.dev)
|
|
345
|
+
- [GitHub Repository](https://github.com/vectorize-io/hindsight)
|
|
346
|
+
- [Examples](https://github.com/vectorize-io/hindsight/tree/main/examples)
|
|
347
|
+
|
|
348
|
+
## License
|
|
349
|
+
|
|
350
|
+
MIT
|
|
351
|
+
|
|
352
|
+
## Support
|
|
353
|
+
|
|
354
|
+
For issues and questions:
|
|
355
|
+
- [GitHub Issues](https://github.com/vectorize-io/hindsight/issues)
|
|
356
|
+
- Email: support@vectorize.io
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { createHindsightTools, BudgetSchema, type Budget, type HindsightClient, type HindsightTools, type HindsightToolsOptions, type RecallResult, type RecallResponse, type ReflectFact, type ReflectResponse, type RetainResponse, type EntityState, type ChunkData, } from './tools';
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { createHindsightTools, BudgetSchema, } from './tools';
|
|
@@ -0,0 +1,347 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
/**
|
|
3
|
+
* Budget levels for recall/reflect operations.
|
|
4
|
+
*/
|
|
5
|
+
export declare const BudgetSchema: z.ZodEnum<{
|
|
6
|
+
low: "low";
|
|
7
|
+
mid: "mid";
|
|
8
|
+
high: "high";
|
|
9
|
+
}>;
|
|
10
|
+
export type Budget = z.infer<typeof BudgetSchema>;
|
|
11
|
+
/**
|
|
12
|
+
* Recall result item from Hindsight
|
|
13
|
+
*/
|
|
14
|
+
export interface RecallResult {
|
|
15
|
+
id: string;
|
|
16
|
+
text: string;
|
|
17
|
+
type?: string | null;
|
|
18
|
+
entities?: string[] | null;
|
|
19
|
+
context?: string | null;
|
|
20
|
+
occurred_start?: string | null;
|
|
21
|
+
occurred_end?: string | null;
|
|
22
|
+
mentioned_at?: string | null;
|
|
23
|
+
document_id?: string | null;
|
|
24
|
+
metadata?: Record<string, string> | null;
|
|
25
|
+
chunk_id?: string | null;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Entity state with observations
|
|
29
|
+
*/
|
|
30
|
+
export interface EntityState {
|
|
31
|
+
entity_id: string;
|
|
32
|
+
canonical_name: string;
|
|
33
|
+
observations: Array<{
|
|
34
|
+
text: string;
|
|
35
|
+
mentioned_at?: string | null;
|
|
36
|
+
}>;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Chunk data
|
|
40
|
+
*/
|
|
41
|
+
export interface ChunkData {
|
|
42
|
+
id: string;
|
|
43
|
+
text: string;
|
|
44
|
+
chunk_index: number;
|
|
45
|
+
truncated?: boolean;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Recall response from Hindsight
|
|
49
|
+
*/
|
|
50
|
+
export interface RecallResponse {
|
|
51
|
+
results: RecallResult[];
|
|
52
|
+
trace?: Record<string, unknown> | null;
|
|
53
|
+
entities?: Record<string, EntityState> | null;
|
|
54
|
+
chunks?: Record<string, ChunkData> | null;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Reflect fact
|
|
58
|
+
*/
|
|
59
|
+
export interface ReflectFact {
|
|
60
|
+
id?: string | null;
|
|
61
|
+
text: string;
|
|
62
|
+
type?: string | null;
|
|
63
|
+
context?: string | null;
|
|
64
|
+
occurred_start?: string | null;
|
|
65
|
+
occurred_end?: string | null;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Reflect response from Hindsight
|
|
69
|
+
*/
|
|
70
|
+
export interface ReflectResponse {
|
|
71
|
+
text: string;
|
|
72
|
+
based_on?: ReflectFact[];
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Retain response from Hindsight
|
|
76
|
+
*/
|
|
77
|
+
export interface RetainResponse {
|
|
78
|
+
success: boolean;
|
|
79
|
+
bank_id: string;
|
|
80
|
+
items_count: number;
|
|
81
|
+
async: boolean;
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Mental model trigger configuration
|
|
85
|
+
*/
|
|
86
|
+
export interface MentalModelTrigger {
|
|
87
|
+
refresh_after_consolidation?: boolean;
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Mental model response from Hindsight
|
|
91
|
+
*/
|
|
92
|
+
export interface MentalModelResponse {
|
|
93
|
+
mental_model_id: string;
|
|
94
|
+
bank_id: string;
|
|
95
|
+
name?: string;
|
|
96
|
+
content?: string;
|
|
97
|
+
source_query?: string;
|
|
98
|
+
tags?: string[];
|
|
99
|
+
created_at: string;
|
|
100
|
+
updated_at: string;
|
|
101
|
+
trigger?: MentalModelTrigger;
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Create mental model response from Hindsight
|
|
105
|
+
*/
|
|
106
|
+
export interface CreateMentalModelResponse {
|
|
107
|
+
mental_model_id: string;
|
|
108
|
+
bank_id: string;
|
|
109
|
+
created_at: string;
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Document response from Hindsight
|
|
113
|
+
*/
|
|
114
|
+
export interface DocumentResponse {
|
|
115
|
+
id: string;
|
|
116
|
+
bank_id: string;
|
|
117
|
+
original_text: string;
|
|
118
|
+
content_hash: string | null;
|
|
119
|
+
created_at: string;
|
|
120
|
+
updated_at: string;
|
|
121
|
+
memory_unit_count: number;
|
|
122
|
+
tags?: string[];
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* Directive response from Hindsight
|
|
126
|
+
*/
|
|
127
|
+
export interface DirectiveResponse {
|
|
128
|
+
id: string;
|
|
129
|
+
bank_id: string;
|
|
130
|
+
name: string;
|
|
131
|
+
content: string;
|
|
132
|
+
priority: number;
|
|
133
|
+
is_active: boolean;
|
|
134
|
+
tags: string[];
|
|
135
|
+
created_at: string;
|
|
136
|
+
updated_at: string;
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* Create directive response from Hindsight
|
|
140
|
+
*/
|
|
141
|
+
export interface CreateDirectiveResponse {
|
|
142
|
+
id: string;
|
|
143
|
+
bank_id: string;
|
|
144
|
+
name: string;
|
|
145
|
+
content: string;
|
|
146
|
+
priority: number;
|
|
147
|
+
is_active: boolean;
|
|
148
|
+
tags: string[];
|
|
149
|
+
created_at: string;
|
|
150
|
+
updated_at: string;
|
|
151
|
+
}
|
|
152
|
+
/**
|
|
153
|
+
* Hindsight client interface - matches @vectorize-io/hindsight-client
|
|
154
|
+
*/
|
|
155
|
+
export interface HindsightClient {
|
|
156
|
+
retain(bankId: string, content: string, options?: {
|
|
157
|
+
timestamp?: Date | string;
|
|
158
|
+
context?: string;
|
|
159
|
+
metadata?: Record<string, string>;
|
|
160
|
+
documentId?: string;
|
|
161
|
+
tags?: string[];
|
|
162
|
+
async?: boolean;
|
|
163
|
+
}): Promise<RetainResponse>;
|
|
164
|
+
recall(bankId: string, query: string, options?: {
|
|
165
|
+
types?: string[];
|
|
166
|
+
maxTokens?: number;
|
|
167
|
+
budget?: Budget;
|
|
168
|
+
trace?: boolean;
|
|
169
|
+
queryTimestamp?: string;
|
|
170
|
+
includeEntities?: boolean;
|
|
171
|
+
maxEntityTokens?: number;
|
|
172
|
+
includeChunks?: boolean;
|
|
173
|
+
maxChunkTokens?: number;
|
|
174
|
+
}): Promise<RecallResponse>;
|
|
175
|
+
reflect(bankId: string, query: string, options?: {
|
|
176
|
+
context?: string;
|
|
177
|
+
budget?: Budget;
|
|
178
|
+
}): Promise<ReflectResponse>;
|
|
179
|
+
createMentalModel(bankId: string, options?: {
|
|
180
|
+
id?: string;
|
|
181
|
+
name?: string;
|
|
182
|
+
sourceQuery?: string;
|
|
183
|
+
tags?: string[];
|
|
184
|
+
maxTokens?: number;
|
|
185
|
+
trigger?: MentalModelTrigger;
|
|
186
|
+
}): Promise<CreateMentalModelResponse>;
|
|
187
|
+
getMentalModel(bankId: string, mentalModelId: string): Promise<MentalModelResponse>;
|
|
188
|
+
getDocument(bankId: string, documentId: string): Promise<DocumentResponse | null>;
|
|
189
|
+
createDirective(bankId: string, options: {
|
|
190
|
+
name: string;
|
|
191
|
+
content: string;
|
|
192
|
+
priority?: number;
|
|
193
|
+
isActive?: boolean;
|
|
194
|
+
tags?: string[];
|
|
195
|
+
}): Promise<CreateDirectiveResponse>;
|
|
196
|
+
getDirective(bankId: string, directiveId: string): Promise<DirectiveResponse | null>;
|
|
197
|
+
listDirectives(bankId: string, options?: {
|
|
198
|
+
tags?: string[];
|
|
199
|
+
tagsMatch?: 'any' | 'all' | 'exact';
|
|
200
|
+
activeOnly?: boolean;
|
|
201
|
+
limit?: number;
|
|
202
|
+
offset?: number;
|
|
203
|
+
}): Promise<{
|
|
204
|
+
directives: DirectiveResponse[];
|
|
205
|
+
total: number;
|
|
206
|
+
}>;
|
|
207
|
+
}
|
|
208
|
+
export interface HindsightToolsOptions {
|
|
209
|
+
/** Hindsight client instance */
|
|
210
|
+
client: HindsightClient;
|
|
211
|
+
/**
|
|
212
|
+
* Custom description for the retain tool.
|
|
213
|
+
*/
|
|
214
|
+
retainDescription?: string;
|
|
215
|
+
/**
|
|
216
|
+
* Custom description for the recall tool.
|
|
217
|
+
*/
|
|
218
|
+
recallDescription?: string;
|
|
219
|
+
/**
|
|
220
|
+
* Custom description for the reflect tool.
|
|
221
|
+
*/
|
|
222
|
+
reflectDescription?: string;
|
|
223
|
+
/**
|
|
224
|
+
* Custom description for the createMentalModel tool.
|
|
225
|
+
*/
|
|
226
|
+
createMentalModelDescription?: string;
|
|
227
|
+
/**
|
|
228
|
+
* Custom description for the queryMentalModel tool.
|
|
229
|
+
*/
|
|
230
|
+
queryMentalModelDescription?: string;
|
|
231
|
+
/**
|
|
232
|
+
* Custom description for the getDocument tool.
|
|
233
|
+
*/
|
|
234
|
+
getDocumentDescription?: string;
|
|
235
|
+
}
|
|
236
|
+
/**
|
|
237
|
+
* Creates AI SDK tools for Hindsight memory operations.
|
|
238
|
+
*
|
|
239
|
+
* Features:
|
|
240
|
+
* - Dynamic bank ID per call (supports multi-user/multi-bank scenarios)
|
|
241
|
+
* - Full API parameter support for retain, recall, and reflect
|
|
242
|
+
* - Ready to use with streamText, generateText, or ToolLoopAgent
|
|
243
|
+
*
|
|
244
|
+
* @example
|
|
245
|
+
* ```ts
|
|
246
|
+
* const tools = createHindsightTools({
|
|
247
|
+
* client: hindsightClient,
|
|
248
|
+
* });
|
|
249
|
+
*
|
|
250
|
+
* // Use with AI SDK
|
|
251
|
+
* const result = await generateText({
|
|
252
|
+
* model: openai('gpt-4'),
|
|
253
|
+
* tools,
|
|
254
|
+
* prompt: 'Remember that Alice loves hiking',
|
|
255
|
+
* });
|
|
256
|
+
* ```
|
|
257
|
+
*/
|
|
258
|
+
export declare function createHindsightTools({ client, retainDescription, recallDescription, reflectDescription, createMentalModelDescription, queryMentalModelDescription, getDocumentDescription, }: HindsightToolsOptions): {
|
|
259
|
+
retain: import("ai").Tool<{
|
|
260
|
+
bankId: string;
|
|
261
|
+
content: string;
|
|
262
|
+
documentId?: string | undefined;
|
|
263
|
+
timestamp?: string | undefined;
|
|
264
|
+
context?: string | undefined;
|
|
265
|
+
tags?: string[] | undefined;
|
|
266
|
+
metadata?: Record<string, string> | undefined;
|
|
267
|
+
}, {
|
|
268
|
+
success: boolean;
|
|
269
|
+
itemsCount: number;
|
|
270
|
+
}>;
|
|
271
|
+
recall: import("ai").Tool<{
|
|
272
|
+
bankId: string;
|
|
273
|
+
query: string;
|
|
274
|
+
types?: string[] | undefined;
|
|
275
|
+
maxTokens?: number | undefined;
|
|
276
|
+
budget?: "low" | "mid" | "high" | undefined;
|
|
277
|
+
queryTimestamp?: string | undefined;
|
|
278
|
+
includeEntities?: boolean | undefined;
|
|
279
|
+
includeChunks?: boolean | undefined;
|
|
280
|
+
}, {
|
|
281
|
+
results: RecallResult[];
|
|
282
|
+
entities?: Record<string, EntityState> | null;
|
|
283
|
+
}>;
|
|
284
|
+
reflect: import("ai").Tool<{
|
|
285
|
+
bankId: string;
|
|
286
|
+
query: string;
|
|
287
|
+
context?: string | undefined;
|
|
288
|
+
budget?: "low" | "mid" | "high" | undefined;
|
|
289
|
+
}, {
|
|
290
|
+
text: string;
|
|
291
|
+
basedOn?: ReflectFact[];
|
|
292
|
+
}>;
|
|
293
|
+
createMentalModel: import("ai").Tool<{
|
|
294
|
+
bankId: string;
|
|
295
|
+
mentalModelId?: string | undefined;
|
|
296
|
+
name?: string | undefined;
|
|
297
|
+
sourceQuery?: string | undefined;
|
|
298
|
+
tags?: string[] | undefined;
|
|
299
|
+
maxTokens?: number | undefined;
|
|
300
|
+
autoRefresh?: boolean | undefined;
|
|
301
|
+
}, {
|
|
302
|
+
mentalModelId: string;
|
|
303
|
+
createdAt: string;
|
|
304
|
+
}>;
|
|
305
|
+
queryMentalModel: import("ai").Tool<{
|
|
306
|
+
bankId: string;
|
|
307
|
+
mentalModelId: string;
|
|
308
|
+
}, {
|
|
309
|
+
content: string;
|
|
310
|
+
name?: string;
|
|
311
|
+
updatedAt: string;
|
|
312
|
+
}>;
|
|
313
|
+
getDocument: import("ai").Tool<{
|
|
314
|
+
bankId: string;
|
|
315
|
+
documentId: string;
|
|
316
|
+
}, {
|
|
317
|
+
originalText: string;
|
|
318
|
+
id: string;
|
|
319
|
+
createdAt: string;
|
|
320
|
+
updatedAt: string;
|
|
321
|
+
} | null>;
|
|
322
|
+
createDirective: import("ai").Tool<{
|
|
323
|
+
bankId: string;
|
|
324
|
+
name: string;
|
|
325
|
+
content: string;
|
|
326
|
+
priority?: number | undefined;
|
|
327
|
+
isActive?: boolean | undefined;
|
|
328
|
+
tags?: string[] | undefined;
|
|
329
|
+
}, {
|
|
330
|
+
id: string;
|
|
331
|
+
name: string;
|
|
332
|
+
content: string;
|
|
333
|
+
tags: string[];
|
|
334
|
+
createdAt: string;
|
|
335
|
+
}>;
|
|
336
|
+
getDirective: import("ai").Tool<{
|
|
337
|
+
bankId: string;
|
|
338
|
+
directiveId: string;
|
|
339
|
+
}, {
|
|
340
|
+
id: string;
|
|
341
|
+
name: string;
|
|
342
|
+
content: string;
|
|
343
|
+
tags: string[];
|
|
344
|
+
isActive: boolean;
|
|
345
|
+
} | null>;
|
|
346
|
+
};
|
|
347
|
+
export type HindsightTools = ReturnType<typeof createHindsightTools>;
|
|
@@ -0,0 +1,227 @@
|
|
|
1
|
+
import { tool } from 'ai';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
/**
|
|
4
|
+
* Budget levels for recall/reflect operations.
|
|
5
|
+
*/
|
|
6
|
+
export const BudgetSchema = z.enum(['low', 'mid', 'high']);
|
|
7
|
+
/**
|
|
8
|
+
* Creates AI SDK tools for Hindsight memory operations.
|
|
9
|
+
*
|
|
10
|
+
* Features:
|
|
11
|
+
* - Dynamic bank ID per call (supports multi-user/multi-bank scenarios)
|
|
12
|
+
* - Full API parameter support for retain, recall, and reflect
|
|
13
|
+
* - Ready to use with streamText, generateText, or ToolLoopAgent
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```ts
|
|
17
|
+
* const tools = createHindsightTools({
|
|
18
|
+
* client: hindsightClient,
|
|
19
|
+
* });
|
|
20
|
+
*
|
|
21
|
+
* // Use with AI SDK
|
|
22
|
+
* const result = await generateText({
|
|
23
|
+
* model: openai('gpt-4'),
|
|
24
|
+
* tools,
|
|
25
|
+
* prompt: 'Remember that Alice loves hiking',
|
|
26
|
+
* });
|
|
27
|
+
* ```
|
|
28
|
+
*/
|
|
29
|
+
export function createHindsightTools({ client, retainDescription, recallDescription, reflectDescription, createMentalModelDescription, queryMentalModelDescription, getDocumentDescription, }) {
|
|
30
|
+
const retainParams = z.object({
|
|
31
|
+
bankId: z.string().describe('Memory bank ID (usually the user ID)'),
|
|
32
|
+
content: z.string().describe('Content to store in memory'),
|
|
33
|
+
documentId: z.string().optional().describe('Optional document ID for grouping/upserting content'),
|
|
34
|
+
timestamp: z.string().optional().describe('Optional ISO timestamp for when the memory occurred'),
|
|
35
|
+
context: z.string().optional().describe('Optional context about the memory'),
|
|
36
|
+
tags: z.array(z.string()).optional().describe('Optional tags for visibility scoping'),
|
|
37
|
+
metadata: z.record(z.string(), z.string()).optional().describe('Optional user-defined metadata'),
|
|
38
|
+
});
|
|
39
|
+
const recallParams = z.object({
|
|
40
|
+
bankId: z.string().describe('Memory bank ID (usually the user ID)'),
|
|
41
|
+
query: z.string().describe('What to search for in memory'),
|
|
42
|
+
types: z.array(z.string()).optional().describe('Filter by fact types'),
|
|
43
|
+
maxTokens: z.number().optional().describe('Maximum tokens to return'),
|
|
44
|
+
budget: BudgetSchema.optional().describe('Processing budget: low, mid, or high'),
|
|
45
|
+
queryTimestamp: z.string().optional().describe('Query from a specific point in time (ISO format)'),
|
|
46
|
+
includeEntities: z.boolean().optional().describe('Include entity observations in results'),
|
|
47
|
+
includeChunks: z.boolean().optional().describe('Include raw chunks in results'),
|
|
48
|
+
});
|
|
49
|
+
const reflectParams = z.object({
|
|
50
|
+
bankId: z.string().describe('Memory bank ID (usually the user ID)'),
|
|
51
|
+
query: z.string().describe('Question to reflect on based on memories'),
|
|
52
|
+
context: z.string().optional().describe('Additional context for the reflection'),
|
|
53
|
+
budget: BudgetSchema.optional().describe('Processing budget: low, mid, or high'),
|
|
54
|
+
});
|
|
55
|
+
const createMentalModelParams = z.object({
|
|
56
|
+
bankId: z.string().describe('Memory bank ID (usually the user ID)'),
|
|
57
|
+
mentalModelId: z.string().optional().describe('Optional custom ID for the mental model (auto-generated if not provided)'),
|
|
58
|
+
name: z.string().optional().describe('Optional name for the mental model'),
|
|
59
|
+
sourceQuery: z.string().optional().describe('Query to define what memories to consolidate'),
|
|
60
|
+
tags: z.array(z.string()).optional().describe('Optional tags for organizing mental models'),
|
|
61
|
+
maxTokens: z.number().optional().describe('Maximum tokens for the mental model content'),
|
|
62
|
+
autoRefresh: z.boolean().optional().describe('Auto-refresh mental model after new consolidations (default: false)'),
|
|
63
|
+
});
|
|
64
|
+
const queryMentalModelParams = z.object({
|
|
65
|
+
bankId: z.string().describe('Memory bank ID (usually the user ID)'),
|
|
66
|
+
mentalModelId: z.string().describe('ID of the mental model to query'),
|
|
67
|
+
});
|
|
68
|
+
const getDocumentParams = z.object({
|
|
69
|
+
bankId: z.string().describe('Memory bank ID (usually the user ID)'),
|
|
70
|
+
documentId: z.string().describe('ID of the document to retrieve'),
|
|
71
|
+
});
|
|
72
|
+
const createDirectiveParams = z.object({
|
|
73
|
+
bankId: z.string().describe('Memory bank ID (usually the user ID)'),
|
|
74
|
+
name: z.string().describe('Human-readable name for the directive'),
|
|
75
|
+
content: z.string().describe('The directive text to inject into prompts'),
|
|
76
|
+
priority: z.number().optional().describe('Higher priority directives are injected first (default 0)'),
|
|
77
|
+
isActive: z.boolean().optional().describe('Whether this directive is active (default true)'),
|
|
78
|
+
tags: z.array(z.string()).optional().describe('Tags for filtering'),
|
|
79
|
+
});
|
|
80
|
+
const getDirectiveParams = z.object({
|
|
81
|
+
bankId: z.string().describe('Memory bank ID (usually the user ID)'),
|
|
82
|
+
directiveId: z.string().describe('ID of the directive to retrieve'),
|
|
83
|
+
});
|
|
84
|
+
return {
|
|
85
|
+
retain: tool({
|
|
86
|
+
description: retainDescription ??
|
|
87
|
+
`Store information in long-term memory. Use this when information should be remembered for future interactions, such as user preferences, facts, experiences, or important context.`,
|
|
88
|
+
inputSchema: retainParams,
|
|
89
|
+
execute: async (input) => {
|
|
90
|
+
console.log('[AI SDK Tool] Retain input:', {
|
|
91
|
+
bankId: input.bankId,
|
|
92
|
+
documentId: input.documentId,
|
|
93
|
+
tags: input.tags,
|
|
94
|
+
hasContent: !!input.content,
|
|
95
|
+
});
|
|
96
|
+
const result = await client.retain(input.bankId, input.content, {
|
|
97
|
+
documentId: input.documentId,
|
|
98
|
+
timestamp: input.timestamp,
|
|
99
|
+
context: input.context,
|
|
100
|
+
tags: input.tags,
|
|
101
|
+
metadata: input.metadata,
|
|
102
|
+
});
|
|
103
|
+
return { success: result.success, itemsCount: result.items_count };
|
|
104
|
+
},
|
|
105
|
+
}),
|
|
106
|
+
recall: tool({
|
|
107
|
+
description: recallDescription ??
|
|
108
|
+
`Search memory for relevant information. Use this to find previously stored information that can help personalize responses or provide context.`,
|
|
109
|
+
inputSchema: recallParams,
|
|
110
|
+
execute: async (input) => {
|
|
111
|
+
const result = await client.recall(input.bankId, input.query, {
|
|
112
|
+
types: input.types,
|
|
113
|
+
maxTokens: input.maxTokens,
|
|
114
|
+
budget: input.budget,
|
|
115
|
+
queryTimestamp: input.queryTimestamp,
|
|
116
|
+
includeEntities: input.includeEntities,
|
|
117
|
+
includeChunks: input.includeChunks,
|
|
118
|
+
});
|
|
119
|
+
return {
|
|
120
|
+
results: result.results ?? [],
|
|
121
|
+
entities: result.entities,
|
|
122
|
+
};
|
|
123
|
+
},
|
|
124
|
+
}),
|
|
125
|
+
reflect: tool({
|
|
126
|
+
description: reflectDescription ??
|
|
127
|
+
`Analyze memories to form insights and generate contextual answers. Use this to understand patterns, synthesize information, or answer questions that require reasoning over stored memories.`,
|
|
128
|
+
inputSchema: reflectParams,
|
|
129
|
+
execute: async (input) => {
|
|
130
|
+
const result = await client.reflect(input.bankId, input.query, {
|
|
131
|
+
context: input.context,
|
|
132
|
+
budget: input.budget,
|
|
133
|
+
});
|
|
134
|
+
return {
|
|
135
|
+
text: result.text ?? 'No insights available yet.',
|
|
136
|
+
basedOn: result.based_on,
|
|
137
|
+
};
|
|
138
|
+
},
|
|
139
|
+
}),
|
|
140
|
+
createMentalModel: tool({
|
|
141
|
+
description: createMentalModelDescription ??
|
|
142
|
+
`Create a mental model that automatically consolidates memories into structured knowledge. Mental models are continuously updated as new memories are added, making them ideal for maintaining up-to-date user preferences, behavioral patterns, and accumulated wisdom.`,
|
|
143
|
+
inputSchema: createMentalModelParams,
|
|
144
|
+
execute: async (input) => {
|
|
145
|
+
const result = await client.createMentalModel(input.bankId, {
|
|
146
|
+
id: input.mentalModelId,
|
|
147
|
+
name: input.name,
|
|
148
|
+
sourceQuery: input.sourceQuery,
|
|
149
|
+
tags: input.tags,
|
|
150
|
+
maxTokens: input.maxTokens,
|
|
151
|
+
trigger: input.autoRefresh !== undefined ? { refresh_after_consolidation: input.autoRefresh } : undefined,
|
|
152
|
+
});
|
|
153
|
+
return {
|
|
154
|
+
mentalModelId: result.mental_model_id,
|
|
155
|
+
createdAt: result.created_at,
|
|
156
|
+
};
|
|
157
|
+
},
|
|
158
|
+
}),
|
|
159
|
+
queryMentalModel: tool({
|
|
160
|
+
description: queryMentalModelDescription ??
|
|
161
|
+
`Query an existing mental model to retrieve consolidated knowledge. Mental models provide synthesized insights from memories, making them faster and more efficient than searching through raw memories.`,
|
|
162
|
+
inputSchema: queryMentalModelParams,
|
|
163
|
+
execute: async (input) => {
|
|
164
|
+
const result = await client.getMentalModel(input.bankId, input.mentalModelId);
|
|
165
|
+
return {
|
|
166
|
+
content: result.content ?? 'No content available yet.',
|
|
167
|
+
name: result.name,
|
|
168
|
+
updatedAt: result.updated_at,
|
|
169
|
+
};
|
|
170
|
+
},
|
|
171
|
+
}),
|
|
172
|
+
getDocument: tool({
|
|
173
|
+
description: getDocumentDescription ??
|
|
174
|
+
`Retrieve a stored document by its ID. Documents are used to store structured data like application state, user profiles, or any data that needs exact retrieval.`,
|
|
175
|
+
inputSchema: getDocumentParams,
|
|
176
|
+
execute: async (input) => {
|
|
177
|
+
const result = await client.getDocument(input.bankId, input.documentId);
|
|
178
|
+
if (!result) {
|
|
179
|
+
return null;
|
|
180
|
+
}
|
|
181
|
+
return {
|
|
182
|
+
originalText: result.original_text,
|
|
183
|
+
id: result.id,
|
|
184
|
+
createdAt: result.created_at,
|
|
185
|
+
updatedAt: result.updated_at,
|
|
186
|
+
};
|
|
187
|
+
},
|
|
188
|
+
}),
|
|
189
|
+
createDirective: tool({
|
|
190
|
+
description: `Create a directive - a hard rule that is injected into prompts during reflect operations. Directives are explicit instructions that guide agent behavior. Use tags to control when directives are applied (e.g., user-specific directives with 'user:username' tags).`,
|
|
191
|
+
inputSchema: createDirectiveParams,
|
|
192
|
+
execute: async (input) => {
|
|
193
|
+
const result = await client.createDirective(input.bankId, {
|
|
194
|
+
name: input.name,
|
|
195
|
+
content: input.content,
|
|
196
|
+
priority: input.priority,
|
|
197
|
+
isActive: input.isActive,
|
|
198
|
+
tags: input.tags,
|
|
199
|
+
});
|
|
200
|
+
return {
|
|
201
|
+
id: result.id,
|
|
202
|
+
name: result.name,
|
|
203
|
+
content: result.content,
|
|
204
|
+
tags: result.tags,
|
|
205
|
+
createdAt: result.created_at,
|
|
206
|
+
};
|
|
207
|
+
},
|
|
208
|
+
}),
|
|
209
|
+
getDirective: tool({
|
|
210
|
+
description: `Retrieve a directive by its ID. Returns the directive's content, tags, and active status.`,
|
|
211
|
+
inputSchema: getDirectiveParams,
|
|
212
|
+
execute: async (input) => {
|
|
213
|
+
const result = await client.getDirective(input.bankId, input.directiveId);
|
|
214
|
+
if (!result) {
|
|
215
|
+
return null;
|
|
216
|
+
}
|
|
217
|
+
return {
|
|
218
|
+
id: result.id,
|
|
219
|
+
name: result.name,
|
|
220
|
+
content: result.content,
|
|
221
|
+
tags: result.tags,
|
|
222
|
+
isActive: result.is_active,
|
|
223
|
+
};
|
|
224
|
+
},
|
|
225
|
+
}),
|
|
226
|
+
};
|
|
227
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@vectorize-io/hindsight-ai-sdk",
|
|
3
|
+
"version": "0.4.9",
|
|
4
|
+
"description": "Hindsight memory integration for Vercel AI SDK - Give your AI agents persistent, human-like memory",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
7
|
+
"type": "module",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"types": "./dist/index.d.ts",
|
|
11
|
+
"import": "./dist/index.js"
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
"keywords": [
|
|
15
|
+
"ai",
|
|
16
|
+
"ai-sdk",
|
|
17
|
+
"vercel",
|
|
18
|
+
"memory",
|
|
19
|
+
"hindsight",
|
|
20
|
+
"agents",
|
|
21
|
+
"llm",
|
|
22
|
+
"long-term-memory"
|
|
23
|
+
],
|
|
24
|
+
"author": "Vectorize <support@vectorize.io>",
|
|
25
|
+
"license": "MIT",
|
|
26
|
+
"repository": {
|
|
27
|
+
"type": "git",
|
|
28
|
+
"url": "https://github.com/vectorize-io/hindsight.git",
|
|
29
|
+
"directory": "hindsight-integrations/ai-sdk"
|
|
30
|
+
},
|
|
31
|
+
"files": [
|
|
32
|
+
"dist",
|
|
33
|
+
"README.md"
|
|
34
|
+
],
|
|
35
|
+
"scripts": {
|
|
36
|
+
"build": "tsc",
|
|
37
|
+
"dev": "tsc --watch",
|
|
38
|
+
"clean": "rm -rf dist",
|
|
39
|
+
"test": "vitest run",
|
|
40
|
+
"test:watch": "vitest",
|
|
41
|
+
"prepublishOnly": "npm run clean && npm run build"
|
|
42
|
+
},
|
|
43
|
+
"peerDependencies": {
|
|
44
|
+
"ai": "^6.0.0",
|
|
45
|
+
"zod": "^3.0.0 || ^4.0.0"
|
|
46
|
+
},
|
|
47
|
+
"devDependencies": {
|
|
48
|
+
"@types/node": "^22.0.0",
|
|
49
|
+
"@vitest/ui": "^4.0.18",
|
|
50
|
+
"ai": "^6.0.2",
|
|
51
|
+
"typescript": "^5.7.0",
|
|
52
|
+
"vitest": "^4.0.18",
|
|
53
|
+
"zod": "^4.2.0"
|
|
54
|
+
},
|
|
55
|
+
"engines": {
|
|
56
|
+
"node": ">=22"
|
|
57
|
+
}
|
|
58
|
+
}
|