@picsart/ai-sdk 6.24.1 → 6.28.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.
- package/README.md +34 -0
- package/_vendor/workflows-types/index.d.ts +833 -536
- package/index.d.ts +76 -10
- package/index.js +242 -22
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -235,6 +235,40 @@ catalog.find({ output: 'text' })
|
|
|
235
235
|
image/video model throws, and `generate()` throws on a text model — use the matching
|
|
236
236
|
method for each.
|
|
237
237
|
|
|
238
|
+
## Generic Execution — ai.run()
|
|
239
|
+
|
|
240
|
+
`run()` executes any model by id and answers the task result generically — the
|
|
241
|
+
model-id counterpart of `ai.apis.run()` (which is keyed by API name). It works
|
|
242
|
+
on every model and runs one uniform path: paramConfig validation, vendor payload
|
|
243
|
+
build, workflow execution (sync or async), and the model's `outputSchema` when
|
|
244
|
+
one is declared. The result comes back as-is in `{ result, status, usage, id }` —
|
|
245
|
+
no media-URL or text extraction, no Drive save. Use `generate()`/`generateText()`
|
|
246
|
+
when you want the parsed media/text surfaces; use `run()` when you want the raw
|
|
247
|
+
task result — and for `mode: 'json'` models, `run()` is the only surface:
|
|
248
|
+
structured-output models (judges, evaluators, classifiers) are rejected by
|
|
249
|
+
`generate()`, `generateText()`, and the async lifecycle.
|
|
250
|
+
|
|
251
|
+
The first json model is `typesafe-evaluate` (`Models.TypesafeEvaluate`) — LLM-judge
|
|
252
|
+
evaluation of any content against named questions. Type the result via the `R`
|
|
253
|
+
generic, same as `ai.apis.run()`:
|
|
254
|
+
|
|
255
|
+
```typescript
|
|
256
|
+
interface EvaluateResult { model: string; answers: Record<string, unknown>; usage: unknown }
|
|
257
|
+
|
|
258
|
+
const { result } = await ai.run<EvaluateResult>(Models.TypesafeEvaluate, {
|
|
259
|
+
state: 'The weather is lovely and everyone is having a great time.',
|
|
260
|
+
questions: {
|
|
261
|
+
is_safe: { type: 'noul', instructions: 'Is this content safe for all audiences?' },
|
|
262
|
+
tone: { type: 'choice', instructions: 'Pick the tone.', options: ['positive', 'neutral', 'negative'] },
|
|
263
|
+
},
|
|
264
|
+
})
|
|
265
|
+
// result: { model: 'jev-1.13.0', answers: { is_safe: …, tone: … }, usage: { input_tokens, output_tokens } }
|
|
266
|
+
```
|
|
267
|
+
|
|
268
|
+
Question ids are caller-chosen; each question is `noul` (yes/no), `choice`, or
|
|
269
|
+
`score`, with type-specific extras (`options`, bounds — see the
|
|
270
|
+
[TypeSafe docs](https://docs.typesafe.ai/api)) passed through as-is.
|
|
271
|
+
|
|
238
272
|
## Voice, Avatar & Template Catalogs
|
|
239
273
|
|
|
240
274
|
Models with catalog-backed params (voices, avatars, effect / caption templates) serve their option lists
|