@picsart/ai-sdk 3.35.6 → 4.0.0

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.
Files changed (4) hide show
  1. package/README.md +28 -0
  2. package/index.d.ts +292 -163
  3. package/index.js +263 -615
  4. package/package.json +1 -1
package/README.md CHANGED
@@ -144,6 +144,34 @@ catalog.find({ output: 'text' })
144
144
  image/video model throws, and `generate()` throws on a text model — use the matching
145
145
  method for each.
146
146
 
147
+ ## Voice & Avatar Catalogs
148
+
149
+ Models with catalog-backed params (voices, avatars) serve their option lists
150
+ from platform catalog tasks (`<vendor>/v1/catalog/<voices|avatars>`) — nothing
151
+ is bundled; the workers cache the lists and answer fast. Fetch them via
152
+ `ai.catalogs`:
153
+
154
+ ```typescript
155
+ // One page at a time — load more on scroll/pagination via nextCursor
156
+ const page = await ai.catalogs.voices('heygen-video-avatar')
157
+ // page: { items: CatalogItem[], nextCursor: string | null }
158
+ const more = await ai.catalogs.voices('heygen-video-avatar', { cursor: page.nextCursor! })
159
+
160
+ // Optional: preload the first page of every bound catalog at client creation
161
+ const ai = createClient({ apiKey, catalogs: { preload: true } })
162
+
163
+ // Fetched pages accumulate into the model's options, so existing accessors
164
+ // (and every picker built on them) see everything loaded so far:
165
+ Model('heygen-video-avatar').params().catalog('videoId')?.catalogOptions
166
+ ```
167
+
168
+ `CatalogItem` is the standard shape across all vendors:
169
+ `{ id, name, description?, tags, preview? { imageUrl | videoUrl | audioUrl }, meta? }` —
170
+ `id` is sent back verbatim as `voiceId` / `videoId` on generate. Validation
171
+ never requires hydration: catalog-bound params accept any id and the platform
172
+ validates for real. Migrating from self-fetched catalogs? See
173
+ `docs/DYNAMIC-CATALOGS-MIGRATION.md` at the pa-gen-ai-sdk repo root.
174
+
147
175
  ## Advanced Lifecycle
148
176
 
149
177
  For progress tracking, cancellation, and job recovery: