@fias/create-fias-plugin 1.2.1 → 1.3.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/package.json
CHANGED
|
@@ -175,7 +175,7 @@ function AISummarizer() {
|
|
|
175
175
|
|
|
176
176
|
async function summarize(text: string) {
|
|
177
177
|
await invoke({
|
|
178
|
-
entityId: '
|
|
178
|
+
entityId: { capability: 'text-standard' }, // a platform text capability — see "Choosing a text model" below
|
|
179
179
|
input: text, // what to process
|
|
180
180
|
systemPrompt: 'You are a concise summarizer. Return a 2-3 sentence summary.',
|
|
181
181
|
});
|
|
@@ -198,7 +198,44 @@ function AISummarizer() {
|
|
|
198
198
|
}
|
|
199
199
|
```
|
|
200
200
|
|
|
201
|
-
The `
|
|
201
|
+
The `systemPrompt` tells the AI how to behave — this is where your plugin's intelligence lives.
|
|
202
|
+
|
|
203
|
+
#### Choosing a text model
|
|
204
|
+
|
|
205
|
+
The `entityId` parameter accepts three forms. **Prefer the capability selector** over a hardcoded model id: the platform's models evolve and get retired, and a capability lets your plugin pick up the current best model automatically without a code edit. When the platform retires the model behind a capability, it re-points the capability — your plugin keeps working.
|
|
206
|
+
|
|
207
|
+
```tsx
|
|
208
|
+
// 1. By capability (recommended) — resolved to the platform's current model
|
|
209
|
+
// for that tier, and re-pointed automatically if that model is retired.
|
|
210
|
+
await invoke({
|
|
211
|
+
entityId: { capability: 'text-standard' }, // 'text-fast' | 'text-standard' | 'text-advanced'
|
|
212
|
+
input,
|
|
213
|
+
systemPrompt: '...',
|
|
214
|
+
});
|
|
215
|
+
|
|
216
|
+
// 2. AI router — let the platform pick a model per request based on the
|
|
217
|
+
// query's complexity. Optionally bias the tier with routingPreference.
|
|
218
|
+
await invoke({
|
|
219
|
+
entityId: 'ent_fias_ai',
|
|
220
|
+
input,
|
|
221
|
+
systemPrompt: '...',
|
|
222
|
+
routingPreference: 'cost', // 'auto' (default) | 'speed' | 'cost' | 'balanced' | 'performance'
|
|
223
|
+
});
|
|
224
|
+
|
|
225
|
+
// 3. A specific model id (back-compat) — pins one model. It will stop working
|
|
226
|
+
// if that model is retired; use a capability for retirement resilience.
|
|
227
|
+
await invoke({ entityId: 'ent_modeldef_haiku_45', input, systemPrompt: '...' });
|
|
228
|
+
```
|
|
229
|
+
|
|
230
|
+
The text capabilities:
|
|
231
|
+
|
|
232
|
+
| Capability | Use it for |
|
|
233
|
+
| --------------- | ---------------------------------------------------------------------------- |
|
|
234
|
+
| `text-fast` | Cheapest, fastest — classification, extraction, short responses, high volume |
|
|
235
|
+
| `text-standard` | Balanced, general-purpose text generation (the sensible default) |
|
|
236
|
+
| `text-advanced` | Most capable — complex reasoning, nuanced writing, long-form output |
|
|
237
|
+
|
|
238
|
+
Browse specific models with `npx fias-dev entities`.
|
|
202
239
|
|
|
203
240
|
### `useImageGeneration()` — Generate images via AI models
|
|
204
241
|
|
|
@@ -175,7 +175,7 @@ function AISummarizer() {
|
|
|
175
175
|
|
|
176
176
|
async function summarize(text: string) {
|
|
177
177
|
await invoke({
|
|
178
|
-
entityId: '
|
|
178
|
+
entityId: { capability: 'text-standard' }, // a platform text capability — see "Choosing a text model" below
|
|
179
179
|
input: text, // what to process
|
|
180
180
|
systemPrompt: 'You are a concise summarizer. Return a 2-3 sentence summary.',
|
|
181
181
|
});
|
|
@@ -198,7 +198,44 @@ function AISummarizer() {
|
|
|
198
198
|
}
|
|
199
199
|
```
|
|
200
200
|
|
|
201
|
-
The `
|
|
201
|
+
The `systemPrompt` tells the AI how to behave — this is where your plugin's intelligence lives.
|
|
202
|
+
|
|
203
|
+
#### Choosing a text model
|
|
204
|
+
|
|
205
|
+
The `entityId` parameter accepts three forms. **Prefer the capability selector** over a hardcoded model id: the platform's models evolve and get retired, and a capability lets your plugin pick up the current best model automatically without a code edit. When the platform retires the model behind a capability, it re-points the capability — your plugin keeps working.
|
|
206
|
+
|
|
207
|
+
```tsx
|
|
208
|
+
// 1. By capability (recommended) — resolved to the platform's current model
|
|
209
|
+
// for that tier, and re-pointed automatically if that model is retired.
|
|
210
|
+
await invoke({
|
|
211
|
+
entityId: { capability: 'text-standard' }, // 'text-fast' | 'text-standard' | 'text-advanced'
|
|
212
|
+
input,
|
|
213
|
+
systemPrompt: '...',
|
|
214
|
+
});
|
|
215
|
+
|
|
216
|
+
// 2. AI router — let the platform pick a model per request based on the
|
|
217
|
+
// query's complexity. Optionally bias the tier with routingPreference.
|
|
218
|
+
await invoke({
|
|
219
|
+
entityId: 'ent_fias_ai',
|
|
220
|
+
input,
|
|
221
|
+
systemPrompt: '...',
|
|
222
|
+
routingPreference: 'cost', // 'auto' (default) | 'speed' | 'cost' | 'balanced' | 'performance'
|
|
223
|
+
});
|
|
224
|
+
|
|
225
|
+
// 3. A specific model id (back-compat) — pins one model. It will stop working
|
|
226
|
+
// if that model is retired; use a capability for retirement resilience.
|
|
227
|
+
await invoke({ entityId: 'ent_modeldef_haiku_45', input, systemPrompt: '...' });
|
|
228
|
+
```
|
|
229
|
+
|
|
230
|
+
The text capabilities:
|
|
231
|
+
|
|
232
|
+
| Capability | Use it for |
|
|
233
|
+
| --------------- | ---------------------------------------------------------------------------- |
|
|
234
|
+
| `text-fast` | Cheapest, fastest — classification, extraction, short responses, high volume |
|
|
235
|
+
| `text-standard` | Balanced, general-purpose text generation (the sensible default) |
|
|
236
|
+
| `text-advanced` | Most capable — complex reasoning, nuanced writing, long-form output |
|
|
237
|
+
|
|
238
|
+
Browse specific models with `npx fias-dev entities`.
|
|
202
239
|
|
|
203
240
|
### `useImageGeneration()` — Generate images via AI models
|
|
204
241
|
|