@personize/sdk 0.5.1 → 0.5.3

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
@@ -561,10 +561,14 @@ export interface SmartRecallOptions {
561
561
  minScore?: number;
562
562
  /** CRM record ID for entity scoping. */
563
563
  record_id?: string;
564
+ /** CRM record ID (camelCase alias). */
565
+ recordId?: string;
564
566
  /** Filter results to a specific entity by email. */
565
567
  email?: string;
566
568
  /** Website URL for entity scoping. */
567
569
  website_url?: string;
570
+ /** Website URL (camelCase alias). */
571
+ websiteUrl?: string;
568
572
  /** Entity type filter (e.g. 'Contact', 'Company'). */
569
573
  type?: string;
570
574
  /** Scope results to specific collections by ID. */
@@ -598,49 +602,21 @@ export type RecallProOptions = SmartRecallOptions;
598
602
  export interface RecallOptions {
599
603
  /** Natural-language query. */
600
604
  query: string;
605
+ /** Entity type (e.g. 'Contact', 'Company'). Required by the /recall endpoint. */
606
+ type: string;
601
607
  /** CRM record ID for entity scoping. */
602
608
  record_id?: string;
609
+ /** CRM record ID (camelCase alias). */
610
+ recordId?: string;
603
611
  /** Filter results to a specific entity by email. */
604
612
  email?: string;
605
613
  /** Website URL for entity scoping. */
606
614
  website_url?: string;
615
+ /** Website URL (camelCase alias). */
616
+ websiteUrl?: string;
607
617
  /** Additional filters. */
608
618
  filters?: Record<string, unknown>;
609
619
  }
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
620
  export interface BatchMemorizePropertyMapping {
645
621
  /** Source field name in the row data */
646
622
  sourceField: string;
@@ -648,7 +624,7 @@ export interface BatchMemorizePropertyMapping {
648
624
  collectionId: string;
649
625
  /** Target collection name */
650
626
  collectionName: string;
651
- /** If true, AI extraction + vector embeddings are created for this property. Default: false (structured storage only). */
627
+ /** 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
628
  extractMemories?: boolean;
653
629
  }
654
630
  export interface BatchMemorizeMapping {
@@ -678,20 +654,32 @@ export interface BatchMemorizeOptions {
678
654
  export interface SmartDigestOptions {
679
655
  /** CRM record ID */
680
656
  record_id?: string;
657
+ /** CRM record ID (camelCase alias). */
658
+ recordId?: string;
681
659
  /** Contact email */
682
660
  email?: string;
683
661
  /** Company website URL */
684
662
  website_url?: string;
663
+ /** Website URL (camelCase alias). */
664
+ websiteUrl?: string;
685
665
  /** Entity type ('Contact', 'Company'). Auto-inferred if omitted. */
686
666
  type?: string;
687
667
  /** Max tokens for compiled context (default: 1000) */
688
668
  token_budget?: number;
669
+ /** Max tokens (camelCase alias). */
670
+ tokenBudget?: number;
689
671
  /** Max free-form memories to include (default: 20) */
690
672
  max_memories?: number;
673
+ /** Max memories (camelCase alias). */
674
+ maxMemories?: number;
691
675
  /** Include DynamoDB property snapshot (default: true) */
692
676
  include_properties?: boolean;
677
+ /** Include properties (camelCase alias). */
678
+ includeProperties?: boolean;
693
679
  /** Include LanceDB free-form memories (default: true) */
694
680
  include_memories?: boolean;
681
+ /** Include memories (camelCase alias). */
682
+ includeMemories?: boolean;
695
683
  }
696
684
  export interface SmartDigestResponse {
697
685
  success: boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@personize/sdk",
3
- "version": "0.5.1",
3
+ "version": "0.5.3",
4
4
  "description": "Official Personize SDK",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",