@personize/sdk 0.5.1 → 0.5.2

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 CHANGED
@@ -43,8 +43,6 @@ console.log(me.data.plan.limits);
43
43
  | POST | `/api/v1/smart-recall` | `client.memory.smartRecall(opts)` |
44
44
  | POST | `/api/v1/recall` | `client.memory.recall(opts)` |
45
45
  | POST | `/api/v1/search` | `client.memory.search(opts)` |
46
- | POST | `/api/v1/upsert` | `client.memory.upsert(opts)` |
47
- | POST | `/api/v1/upsert` | `client.memory.upsertBatch(opts)` |
48
46
  | POST | `/api/v1/batch-memorize` | `client.memory.memorizeBatch(opts)` |
49
47
  | POST | `/api/v1/smart-memory-digest` | `client.memory.smartDigest(opts)` |
50
48
  | **Guidelines** | | |
@@ -170,8 +168,9 @@ console.log(research.data?.evaluation?.finalScore);
170
168
 
171
169
  ```typescript
172
170
  // Memorize content (dual extraction: structured + free-form)
171
+ // Tip: prepend identity field hints to ensure demographic properties are captured
173
172
  await client.memory.memorize({
174
- content: 'Meeting notes: John prefers email contact.',
173
+ content: 'Also extract First Name, Company Name, and Job Title if mentioned.\n\nMeeting notes: John prefers email contact. He is VP of Sales at Acme Corp.',
175
174
  speaker: 'Sales Rep',
176
175
  enhanced: true,
177
176
  tags: ['meetings'],
@@ -194,11 +193,14 @@ const fast = await client.memory.smartRecall({
194
193
  fast_mode: true,
195
194
  });
196
195
 
197
- // Direct recall — simple memory lookup (no reflection)
196
+ // Direct recall — DynamoDB lookup: properties + freeform memories (no AI, type required)
198
197
  const direct = await client.memory.recall({
199
198
  query: 'What do we know about Acme?',
199
+ type: 'Contact',
200
200
  email: 'john@acme.com',
201
201
  });
202
+ // direct.data.memories — structured properties from Snapshot
203
+ // direct.data.freeformMemories — AI-extracted memories from Freeform table
202
204
 
203
205
  // Search/filter records by property conditions
204
206
  const found = await client.memory.search({
@@ -209,15 +211,17 @@ const found = await client.memory.search({
209
211
  pageSize: 50,
210
212
  });
211
213
 
212
- // Batch sync — unified call with per-property extractMemories flag
214
+ // Batch sync — unified call with per-property extractMemories control
215
+ // IMPORTANT: Set extractMemories: true on rich text fields (notes, transcripts, descriptions)
216
+ // to enable AI extraction and semantic search. Without it, only structured storage occurs.
213
217
  await client.memory.memorizeBatch({
214
218
  source: 'Hubspot',
215
219
  mapping: {
216
220
  entityType: 'contact',
217
221
  email: 'email',
218
222
  properties: {
219
- email: { sourceField: 'email', collectionId: 'col_std', collectionName: 'Standard' },
220
- full_name: { sourceField: 'fullname', collectionId: 'col_std', collectionName: 'Standard' },
223
+ email: { sourceField: 'email', collectionId: 'col_std', collectionName: 'Standard', extractMemories: false },
224
+ full_name: { sourceField: 'fullname', collectionId: 'col_std', collectionName: 'Standard', extractMemories: false },
221
225
  notes: { sourceField: 'notes', collectionId: 'col_gen', collectionName: 'Generated', extractMemories: true },
222
226
  },
223
227
  },
@@ -234,16 +238,6 @@ const digest = await client.memory.smartDigest({
234
238
  });
235
239
  console.log(digest.data?.compiledContext); // ready-to-use markdown for LLM prompts
236
240
 
237
- // Structured upsert — no AI extraction
238
- await client.memory.upsert({
239
- type: 'Contact',
240
- properties: {
241
- email: { value: 'john@acme.com', collectionId: 'col_123' },
242
- company: { value: 'Acme Corp' },
243
- },
244
- matchKeys: { email: 'john@acme.com' },
245
- source: 'crm-sync',
246
- });
247
241
  ```
248
242
 
249
243
  ### Agents
