telys_upsert
Insert new text rows and replace existing ones by external id, ensuring repeated calls converge without duplicates or conflicts. Ideal for idempotent document writes with versioned updates.
Instructions
Add-or-replace text rows by external id: new ids are inserted; existing ids are re-embedded and replaced as a versioned update (never a duplicate physical row), then persisted. Use when the caller owns the ids and a repeated call must converge instead of conflicting — this is the idempotent write path. Required: collection, texts, ids (explicit JSON null is treated as omitted = plain telys_add with generated ids). Optional: metadata (one object per text) and partition_by (default 'scope'; the collection is auto-created when absent). Fails on ids/texts length mismatch.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| ids | Yes | external ids, one per text; new ids insert, existing ids are replaced | |
| texts | Yes | documents to embed on-device; one row per text | |
| metadata | No | one object per text positionally; the partition key is defaulted when omitted | |
| collection | Yes | target collection; auto-created (with partition_by) when absent | |
| partition_by | No | partition key used when auto-creating the collection | scope |