@jerome-benoit/sap-ai-provider-v2 4.9.1 → 5.0.1
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 +114 -66
- package/dist/{chunk-5ZKQJNHO.js → chunk-2KOXKYVT.js} +482 -220
- package/dist/chunk-2KOXKYVT.js.map +1 -0
- package/dist/{chunk-5EDF6MHL.js → chunk-643USI3B.js} +8 -7
- package/dist/chunk-643USI3B.js.map +1 -0
- package/dist/{chunk-VHZSAQBJ.js → chunk-AFZC2DH2.js} +2 -2
- package/dist/chunk-AFZC2DH2.js.map +1 -0
- package/dist/{chunk-5JVF4555.js → chunk-JRUSQTKB.js} +3 -3
- package/dist/{chunk-4JIMBRMV.js → chunk-MF3VO3ER.js} +154 -20
- package/dist/chunk-MF3VO3ER.js.map +1 -0
- package/dist/{chunk-RJFB6VFO.js → chunk-U23M3VYO.js} +2 -2
- package/dist/{foundation-models-embedding-model-strategy-VKBRG7RT.js → foundation-models-embedding-model-strategy-2GUADNXT.js} +4 -4
- package/dist/{foundation-models-language-model-strategy-FBGKZSTU.js → foundation-models-language-model-strategy-5AYZ5KHA.js} +5 -5
- package/dist/index.cjs +712 -352
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1680 -34
- package/dist/index.d.ts +1680 -34
- package/dist/index.js +13 -14
- package/dist/index.js.map +1 -1
- package/dist/{orchestration-embedding-model-strategy-DVPO2TP3.js → orchestration-embedding-model-strategy-F7WHDLX7.js} +5 -5
- package/dist/{orchestration-language-model-strategy-KEJWB4E2.js → orchestration-language-model-strategy-Z72AFW62.js} +42 -78
- package/dist/orchestration-language-model-strategy-Z72AFW62.js.map +1 -0
- package/package.json +30 -22
- package/dist/chunk-4JIMBRMV.js.map +0 -1
- package/dist/chunk-5EDF6MHL.js.map +0 -1
- package/dist/chunk-5ZKQJNHO.js.map +0 -1
- package/dist/chunk-VHZSAQBJ.js.map +0 -1
- package/dist/orchestration-language-model-strategy-KEJWB4E2.js.map +0 -1
- /package/dist/{chunk-5JVF4555.js.map → chunk-JRUSQTKB.js.map} +0 -0
- /package/dist/{chunk-RJFB6VFO.js.map → chunk-U23M3VYO.js.map} +0 -0
- /package/dist/{foundation-models-embedding-model-strategy-VKBRG7RT.js.map → foundation-models-embedding-model-strategy-2GUADNXT.js.map} +0 -0
- /package/dist/{foundation-models-language-model-strategy-FBGKZSTU.js.map → foundation-models-language-model-strategy-5AYZ5KHA.js.map} +0 -0
- /package/dist/{orchestration-embedding-model-strategy-DVPO2TP3.js.map → orchestration-embedding-model-strategy-F7WHDLX7.js.map} +0 -0
package/README.md
CHANGED
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
[](https://www.npmjs.com/package/@jerome-benoit/sap-ai-provider)
|
|
4
4
|
[](https://opensource.org/licenses/Apache-2.0)
|
|
5
|
-
[](https://sdk.vercel.ai/docs)
|
|
6
|
+
[](https://sdk.vercel.ai/docs/ai-sdk-core/provider-management)
|
|
7
|
+
[](https://sdk.vercel.ai/docs/ai-sdk-core/embeddings)
|
|
8
8
|
|
|
9
9
|
A community provider for SAP AI Core that integrates seamlessly with the Vercel
|
|
10
10
|
AI SDK. Built on top of the official **@sap-ai-sdk/orchestration** and
|
|
@@ -46,6 +46,7 @@ SAP's enterprise-grade AI models through the familiar Vercel AI SDK interface.
|
|
|
46
46
|
- [Debug Mode](#debug-mode)
|
|
47
47
|
- [Examples](#examples)
|
|
48
48
|
- [Migration Guides](#migration-guides)
|
|
49
|
+
- [Upgrading from v4.x to v5.x](#upgrading-from-v4x-to-v5x)
|
|
49
50
|
- [Upgrading from v3.x to v4.x](#upgrading-from-v3x-to-v4x)
|
|
50
51
|
- [Upgrading from v2.x to v3.x](#upgrading-from-v2x-to-v3x)
|
|
51
52
|
- [Upgrading from v1.x to v2.x](#upgrading-from-v1x-to-v2x)
|
|
@@ -70,8 +71,8 @@ SAP's enterprise-grade AI models through the familiar Vercel AI SDK interface.
|
|
|
70
71
|
- 🛡️ **Content Filtering** - Azure Content Safety and Llama Guard support
|
|
71
72
|
- 🔧 **TypeScript Support** - Full type safety and IntelliSense
|
|
72
73
|
- 🎨 **Multiple Models** - Support for OpenAI, Claude, Gemini, Nova, and more
|
|
73
|
-
-
|
|
74
|
-
|
|
74
|
+
- 🔄 **AI SDK 5–7 Compatibility** - Versioned V2, V3, and V4 entrypoints
|
|
75
|
+
preserve the matching Vercel AI SDK provider specification
|
|
75
76
|
- 📊 **Text Embeddings** - Generate vector embeddings for RAG and semantic
|
|
76
77
|
search
|
|
77
78
|
- 🔀 **Dual API Support** - Choose between Orchestration or Foundation Models
|
|
@@ -82,7 +83,7 @@ SAP's enterprise-grade AI models through the familiar Vercel AI SDK interface.
|
|
|
82
83
|
## Quick Start
|
|
83
84
|
|
|
84
85
|
```bash
|
|
85
|
-
npm install @jerome-benoit/sap-ai-provider ai
|
|
86
|
+
npm install @jerome-benoit/sap-ai-provider ai@^6 dotenv
|
|
86
87
|
```
|
|
87
88
|
|
|
88
89
|
```typescript
|
|
@@ -119,58 +120,73 @@ try {
|
|
|
119
120
|
|
|
120
121
|
| Task | Code Pattern | Documentation |
|
|
121
122
|
| ------------------- | ---------------------------------------------------------------- | ------------------------------------------------------------- |
|
|
122
|
-
| **Install** | `npm install @jerome-benoit/sap-ai-provider ai`
|
|
123
|
+
| **Install** | `npm install @jerome-benoit/sap-ai-provider ai@^6` | [Installation](#installation) |
|
|
123
124
|
| **Auth Setup** | Add `AICORE_SERVICE_KEY` to `.env` | [Environment Setup](./ENVIRONMENT_SETUP.md) |
|
|
124
125
|
| **Create Provider** | `createSAPAIProvider()` or use `sapai` | [Provider Creation](#provider-creation) |
|
|
125
126
|
| **Text Generation** | `generateText({ model: provider("gpt-4.1"), prompt })` | [Basic Usage](#text-generation) |
|
|
126
127
|
| **Streaming** | `streamText({ model: provider("gpt-4.1"), prompt })` | [Streaming](#streaming-responses) |
|
|
127
128
|
| **Tool Calling** | `generateText({ tools: { myTool: tool({...}) } })` | [Tool Calling](#tool-calling) |
|
|
128
|
-
| **Error Handling** | `
|
|
129
|
+
| **Error Handling** | `if (APICallError.isInstance(error)) { /* handle error */ }` | [API Reference](./API_REFERENCE.md#error-handling--reference) |
|
|
129
130
|
| **Choose Model** | See 80+ models (GPT, Claude, Gemini, Llama) | [Models](./API_REFERENCE.md#models) |
|
|
130
131
|
| **Embeddings** | `embed({ model: provider.embedding("text-embedding-3-small") })` | [Embeddings](#embeddings) |
|
|
131
132
|
|
|
132
133
|
## Installation
|
|
133
134
|
|
|
134
|
-
**Requirements:** Node.js
|
|
135
|
+
**Requirements:** Node.js 22.12+. The provider entrypoint must match the installed
|
|
136
|
+
AI SDK major.
|
|
137
|
+
|
|
138
|
+
The published package targets Node.js. Its ESM output uses Node
|
|
139
|
+
`module.createRequire`, and the SAP SDK dependency chain relies on Node APIs.
|
|
140
|
+
The source-level Edge test suite does not establish deployability to pure Edge
|
|
141
|
+
runtimes such as Cloudflare Workers; use a Node.js server runtime for deployment.
|
|
142
|
+
|
|
143
|
+
| AI SDK | Install | Provider import |
|
|
144
|
+
| ------ | -------------------------------------------------- | ----------------------------------- |
|
|
145
|
+
| 7 | `npm install @jerome-benoit/sap-ai-provider ai@^7` | `@jerome-benoit/sap-ai-provider/v4` |
|
|
146
|
+
| 6 | `npm install @jerome-benoit/sap-ai-provider ai@^6` | `@jerome-benoit/sap-ai-provider` |
|
|
147
|
+
| 5 | `npm install @jerome-benoit/sap-ai-provider ai@^5` | `@jerome-benoit/sap-ai-provider/v2` |
|
|
148
|
+
|
|
149
|
+
The Quick Start and inline snippets on this page use AI SDK 6 with the root V3
|
|
150
|
+
entrypoint. The runnable files in `examples/` use the repository's installed
|
|
151
|
+
AI SDK 7 with the V4 entrypoint.
|
|
152
|
+
For AI SDK 7, install `ai@^7` and import `createSAPAIProvider` or `sapai`
|
|
153
|
+
from `@jerome-benoit/sap-ai-provider/v4`:
|
|
135
154
|
|
|
136
155
|
```bash
|
|
137
|
-
npm install @jerome-benoit/sap-ai-provider ai
|
|
156
|
+
npm install @jerome-benoit/sap-ai-provider ai@^7
|
|
138
157
|
```
|
|
139
158
|
|
|
140
|
-
|
|
159
|
+
The V4 entrypoint exposes the same provider aliases and version-independent
|
|
160
|
+
helpers as the root V3 entrypoint. Its standardized `reasoning` option maps to
|
|
161
|
+
SAP's `reasoning_effort` model parameter. `provider-default` preserves an
|
|
162
|
+
explicit `modelParams.reasoning_effort`; a stored `orchestrationConfigRef` owns
|
|
163
|
+
the model configuration and ignores local reasoning options with a warning.
|
|
164
|
+
See the [V4 API reference](./API_REFERENCE.md#v4-facade-api-ai-sdk-7) for the
|
|
165
|
+
full normalization and precedence contract.
|
|
166
|
+
|
|
167
|
+
**V2 facade:** AI SDK 5, AI SDK 6 through its V2 compatibility layer, and other `LanguageModelV2`/`EmbeddingModelV2`
|
|
168
|
+
consumers can use the main package's `v2` subpath or the dedicated V2 package:
|
|
141
169
|
|
|
142
170
|
```bash
|
|
143
|
-
|
|
144
|
-
|
|
171
|
+
npm install @jerome-benoit/sap-ai-provider ai@^5
|
|
172
|
+
# Alternatively: npm install @jerome-benoit/sap-ai-provider-v2 ai@^5
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
Both entrypoints expose the same V2 facade:
|
|
145
176
|
|
|
146
|
-
|
|
147
|
-
|
|
177
|
+
```typescript
|
|
178
|
+
import { createSAPAIProvider } from "@jerome-benoit/sap-ai-provider/v2";
|
|
179
|
+
// Dedicated-package alternative:
|
|
180
|
+
// import { createSAPAIProvider } from "@jerome-benoit/sap-ai-provider-v2";
|
|
148
181
|
```
|
|
149
182
|
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
>
|
|
158
|
-
> Basic Usage Example:
|
|
159
|
-
>
|
|
160
|
-
> ```typescript
|
|
161
|
-
> import { createSAPAIProvider } from "@jerome-benoit/sap-ai-provider-v2";
|
|
162
|
-
> import { generateText } from "ai";
|
|
163
|
-
>
|
|
164
|
-
> const provider = createSAPAIProvider();
|
|
165
|
-
> const result = await generateText({
|
|
166
|
-
> model: provider("gpt-4.1"),
|
|
167
|
-
> prompt: "Hello V2!",
|
|
168
|
-
> });
|
|
169
|
-
> console.log(result.text);
|
|
170
|
-
> ```
|
|
171
|
-
>
|
|
172
|
-
> For a detailed understanding of the dual-package architecture, refer to
|
|
173
|
-
> [Architecture - Dual-Package](./ARCHITECTURE.md#dual-package-architecture-v3--v2).
|
|
183
|
+
The V2 type contracts are bundled at build time; neither package installs a second
|
|
184
|
+
provider package through the `@ai-sdk/provider-v2` alias. When using V2 with AI SDK 6,
|
|
185
|
+
use the latest 6.x patch: the initial 6.0.0 embedding compatibility adapter has an
|
|
186
|
+
upstream warning-handling failure that is absent in 6.0.280.
|
|
187
|
+
|
|
188
|
+
See [Architecture - Versioned Packages](./ARCHITECTURE.md#versioned-package-architecture-v4--v3--v2)
|
|
189
|
+
for the V4/V3/V2 packaging model.
|
|
174
190
|
|
|
175
191
|
## Provider Creation
|
|
176
192
|
|
|
@@ -259,7 +275,7 @@ The provider is callable and also exposes explicit methods:
|
|
|
259
275
|
const chatModel = provider("gpt-4.1");
|
|
260
276
|
|
|
261
277
|
// Explicit method syntax
|
|
262
|
-
const
|
|
278
|
+
const explicitChatModel = provider.chat("gpt-4.1");
|
|
263
279
|
const embeddingModel = provider.embedding("text-embedding-3-small");
|
|
264
280
|
```
|
|
265
281
|
|
|
@@ -275,11 +291,11 @@ const embeddingModel = provider.embedding("text-embedding-3-small");
|
|
|
275
291
|
| `provider.textEmbeddingModel(modelId)` | Creates embedding model (alias) |
|
|
276
292
|
|
|
277
293
|
> `embedding()` and `embeddingModel()` are identical. `textEmbeddingModel()` is
|
|
278
|
-
> deprecated in the V3
|
|
294
|
+
> deprecated in the V3 and V4 entrypoints — use `embeddingModel()` instead.
|
|
279
295
|
>
|
|
280
296
|
> **Note:** The V2 facade package (`@jerome-benoit/sap-ai-provider-v2`) only exposes
|
|
281
297
|
> `textEmbeddingModel()` for embeddings per the `ProviderV2` specification. Use the
|
|
282
|
-
> V3
|
|
298
|
+
> V3 root with AI SDK 6 or V4 subpath with AI SDK 7 if you need these aliases.
|
|
283
299
|
|
|
284
300
|
## Authentication
|
|
285
301
|
|
|
@@ -340,20 +356,26 @@ import { streamText } from "ai";
|
|
|
340
356
|
import { APICallError } from "@ai-sdk/provider";
|
|
341
357
|
|
|
342
358
|
try {
|
|
359
|
+
let streamError: unknown;
|
|
343
360
|
const result = streamText({
|
|
344
361
|
model: provider("gpt-4.1"),
|
|
345
362
|
prompt: "Explain machine learning concepts.",
|
|
363
|
+
onError({ error }) {
|
|
364
|
+
streamError = error;
|
|
365
|
+
},
|
|
346
366
|
});
|
|
347
367
|
|
|
348
368
|
for await (const delta of result.textStream) {
|
|
349
369
|
process.stdout.write(delta);
|
|
350
370
|
}
|
|
351
371
|
|
|
352
|
-
//
|
|
353
|
-
|
|
354
|
-
|
|
372
|
+
// textStream does not throw stream errors; preserve the original API error.
|
|
373
|
+
if (streamError !== undefined) throw streamError;
|
|
374
|
+
|
|
375
|
+
// streamText returns a result object; its usage property is a promise.
|
|
376
|
+
console.log("\n\nUsage:", await result.usage);
|
|
355
377
|
} catch (error) {
|
|
356
|
-
if (error
|
|
378
|
+
if (APICallError.isInstance(error)) {
|
|
357
379
|
console.error("API Error:", error.message);
|
|
358
380
|
// See Error Handling section for complete error type reference
|
|
359
381
|
}
|
|
@@ -461,7 +483,7 @@ modules.
|
|
|
461
483
|
[examples/example-chat-completion-tool.ts](./examples/example-chat-completion-tool.ts)
|
|
462
484
|
|
|
463
485
|
```typescript
|
|
464
|
-
import { generateText, tool } from "ai";
|
|
486
|
+
import { generateText, stepCountIs, tool } from "ai";
|
|
465
487
|
import { z } from "zod";
|
|
466
488
|
import { createSAPAIProvider } from "@jerome-benoit/sap-ai-provider";
|
|
467
489
|
|
|
@@ -469,7 +491,7 @@ const provider = createSAPAIProvider();
|
|
|
469
491
|
|
|
470
492
|
const weatherTool = tool({
|
|
471
493
|
description: "Get weather for a location",
|
|
472
|
-
|
|
494
|
+
inputSchema: z.object({ location: z.string() }),
|
|
473
495
|
execute: async (args) => `Weather in ${args.location}: sunny, 72°F`,
|
|
474
496
|
});
|
|
475
497
|
|
|
@@ -477,7 +499,7 @@ const result = await generateText({
|
|
|
477
499
|
model: provider("gpt-4.1"),
|
|
478
500
|
prompt: "What's the weather in Tokyo?",
|
|
479
501
|
tools: { getWeather: weatherTool },
|
|
480
|
-
|
|
502
|
+
stopWhen: stepCountIs(3),
|
|
481
503
|
});
|
|
482
504
|
```
|
|
483
505
|
|
|
@@ -611,7 +633,10 @@ const model = provider("gpt-4.1");
|
|
|
611
633
|
### Provider Options (Per-Call Overrides)
|
|
612
634
|
|
|
613
635
|
Override constructor settings on a per-call basis using `providerOptions`.
|
|
614
|
-
|
|
636
|
+
Only the documented per-call fields are supported: unknown top-level fields
|
|
637
|
+
are stripped by the Zod schemas, while additional `modelParams` keys pass
|
|
638
|
+
through. Standard AI SDK generation options (for example, `temperature`) take
|
|
639
|
+
precedence over the corresponding `providerOptions` model parameters.
|
|
615
640
|
|
|
616
641
|
```typescript
|
|
617
642
|
import { generateText } from "ai";
|
|
@@ -644,8 +669,8 @@ authentication, model parameters, data masking, content filtering, and more.
|
|
|
644
669
|
|
|
645
670
|
**Common Configuration:**
|
|
646
671
|
|
|
647
|
-
- `name`: Provider
|
|
648
|
-
`providerOptions`/`providerMetadata`.
|
|
672
|
+
- `name`: Provider identifier prefix (default: `'sap-ai'`). The segment before
|
|
673
|
+
the first dot is used as the key in `providerOptions`/`providerMetadata`.
|
|
649
674
|
- `resourceGroup`: SAP AI Core resource group (default: 'default')
|
|
650
675
|
- `deploymentId`: Specific deployment ID (auto-resolved if not set)
|
|
651
676
|
- `requestConfig`: Custom HTTP request configuration (headers, params, timeout, etc.)
|
|
@@ -680,7 +705,9 @@ error handling across providers.
|
|
|
680
705
|
|
|
681
706
|
- **Authentication (401)**: Check `AICORE_SERVICE_KEY` or `VCAP_SERVICES`
|
|
682
707
|
- **Model not found (404)**: Confirm tenant/region supports the model ID
|
|
683
|
-
- **Rate limit (429)**:
|
|
708
|
+
- **Rate limit (429)**: High-level AI SDK calls retry eligible errors with
|
|
709
|
+
exponential backoff, bounded by `maxRetries`; direct provider calls do not
|
|
710
|
+
implement retries
|
|
684
711
|
- **Streaming**: Iterate `textStream` correctly; don't mix `generateText` and
|
|
685
712
|
`streamText`
|
|
686
713
|
|
|
@@ -694,10 +721,10 @@ streaming, and tool calling.
|
|
|
694
721
|
## Performance
|
|
695
722
|
|
|
696
723
|
- Prefer streaming (`streamText`) for long outputs to reduce latency and memory.
|
|
697
|
-
- Tune `modelParams` carefully: lower `temperature` for
|
|
724
|
+
- Tune `modelParams` carefully: lower `temperature` for less variable results;
|
|
698
725
|
set `maxTokens` to expected response size.
|
|
699
|
-
- Use `defaultSettings` at provider creation
|
|
700
|
-
|
|
726
|
+
- Use `defaultSettings` at provider creation to share configuration across models;
|
|
727
|
+
settings are still merged and validated when models and calls are prepared.
|
|
701
728
|
- Avoid unnecessary history: keep `messages` concise to reduce prompt size and
|
|
702
729
|
cost.
|
|
703
730
|
|
|
@@ -719,8 +746,10 @@ deployment.
|
|
|
719
746
|
|
|
720
747
|
## Examples
|
|
721
748
|
|
|
722
|
-
The `examples/` directory contains complete, runnable examples
|
|
723
|
-
|
|
749
|
+
The `examples/` directory contains complete, runnable examples using the
|
|
750
|
+
repository's AI SDK 7 dependency and the local `../src/index-v4` entrypoint.
|
|
751
|
+
In an AI SDK 7 application, import from `@jerome-benoit/sap-ai-provider/v4`.
|
|
752
|
+
See [Installation](#installation) for other AI SDK versions.
|
|
724
753
|
|
|
725
754
|
| Example | Description | Key Features |
|
|
726
755
|
| ----------------------------------- | --------------------------- | --------------------------------------- |
|
|
@@ -747,27 +776,46 @@ npx tsx examples/example-generate-text.ts
|
|
|
747
776
|
|
|
748
777
|
## Migration Guides
|
|
749
778
|
|
|
779
|
+
### Upgrading from v4.x to v5.x
|
|
780
|
+
|
|
781
|
+
Version 5.0 adds **AI SDK 7** support through the **V4** facade and requires
|
|
782
|
+
**Node.js 22.12 or newer** for both packages. The root entrypoint remains
|
|
783
|
+
**V3 for AI SDK 6**; upgrading the provider does not require switching SDKs.
|
|
784
|
+
|
|
785
|
+
**Key changes:**
|
|
786
|
+
|
|
787
|
+
- **Runtime**: Upgrade local, CI and deployment environments from Node.js 20
|
|
788
|
+
to Node.js 22.12 or newer.
|
|
789
|
+
- **Entrypoints**: Use `/v4` with SDK 7, the root with SDK 6, or `/v2` with
|
|
790
|
+
SDK 5. The standalone V2 package remains available for SDK 5/6.
|
|
791
|
+
- **Multimodal inputs**: V4 tagged JPEG/PDF inputs are normalized correctly;
|
|
792
|
+
unsupported binary objects are rejected instead of silently stringified.
|
|
793
|
+
|
|
794
|
+
See the [4.x to 5.x migration guide](./MIGRATION_GUIDE.md#version-4x-to-5x-breaking-changes)
|
|
795
|
+
for installation commands, compatibility details and the migration checklist.
|
|
796
|
+
|
|
750
797
|
### Upgrading from v3.x to v4.x
|
|
751
798
|
|
|
752
799
|
Version 4.0 migrates from **LanguageModelV2** to **LanguageModelV3**
|
|
753
|
-
specification (AI SDK
|
|
800
|
+
specification (AI SDK 6). Package release 4.x is not the V4 provider
|
|
801
|
+
specification used by AI SDK 7. **See the
|
|
754
802
|
[Migration Guide](./MIGRATION_GUIDE.md#version-3x-to-4x-breaking-changes) for
|
|
755
803
|
complete upgrade instructions.**
|
|
756
804
|
|
|
757
|
-
**Key changes:**
|
|
805
|
+
**Key changes in direct provider results (`doGenerate`/`doStream`):**
|
|
758
806
|
|
|
759
807
|
- **Finish Reason**: Changed from string to object
|
|
760
808
|
(`result.finishReason.unified`)
|
|
761
809
|
- **Usage Structure**: Nested format with detailed token breakdown
|
|
762
810
|
(`result.usage.inputTokens.total`)
|
|
763
|
-
- **Stream Events**:
|
|
764
|
-
|
|
811
|
+
- **Stream Events**: Text blocks retain `text-start`, `text-delta`, and
|
|
812
|
+
`text-end`; finish and warning payloads use the V3 format
|
|
765
813
|
- **Warning Types**: Updated format with `feature` field for categorization
|
|
766
814
|
|
|
767
815
|
**Impact by user type:**
|
|
768
816
|
|
|
769
|
-
- High-level API users (`generateText`/`streamText`):
|
|
770
|
-
|
|
817
|
+
- High-level API users (`generateText`/`streamText`): use AI SDK 6 with the root
|
|
818
|
+
entrypoint. High-level token totals remain flat numbers.
|
|
771
819
|
- Direct provider users: ⚠️ Update type imports (`LanguageModelV2` →
|
|
772
820
|
`LanguageModelV3`)
|
|
773
821
|
- Custom stream parsers: ⚠️ Update parsing logic for V3 structure
|
|
@@ -783,7 +831,7 @@ complete upgrade instructions.**
|
|
|
783
831
|
|
|
784
832
|
- `SAPAIError` removed → Use `APICallError` from `@ai-sdk/provider`
|
|
785
833
|
- Error properties: `error.code` → `error.statusCode`
|
|
786
|
-
-
|
|
834
|
+
- Retryable error classification for the AI SDK's rate-limit/server-error retries
|
|
787
835
|
|
|
788
836
|
### Upgrading from v1.x to v2.x
|
|
789
837
|
|
|
@@ -817,7 +865,7 @@ for details.
|
|
|
817
865
|
### Documentation
|
|
818
866
|
|
|
819
867
|
- [Migration Guide](./MIGRATION_GUIDE.md) - Version upgrade instructions (v1.x →
|
|
820
|
-
v2.x → v3.x → v4.x)
|
|
868
|
+
v2.x → v3.x → v4.x → v5.x)
|
|
821
869
|
- [API Reference](./API_REFERENCE.md) - Complete API documentation with all
|
|
822
870
|
types and functions
|
|
823
871
|
- [Environment Setup](./ENVIRONMENT_SETUP.md) - Authentication and configuration
|