@@ -336,7 +330,7 @@ const client = new Personize({
336
330
  **New in 0.4.0:**
337
331
  - `client.test()` — Verify API key validity
338
332
  - `client.agents.get(id)` — Get agent details and expected inputs
339
- - `client.memory.recall(opts)` — Direct memory lookup (no reflection, low latency)
333
+ - `client.memory.recall(opts)` — Direct DynamoDB lookup: properties + freeform memories (no AI)
340
334
  - `client.memory.search(opts)` — Search/filter records with `property`-based conditions
341
335
  - `client.evaluate.memorizationAccuracy(opts)` — Three-phase memorization evaluation
342
336
  - `attachments` on `PromptOptions` — Multimodal support (images, PDFs, documents)
package/dist/client.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { PersonizeConfig, ApiResponse, MeResponse, TestResponse, ListOptions, GuidelinesResponse, GuidelineSectionOptions, GuidelineUpdatePayload, GuidelineCreatePayload, GuidelineHistoryResponse, GuidelineHistoryOptions, CollectionsResponse, CollectionCreatePayload, CollectionUpdatePayload, CollectionHistoryOptions, CollectionHistoryResponse, SmartGuidelinesOptions, SmartGuidelinesResponse, PromptOptions, PromptResponse, AgentRunOptions, AgentResponse, MemorizeOptions, SmartRecallOptions, RecallOptions, SearchOptions, SearchResponse, UpsertOptions, UpsertBatchOptions, BatchMemorizeOptions, SmartDigestOptions, SmartDigestResponse, EvaluateMemorizationOptions, EvaluateMemorizationResponse } from './types';
1
+ import { PersonizeConfig, ApiResponse, MeResponse, TestResponse, ListOptions, GuidelinesResponse, GuidelineSectionOptions, GuidelineUpdatePayload, GuidelineCreatePayload, GuidelineHistoryResponse, GuidelineHistoryOptions, CollectionsResponse, CollectionCreatePayload, CollectionUpdatePayload, CollectionHistoryOptions, CollectionHistoryResponse, SmartGuidelinesOptions, SmartGuidelinesResponse, PromptOptions, PromptResponse, AgentRunOptions, AgentResponse, MemorizeOptions, SmartRecallOptions, RecallOptions, SearchOptions, SearchResponse, BatchMemorizeOptions, SmartDigestOptions, SmartDigestResponse, EvaluateMemorizationOptions, EvaluateMemorizationResponse } from './types';
2
2
  export declare class Personize {
3
3
  private client;
4
4
  private _organizationId?;
@@ -121,14 +121,6 @@ export declare class Personize {
121
121
  * Returns matching record IDs with optional property values and memories.
122
122
  */
123
123
  search: (data: SearchOptions) => Promise<ApiResponse<SearchResponse>>;
124
- /**
125
- * POST /api/v1/upsert — Structured upsert (no AI extraction)
126
- */
127
- upsert: (data: UpsertOptions) => Promise<ApiResponse>;
128
- /**
129
- * POST /api/v1/upsert — Batch upsert (memories array format)
130
- */
131
- upsertBatch: (data: UpsertBatchOptions) => Promise<ApiResponse>;
132
124
  /**
133
125
  * POST /api/v1/batch-memorize — Unified batch sync with per-property extractMemories flag.
134
126
  * Properties with extractMemories: true go through AI extraction + vectors.
package/dist/client.js CHANGED
@@ -227,28 +227,6 @@ class Personize {
227
227
  const response = await this.client.post('/api/v1/search', data);
228
228
  return response.data;
229
229
  },
230
- /**
231
- * POST /api/v1/upsert — Structured upsert (no AI extraction)
232
- */
233
- upsert: async (data) => {
234
- const organizationId = await this.getOrganizationId();
235
- const response = await this.client.post('/api/v1/upsert', {
236
- ...data,
237
- orgId: organizationId,
238
- });
239
- return response.data;
240
- },
241
- /**
242
- * POST /api/v1/upsert — Batch upsert (memories array format)
243
- */
244
- upsertBatch: async (data) => {
245
- const organizationId = await this.getOrganizationId();
246
- const response = await this.client.post('/api/v1/upsert', {
247
- ...data,
248
- orgId: organizationId,
249
- });
250
- return response.data;
251
- },
252
230
  /**
253
231
  * POST /api/v1/batch-memorize — Unified batch sync with per-property extractMemories flag.
254
232
  * Properties with extractMemories: true go through AI extraction + vectors.
package/dist/types.d.ts CHANGED
@@ -598,6 +598,8 @@ export type RecallProOptions = SmartRecallOptions;
598
598
  export interface RecallOptions {
599
599
  /** Natural-language query. */
600
600
  query: string;
601
+ /** Entity type (e.g. 'Contact', 'Company'). Required by the /recall endpoint. */
602
+ type: string;
601
603
  /** CRM record ID for entity scoping. */
602
604
  record_id?: string;
603
605
  /** Filter results to a specific entity by email. */
@@ -607,40 +609,6 @@ export interface RecallOptions {
607
609
  /** Additional filters. */
608
610
  filters?: Record<string, unknown>;
609
611
  }
610
- export interface UpsertOptions {
611
- /** Entity type (e.g. 'Contact', 'Company') */
612
- type: string;
613
- /** Properties to store: { propertyName: { value, collectionId?, collectionName? } } */
614
- properties: Record<string, {
615
- value: PropertyValue;
616
- collectionId?: string;
617
- collectionName?: string;
618
- }>;
619
- /** Match keys for dedup (e.g. { email: 'john@example.com' }) */
620
- matchKeys?: {
621
- email?: string;
622
- websiteUrl?: string;
623
- };
624
- /** Source label (e.g. 'CRM Sync') */
625
- source?: string;
626
- }
627
- export interface UpsertBatchOptions {
628
- /** Entity type */
629
- type: string;
630
- /** Array of memory items to upsert */
631
- memories: Array<{
632
- memoryName: string;
633
- result: PropertyValue | Record<string, unknown>;
634
- collection?: string;
635
- collectionId?: string;
636
- }>;
637
- /** Contact email for record matching */
638
- email?: string;
639
- /** Company website for record matching */
640
- websiteUrl?: string;
641
- /** Source label */
642
- source?: string;
643
- }
644
612
  export interface BatchMemorizePropertyMapping {
645
613
  /** Source field name in the row data */
646
614
  sourceField: string;
@@ -648,7 +616,7 @@ export interface BatchMemorizePropertyMapping {
648
616
  collectionId: string;
649
617
  /** Target collection name */
650
618
  collectionName: string;
651
- /** If true, AI extraction + vector embeddings are created for this property. Default: false (structured storage only). */
619
+ /** AI extraction + vector embeddings for this property. Default: false. Set to true for rich text fields (notes, transcripts, descriptions) that benefit from AI extraction and semantic search. */
652
620
  extractMemories?: boolean;
653
621
  }
654
622
  export interface BatchMemorizeMapping {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@personize/sdk",
3
- "version": "0.5.1",
3
+ "version": "0.5.2",
4
4
  "description": "Official Personize SDK",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",