@jerome-benoit/sap-ai-provider 4.0.0-rc.2 → 4.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/LICENSE.md +174 -188
- package/README.md +160 -80
- package/dist/index.cjs +150 -109
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +40 -138
- package/dist/index.d.ts +40 -138
- package/dist/index.js +151 -112
- package/dist/index.js.map +1 -1
- package/package.json +18 -9
package/README.md
CHANGED
|
@@ -5,7 +5,10 @@
|
|
|
5
5
|
[](https://sdk.vercel.ai/docs)
|
|
6
6
|
[](https://sdk.vercel.ai/docs/ai-sdk-core/provider-management)
|
|
7
7
|
|
|
8
|
-
A community provider for SAP AI Core that integrates seamlessly with the Vercel
|
|
8
|
+
A community provider for SAP AI Core that integrates seamlessly with the Vercel
|
|
9
|
+
AI SDK. Built on top of the official **@sap-ai-sdk/orchestration** package, this
|
|
10
|
+
provider enables you to use SAP's enterprise-grade AI models through the
|
|
11
|
+
familiar Vercel AI SDK interface.
|
|
9
12
|
|
|
10
13
|
## Table of Contents
|
|
11
14
|
|
|
@@ -51,16 +54,19 @@ A community provider for SAP AI Core that integrates seamlessly with the Vercel
|
|
|
51
54
|
|
|
52
55
|
## Features
|
|
53
56
|
|
|
54
|
-
- 🔐 **Simplified Authentication** - Uses SAP AI SDK's built-in credential
|
|
57
|
+
- 🔐 **Simplified Authentication** - Uses SAP AI SDK's built-in credential
|
|
58
|
+
handling
|
|
55
59
|
- 🎯 **Tool Calling Support** - Full tool/function calling capabilities
|
|
56
|
-
- 🧠 **Reasoning-Safe by Default** - Assistant reasoning parts are not forwarded
|
|
60
|
+
- 🧠 **Reasoning-Safe by Default** - Assistant reasoning parts are not forwarded
|
|
61
|
+
unless enabled
|
|
57
62
|
- 🖼️ **Multi-modal Input** - Support for text and image inputs
|
|
58
63
|
- 📡 **Streaming Support** - Real-time text generation with structured V3 blocks
|
|
59
64
|
- 🔒 **Data Masking** - Built-in SAP DPI integration for privacy
|
|
60
65
|
- 🛡️ **Content Filtering** - Azure Content Safety and Llama Guard support
|
|
61
66
|
- 🔧 **TypeScript Support** - Full type safety and IntelliSense
|
|
62
67
|
- 🎨 **Multiple Models** - Support for GPT-4, Claude, Gemini, Nova, and more
|
|
63
|
-
- ⚡ **Language Model V3** - Latest Vercel AI SDK specification with enhanced
|
|
68
|
+
- ⚡ **Language Model V3** - Latest Vercel AI SDK specification with enhanced
|
|
69
|
+
streaming
|
|
64
70
|
|
|
65
71
|
## Quick Start
|
|
66
72
|
|
|
@@ -95,7 +101,8 @@ try {
|
|
|
95
101
|
}
|
|
96
102
|
```
|
|
97
103
|
|
|
98
|
-
> **Note:** Requires `AICORE_SERVICE_KEY` environment variable. See
|
|
104
|
+
> **Note:** Requires `AICORE_SERVICE_KEY` environment variable. See
|
|
105
|
+
> [Environment Setup](./ENVIRONMENT_SETUP.md) for configuration.
|
|
99
106
|
|
|
100
107
|
## Quick Reference
|
|
101
108
|
|
|
@@ -158,11 +165,13 @@ const result = await generateText({
|
|
|
158
165
|
});
|
|
159
166
|
```
|
|
160
167
|
|
|
161
|
-
The `sapai` export provides a convenient default provider instance with
|
|
168
|
+
The `sapai` export provides a convenient default provider instance with
|
|
169
|
+
automatic configuration from environment variables or service bindings.
|
|
162
170
|
|
|
163
171
|
## Authentication
|
|
164
172
|
|
|
165
|
-
Authentication is handled automatically by the SAP AI SDK using the
|
|
173
|
+
Authentication is handled automatically by the SAP AI SDK using the
|
|
174
|
+
`AICORE_SERVICE_KEY` environment variable.
|
|
166
175
|
|
|
167
176
|
**Quick Setup:**
|
|
168
177
|
|
|
@@ -170,13 +179,15 @@ Authentication is handled automatically by the SAP AI SDK using the `AICORE_SERV
|
|
|
170
179
|
2. Add your SAP AI Core service key JSON to `AICORE_SERVICE_KEY`
|
|
171
180
|
3. Import in code: `import "dotenv/config";`
|
|
172
181
|
|
|
173
|
-
**For complete setup instructions, SAP BTP deployment, troubleshooting, and
|
|
182
|
+
**For complete setup instructions, SAP BTP deployment, troubleshooting, and
|
|
183
|
+
advanced scenarios, see the [Environment Setup Guide](./ENVIRONMENT_SETUP.md).**
|
|
174
184
|
|
|
175
185
|
## Basic Usage
|
|
176
186
|
|
|
177
187
|
### Text Generation
|
|
178
188
|
|
|
179
|
-
**Complete example:**
|
|
189
|
+
**Complete example:**
|
|
190
|
+
[examples/example-generate-text.ts](./examples/example-generate-text.ts)
|
|
180
191
|
|
|
181
192
|
```typescript
|
|
182
193
|
const result = await generateText({
|
|
@@ -190,9 +201,12 @@ console.log(result.text);
|
|
|
190
201
|
|
|
191
202
|
### Chat Conversations
|
|
192
203
|
|
|
193
|
-
**Complete example:**
|
|
204
|
+
**Complete example:**
|
|
205
|
+
[examples/example-simple-chat-completion.ts](./examples/example-simple-chat-completion.ts)
|
|
194
206
|
|
|
195
|
-
Note: assistant `reasoning` parts are dropped by default. Set
|
|
207
|
+
Note: assistant `reasoning` parts are dropped by default. Set
|
|
208
|
+
`includeReasoning: true` on the model settings if you explicitly want to forward
|
|
209
|
+
them.
|
|
196
210
|
|
|
197
211
|
```typescript
|
|
198
212
|
const result = await generateText({
|
|
@@ -211,7 +225,8 @@ const result = await generateText({
|
|
|
211
225
|
|
|
212
226
|
### Streaming Responses
|
|
213
227
|
|
|
214
|
-
**Complete example:**
|
|
228
|
+
**Complete example:**
|
|
229
|
+
[examples/example-streaming-chat.ts](./examples/example-streaming-chat.ts)
|
|
215
230
|
|
|
216
231
|
```typescript
|
|
217
232
|
const result = streamText({
|
|
@@ -254,20 +269,24 @@ const result = await generateText({
|
|
|
254
269
|
|
|
255
270
|
## Supported Models
|
|
256
271
|
|
|
257
|
-
This provider supports all models available through SAP AI Core Orchestration
|
|
272
|
+
This provider supports all models available through SAP AI Core Orchestration
|
|
273
|
+
service, including:
|
|
258
274
|
|
|
259
275
|
**Popular models:**
|
|
260
276
|
|
|
261
|
-
- **OpenAI**: gpt-4o, gpt-4o-mini, gpt-4.1, o1, o3 (recommended for
|
|
277
|
+
- **OpenAI**: gpt-4o, gpt-4o-mini, gpt-4.1, o1, o3, o4-mini (recommended for
|
|
278
|
+
multi-tool apps)
|
|
262
279
|
- **Anthropic Claude**: anthropic--claude-3.5-sonnet, anthropic--claude-4-opus
|
|
263
280
|
- **Google Gemini**: gemini-2.5-pro, gemini-2.0-flash
|
|
264
281
|
|
|
265
282
|
⚠️ **Important:** Google Gemini models have a 1 tool limit per request.
|
|
266
283
|
|
|
267
284
|
- **Amazon Nova**: amazon--nova-pro, amazon--nova-lite
|
|
268
|
-
- **Open Source**: mistralai--mistral-large-instruct,
|
|
285
|
+
- **Open Source**: mistralai--mistral-large-instruct,
|
|
286
|
+
meta--llama3.1-70b-instruct
|
|
269
287
|
|
|
270
|
-
> **Note:** Model availability depends on your SAP AI Core tenant configuration,
|
|
288
|
+
> **Note:** Model availability depends on your SAP AI Core tenant configuration,
|
|
289
|
+
> region, and subscription.
|
|
271
290
|
|
|
272
291
|
**To discover available models in your environment:**
|
|
273
292
|
|
|
@@ -275,18 +294,26 @@ This provider supports all models available through SAP AI Core Orchestration se
|
|
|
275
294
|
curl "https://<AI_API_URL>/v2/lm/deployments" -H "Authorization: Bearer $TOKEN"
|
|
276
295
|
```
|
|
277
296
|
|
|
278
|
-
For complete model details, capabilities comparison, and limitations, see
|
|
297
|
+
For complete model details, capabilities comparison, and limitations, see
|
|
298
|
+
**[API Reference: SAPAIModelId](./API_REFERENCE.md#sapaimodelid)**.
|
|
279
299
|
|
|
280
300
|
## Advanced Features
|
|
281
301
|
|
|
282
|
-
The following helper functions are exported by this package for convenient
|
|
302
|
+
The following helper functions are exported by this package for convenient
|
|
303
|
+
configuration of SAP AI Core features. These builders provide type-safe
|
|
304
|
+
configuration for data masking, content filtering, grounding, and translation
|
|
305
|
+
modules.
|
|
283
306
|
|
|
284
307
|
### Tool Calling
|
|
285
308
|
|
|
286
|
-
> **Note on Terminology:** This documentation uses "tool calling" (Vercel AI SDK
|
|
309
|
+
> **Note on Terminology:** This documentation uses "tool calling" (Vercel AI SDK
|
|
310
|
+
> convention), equivalent to "function calling" in OpenAI documentation. Both
|
|
311
|
+
> terms refer to the same capability of models invoking external functions.
|
|
287
312
|
|
|
288
|
-
📖 **Complete guide:**
|
|
289
|
-
|
|
313
|
+
📖 **Complete guide:**
|
|
314
|
+
[API Reference - Tool Calling](./API_REFERENCE.md#tool-calling-function-calling)\
|
|
315
|
+
**Complete example:**
|
|
316
|
+
[examples/example-chat-completion-tool.ts](./examples/example-chat-completion-tool.ts)
|
|
290
317
|
|
|
291
318
|
```typescript
|
|
292
319
|
const weatherTool = tool({
|
|
@@ -305,11 +332,15 @@ const result = await generateText({
|
|
|
305
332
|
|
|
306
333
|
**Run it:** `npx tsx examples/example-chat-completion-tool.ts`
|
|
307
334
|
|
|
308
|
-
⚠️ **Important:** Gemini models support only 1 tool per request. For multi-tool
|
|
335
|
+
⚠️ **Important:** Gemini models support only 1 tool per request. For multi-tool
|
|
336
|
+
applications, use GPT-4o, Claude, or Amazon Nova models. See
|
|
337
|
+
[API Reference - Tool Calling](./API_REFERENCE.md#tool-calling-function-calling)
|
|
338
|
+
for complete model comparison.
|
|
309
339
|
|
|
310
340
|
### Multi-modal Input (Images)
|
|
311
341
|
|
|
312
|
-
**Complete example:**
|
|
342
|
+
**Complete example:**
|
|
343
|
+
[examples/example-image-recognition.ts](./examples/example-image-recognition.ts)
|
|
313
344
|
|
|
314
345
|
```typescript
|
|
315
346
|
const result = await generateText({
|
|
@@ -341,16 +372,14 @@ const dpiConfig = buildDpiMaskingProvider({
|
|
|
341
372
|
});
|
|
342
373
|
```
|
|
343
374
|
|
|
344
|
-
**Full documentation:**
|
|
375
|
+
**Full documentation:**
|
|
376
|
+
[API_REFERENCE.md - Data Masking](./API_REFERENCE.md#builddpimaskingproviderconfig)
|
|
345
377
|
|
|
346
378
|
### Content Filtering
|
|
347
379
|
|
|
348
380
|
```typescript
|
|
349
381
|
import "dotenv/config"; // Load environment variables
|
|
350
|
-
import {
|
|
351
|
-
createSAPAIProvider,
|
|
352
|
-
buildAzureContentSafetyFilter,
|
|
353
|
-
} from "@mymediset/sap-ai-provider";
|
|
382
|
+
import { buildAzureContentSafetyFilter, createSAPAIProvider } from "@mymediset/sap-ai-provider";
|
|
354
383
|
|
|
355
384
|
const provider = createSAPAIProvider({
|
|
356
385
|
defaultSettings: {
|
|
@@ -368,14 +397,17 @@ const provider = createSAPAIProvider({
|
|
|
368
397
|
});
|
|
369
398
|
```
|
|
370
399
|
|
|
371
|
-
**Full documentation:**
|
|
400
|
+
**Full documentation:**
|
|
401
|
+
[API_REFERENCE.md - Content Filtering](./API_REFERENCE.md#buildazurecontentsafetyfiltertype-config)
|
|
372
402
|
|
|
373
403
|
### Document Grounding (RAG)
|
|
374
404
|
|
|
375
405
|
Ground LLM responses in your own documents using vector databases.
|
|
376
406
|
|
|
377
|
-
**Complete example:**
|
|
378
|
-
|
|
407
|
+
**Complete example:**
|
|
408
|
+
[examples/example-document-grounding.ts](./examples/example-document-grounding.ts)\
|
|
409
|
+
**Complete documentation:**
|
|
410
|
+
[API Reference - Document Grounding](./API_REFERENCE.md#builddocumentgroundingconfigconfig)
|
|
379
411
|
|
|
380
412
|
```typescript
|
|
381
413
|
const provider = createSAPAIProvider({
|
|
@@ -405,8 +437,10 @@ const model = provider("gpt-4o");
|
|
|
405
437
|
|
|
406
438
|
Automatically translate user queries and model responses.
|
|
407
439
|
|
|
408
|
-
**Complete example:**
|
|
409
|
-
|
|
440
|
+
**Complete example:**
|
|
441
|
+
[examples/example-translation.ts](./examples/example-translation.ts)\
|
|
442
|
+
**Complete documentation:**
|
|
443
|
+
[API Reference - Translation](./API_REFERENCE.md#buildtranslationconfigtype-config)
|
|
410
444
|
|
|
411
445
|
```typescript
|
|
412
446
|
const provider = createSAPAIProvider({
|
|
@@ -433,7 +467,8 @@ const model = provider("gpt-4o");
|
|
|
433
467
|
|
|
434
468
|
## Configuration Options
|
|
435
469
|
|
|
436
|
-
The provider and models can be configured with various settings for
|
|
470
|
+
The provider and models can be configured with various settings for
|
|
471
|
+
authentication, model parameters, data masking, content filtering, and more.
|
|
437
472
|
|
|
438
473
|
**Common Configuration:**
|
|
439
474
|
|
|
@@ -443,11 +478,14 @@ The provider and models can be configured with various settings for authenticati
|
|
|
443
478
|
- `masking`: SAP Data Privacy Integration (DPI) configuration
|
|
444
479
|
- `filtering`: Content safety filters (Azure Content Safety, Llama Guard)
|
|
445
480
|
|
|
446
|
-
For complete configuration reference including all available options, types, and
|
|
481
|
+
For complete configuration reference including all available options, types, and
|
|
482
|
+
examples, see
|
|
483
|
+
**[API Reference - Configuration](./API_REFERENCE.md#sapaiprovidersettings)**.
|
|
447
484
|
|
|
448
485
|
## Error Handling
|
|
449
486
|
|
|
450
|
-
The provider uses standard Vercel AI SDK error types for consistent error
|
|
487
|
+
The provider uses standard Vercel AI SDK error types for consistent error
|
|
488
|
+
handling.
|
|
451
489
|
|
|
452
490
|
**Quick Example:**
|
|
453
491
|
|
|
@@ -473,9 +511,12 @@ try {
|
|
|
473
511
|
|
|
474
512
|
**Complete reference:**
|
|
475
513
|
|
|
476
|
-
- **[API Reference - Error Handling](./API_REFERENCE.md#error-handling-examples)** -
|
|
477
|
-
|
|
478
|
-
- **[
|
|
514
|
+
- **[API Reference - Error Handling](./API_REFERENCE.md#error-handling-examples)** -
|
|
515
|
+
Complete examples with all error properties
|
|
516
|
+
- **[API Reference - HTTP Status Codes](./API_REFERENCE.md#http-status-code-reference)** -
|
|
517
|
+
Status code reference table
|
|
518
|
+
- **[Troubleshooting Guide](./TROUBLESHOOTING.md)** - Detailed solutions for
|
|
519
|
+
each error type
|
|
479
520
|
|
|
480
521
|
## Troubleshooting
|
|
481
522
|
|
|
@@ -484,9 +525,11 @@ try {
|
|
|
484
525
|
- **Authentication (401)**: Check `AICORE_SERVICE_KEY` or `VCAP_SERVICES`
|
|
485
526
|
- **Model not found (404)**: Confirm tenant/region supports the model ID
|
|
486
527
|
- **Rate limit (429)**: Automatic retry with exponential backoff
|
|
487
|
-
- **Streaming**: Iterate `textStream` correctly; don't mix `generateText` and
|
|
528
|
+
- **Streaming**: Iterate `textStream` correctly; don't mix `generateText` and
|
|
529
|
+
`streamText`
|
|
488
530
|
|
|
489
|
-
**For comprehensive troubleshooting, see
|
|
531
|
+
**For comprehensive troubleshooting, see
|
|
532
|
+
[Troubleshooting Guide](./TROUBLESHOOTING.md)** with detailed solutions for:
|
|
490
533
|
|
|
491
534
|
- [Authentication Failed (401)](./TROUBLESHOOTING.md#problem-authentication-failed-or-401-errors)
|
|
492
535
|
- [Model Not Found (404)](./TROUBLESHOOTING.md#problem-404-modeldeployment-not-found)
|
|
@@ -495,40 +538,53 @@ try {
|
|
|
495
538
|
- [Streaming Issues](./TROUBLESHOOTING.md#streaming-issues)
|
|
496
539
|
- [Tool Calling Problems](./TROUBLESHOOTING.md#tool-calling-issues)
|
|
497
540
|
|
|
498
|
-
Error code reference table:
|
|
541
|
+
Error code reference table:
|
|
542
|
+
[API Reference - HTTP Status Codes](./API_REFERENCE.md#http-status-code-reference)
|
|
499
543
|
|
|
500
544
|
## Performance
|
|
501
545
|
|
|
502
546
|
- Prefer streaming (`streamText`) for long outputs to reduce latency and memory.
|
|
503
|
-
- Tune `modelParams` carefully: lower `temperature` for deterministic results;
|
|
504
|
-
|
|
505
|
-
-
|
|
547
|
+
- Tune `modelParams` carefully: lower `temperature` for deterministic results;
|
|
548
|
+
set `maxTokens` to expected response size.
|
|
549
|
+
- Use `defaultSettings` at provider creation for shared knobs across models to
|
|
550
|
+
avoid per-call overhead.
|
|
551
|
+
- Avoid unnecessary history: keep `messages` concise to reduce prompt size and
|
|
552
|
+
cost.
|
|
506
553
|
|
|
507
554
|
## Security
|
|
508
555
|
|
|
509
|
-
- Do not commit `.env` or credentials; use environment variables and secrets
|
|
510
|
-
|
|
511
|
-
-
|
|
556
|
+
- Do not commit `.env` or credentials; use environment variables and secrets
|
|
557
|
+
managers.
|
|
558
|
+
- Treat `AICORE_SERVICE_KEY` as sensitive; avoid logging it or including in
|
|
559
|
+
crash reports.
|
|
560
|
+
- Mask PII with DPI: configure `masking.masking_providers` using
|
|
561
|
+
`buildDpiMaskingProvider()`.
|
|
512
562
|
- Validate and sanitize tool outputs before executing any side effects.
|
|
513
563
|
|
|
514
564
|
## Debug Mode
|
|
515
565
|
|
|
516
|
-
- Use the curl guide `CURL_API_TESTING_GUIDE.md` to diagnose raw API behavior
|
|
517
|
-
|
|
518
|
-
-
|
|
566
|
+
- Use the curl guide `CURL_API_TESTING_GUIDE.md` to diagnose raw API behavior
|
|
567
|
+
independent of the SDK.
|
|
568
|
+
- Log request IDs from `error.responseBody` (parse JSON for `request_id`) to
|
|
569
|
+
correlate with backend traces.
|
|
570
|
+
- Temporarily enable verbose logging in your app around provider calls; redact
|
|
571
|
+
secrets.
|
|
519
572
|
|
|
520
573
|
## Examples
|
|
521
574
|
|
|
522
|
-
The `examples/` directory contains complete, runnable examples demonstrating key
|
|
575
|
+
The `examples/` directory contains complete, runnable examples demonstrating key
|
|
576
|
+
features:
|
|
523
577
|
|
|
524
|
-
| Example | Description | Key Features
|
|
525
|
-
| ----------------------------------- | --------------------------- |
|
|
526
|
-
| `example-generate-text.ts` | Basic text generation | Simple prompts, synchronous generation
|
|
527
|
-
| `example-simple-chat-completion.ts` | Simple chat conversation | System messages, user prompts
|
|
528
|
-
| `example-chat-completion-tool.ts` | Tool calling with functions | Weather API tool, function execution
|
|
529
|
-
| `example-streaming-chat.ts` | Streaming responses | Real-time text generation, SSE
|
|
530
|
-
| `example-image-recognition.ts` | Multi-modal with images | Vision models, image analysis
|
|
531
|
-
| `example-data-masking.ts` | Data privacy integration | DPI masking, anonymization
|
|
578
|
+
| Example | Description | Key Features |
|
|
579
|
+
| ----------------------------------- | --------------------------- | --------------------------------------- |
|
|
580
|
+
| `example-generate-text.ts` | Basic text generation | Simple prompts, synchronous generation |
|
|
581
|
+
| `example-simple-chat-completion.ts` | Simple chat conversation | System messages, user prompts |
|
|
582
|
+
| `example-chat-completion-tool.ts` | Tool calling with functions | Weather API tool, function execution |
|
|
583
|
+
| `example-streaming-chat.ts` | Streaming responses | Real-time text generation, SSE |
|
|
584
|
+
| `example-image-recognition.ts` | Multi-modal with images | Vision models, image analysis |
|
|
585
|
+
| `example-data-masking.ts` | Data privacy integration | DPI masking, anonymization |
|
|
586
|
+
| `example-document-grounding.ts` | Document grounding (RAG) | Vector store, retrieval-augmented gen |
|
|
587
|
+
| `example-translation.ts` | Input/output translation | Multi-language support, SAP translation |
|
|
532
588
|
|
|
533
589
|
**Running Examples:**
|
|
534
590
|
|
|
@@ -536,30 +592,41 @@ The `examples/` directory contains complete, runnable examples demonstrating key
|
|
|
536
592
|
npx tsx examples/example-generate-text.ts
|
|
537
593
|
```
|
|
538
594
|
|
|
539
|
-
> **Note:** Examples require `AICORE_SERVICE_KEY` environment variable. See
|
|
595
|
+
> **Note:** Examples require `AICORE_SERVICE_KEY` environment variable. See
|
|
596
|
+
> [Environment Setup](./ENVIRONMENT_SETUP.md) for configuration.
|
|
540
597
|
|
|
541
598
|
## Migration Guides
|
|
542
599
|
|
|
543
600
|
### Upgrading from v3.x to v4.x
|
|
544
601
|
|
|
545
|
-
Version 4.0 migrates from **LanguageModelV2** to **LanguageModelV3**
|
|
602
|
+
Version 4.0 migrates from **LanguageModelV2** to **LanguageModelV3**
|
|
603
|
+
specification (AI SDK 6.0+). **See the
|
|
604
|
+
[Migration Guide](./MIGRATION_GUIDE.md#version-3x-to-4x-breaking-changes) for
|
|
605
|
+
complete upgrade instructions.**
|
|
546
606
|
|
|
547
607
|
**Key changes:**
|
|
548
608
|
|
|
549
|
-
- **Finish Reason**: Changed from string to object
|
|
550
|
-
|
|
551
|
-
- **
|
|
609
|
+
- **Finish Reason**: Changed from string to object
|
|
610
|
+
(`result.finishReason.unified`)
|
|
611
|
+
- **Usage Structure**: Nested format with detailed token breakdown
|
|
612
|
+
(`result.usage.inputTokens.total`)
|
|
613
|
+
- **Stream Events**: Structured blocks (`text-start`, `text-delta`, `text-end`)
|
|
614
|
+
instead of simple deltas
|
|
552
615
|
- **Warning Types**: Updated format with `feature` field for categorization
|
|
553
616
|
|
|
554
617
|
**Impact by user type:**
|
|
555
618
|
|
|
556
|
-
- High-level API users (`generateText`/`streamText`): ✅ Minimal impact (likely
|
|
557
|
-
|
|
619
|
+
- High-level API users (`generateText`/`streamText`): ✅ Minimal impact (likely
|
|
620
|
+
no changes)
|
|
621
|
+
- Direct provider users: ⚠️ Update type imports (`LanguageModelV2` →
|
|
622
|
+
`LanguageModelV3`)
|
|
558
623
|
- Custom stream parsers: ⚠️ Update parsing logic for V3 structure
|
|
559
624
|
|
|
560
625
|
### Upgrading from v2.x to v3.x
|
|
561
626
|
|
|
562
|
-
Version 3.0 standardizes error handling to use Vercel AI SDK native error types.
|
|
627
|
+
Version 3.0 standardizes error handling to use Vercel AI SDK native error types.
|
|
628
|
+
**See the [Migration Guide](./MIGRATION_GUIDE.md#v2x--v30) for complete upgrade
|
|
629
|
+
instructions.**
|
|
563
630
|
|
|
564
631
|
**Key changes:**
|
|
565
632
|
|
|
@@ -569,7 +636,9 @@ Version 3.0 standardizes error handling to use Vercel AI SDK native error types.
|
|
|
569
636
|
|
|
570
637
|
### Upgrading from v1.x to v2.x
|
|
571
638
|
|
|
572
|
-
Version 2.0 uses the official SAP AI SDK. **See the
|
|
639
|
+
Version 2.0 uses the official SAP AI SDK. **See the
|
|
640
|
+
[Migration Guide](./MIGRATION_GUIDE.md#v1x--v20) for complete upgrade
|
|
641
|
+
instructions.**
|
|
573
642
|
|
|
574
643
|
**Key changes:**
|
|
575
644
|
|
|
@@ -577,37 +646,48 @@ Version 2.0 uses the official SAP AI SDK. **See the [Migration Guide](./MIGRATIO
|
|
|
577
646
|
- Synchronous provider creation: `createSAPAIProvider()` (no await)
|
|
578
647
|
- Helper functions from SAP AI SDK
|
|
579
648
|
|
|
580
|
-
**For detailed migration instructions with code examples, see the
|
|
649
|
+
**For detailed migration instructions with code examples, see the
|
|
650
|
+
[complete Migration Guide](./MIGRATION_GUIDE.md).**
|
|
581
651
|
|
|
582
652
|
## Important Note
|
|
583
653
|
|
|
584
|
-
> **Third-Party Provider**: This SAP AI Core provider
|
|
654
|
+
> **Third-Party Provider**: This SAP AI Core provider
|
|
655
|
+
> (`@mymediset/sap-ai-provider`) is developed and maintained by mymediset, not
|
|
656
|
+
> by SAP SE. While it uses the official SAP AI SDK and integrates with SAP AI
|
|
657
|
+
> Core services, it is not an official SAP product.
|
|
585
658
|
|
|
586
659
|
## Contributing
|
|
587
660
|
|
|
588
|
-
We welcome contributions! Please see our [Contributing Guide](./CONTRIBUTING.md)
|
|
661
|
+
We welcome contributions! Please see our [Contributing Guide](./CONTRIBUTING.md)
|
|
662
|
+
for details.
|
|
589
663
|
|
|
590
664
|
## Resources
|
|
591
665
|
|
|
592
666
|
### Documentation
|
|
593
667
|
|
|
594
|
-
- [Migration Guide](./MIGRATION_GUIDE.md) - Version upgrade instructions (v1.x →
|
|
595
|
-
|
|
596
|
-
- [
|
|
668
|
+
- [Migration Guide](./MIGRATION_GUIDE.md) - Version upgrade instructions (v1.x →
|
|
669
|
+
v2.x → v3.x → v4.x)
|
|
670
|
+
- [API Reference](./API_REFERENCE.md) - Complete API documentation with all
|
|
671
|
+
types and functions
|
|
672
|
+
- [Environment Setup](./ENVIRONMENT_SETUP.md) - Authentication and configuration
|
|
673
|
+
setup
|
|
597
674
|
- [Troubleshooting](./TROUBLESHOOTING.md) - Common issues and solutions
|
|
598
|
-
- [Architecture](./ARCHITECTURE.md) - Internal architecture, design decisions,
|
|
599
|
-
|
|
675
|
+
- [Architecture](./ARCHITECTURE.md) - Internal architecture, design decisions,
|
|
676
|
+
and request flows
|
|
677
|
+
- [curl API Testing](./CURL_API_TESTING_GUIDE.md) - Direct API testing for
|
|
678
|
+
debugging
|
|
600
679
|
|
|
601
680
|
### Community
|
|
602
681
|
|
|
603
|
-
- 🐛 [Issue Tracker](https://github.com/BITASIA/sap-ai-provider/issues) - Report
|
|
604
|
-
|
|
682
|
+
- 🐛 [Issue Tracker](https://github.com/BITASIA/sap-ai-provider/issues) - Report
|
|
683
|
+
bugs, request features, and ask questions
|
|
605
684
|
|
|
606
685
|
### Related Projects
|
|
607
686
|
|
|
608
687
|
- [Vercel AI SDK](https://sdk.vercel.ai/) - The AI SDK this provider extends
|
|
609
688
|
- [SAP AI SDK](https://sap.github.io/ai-sdk/) - Official SAP Cloud SDK for AI
|
|
610
|
-
- [SAP AI Core Documentation](https://help.sap.com/docs/ai-core) - Official SAP
|
|
689
|
+
- [SAP AI Core Documentation](https://help.sap.com/docs/ai-core) - Official SAP
|
|
690
|
+
AI Core docs
|
|
611
691
|
|
|
612
692
|
## License
|
|
613
693
|
|