@jerome-benoit/sap-ai-provider 4.4.8 → 4.4.9

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 (27) hide show
  1. package/README.md +31 -50
  2. package/dist/{chunk-PF3ZCJ3H.js → chunk-7VLWN7WJ.js} +122 -128
  3. package/dist/{chunk-PF3ZCJ3H.js.map → chunk-7VLWN7WJ.js.map} +1 -1
  4. package/dist/{chunk-XU6SXOA2.js → chunk-KO5GBKZB.js} +3 -3
  5. package/dist/{chunk-J6IX7CM7.js → chunk-VSBPOUOR.js} +49 -5
  6. package/dist/chunk-VSBPOUOR.js.map +1 -0
  7. package/dist/{foundation-models-embedding-model-strategy-BAZN2P7Z.js → foundation-models-embedding-model-strategy-OTU7URXF.js} +23 -39
  8. package/dist/foundation-models-embedding-model-strategy-OTU7URXF.js.map +1 -0
  9. package/dist/{foundation-models-language-model-strategy-NKCAFUUQ.js → foundation-models-language-model-strategy-KVEFWA62.js} +4 -4
  10. package/dist/foundation-models-language-model-strategy-KVEFWA62.js.map +1 -0
  11. package/dist/index.cjs +338 -356
  12. package/dist/index.cjs.map +1 -1
  13. package/dist/index.d.cts +16 -10
  14. package/dist/index.d.ts +16 -10
  15. package/dist/index.js +100 -122
  16. package/dist/index.js.map +1 -1
  17. package/dist/{orchestration-embedding-model-strategy-2TODFL4O.js → orchestration-embedding-model-strategy-AGED2P35.js} +23 -40
  18. package/dist/orchestration-embedding-model-strategy-AGED2P35.js.map +1 -0
  19. package/dist/{orchestration-language-model-strategy-62DDBL3A.js → orchestration-language-model-strategy-QN56X3Z2.js} +38 -30
  20. package/dist/orchestration-language-model-strategy-QN56X3Z2.js.map +1 -0
  21. package/package.json +1 -1
  22. package/dist/chunk-J6IX7CM7.js.map +0 -1
  23. package/dist/foundation-models-embedding-model-strategy-BAZN2P7Z.js.map +0 -1
  24. package/dist/foundation-models-language-model-strategy-NKCAFUUQ.js.map +0 -1
  25. package/dist/orchestration-embedding-model-strategy-2TODFL4O.js.map +0 -1
  26. package/dist/orchestration-language-model-strategy-62DDBL3A.js.map +0 -1
  27. /package/dist/{chunk-XU6SXOA2.js.map → chunk-KO5GBKZB.js.map} +0 -0
package/README.md CHANGED
@@ -67,7 +67,7 @@ SAP's enterprise-grade AI models through the familiar Vercel AI SDK interface.
67
67
  - 🔒 **Data Masking** - Built-in SAP DPI integration for privacy
68
68
  - 🛡️ **Content Filtering** - Azure Content Safety and Llama Guard support
69
69
  - 🔧 **TypeScript Support** - Full type safety and IntelliSense
70
- - 🎨 **Multiple Models** - Support for GPT-4, Claude, Gemini, Nova, and more
70
+ - 🎨 **Multiple Models** - Support for OpenAI, Claude, Gemini, Nova, and more
71
71
  - ⚡ **Language Model V3** - Latest Vercel AI SDK specification with enhanced
72
72
  streaming
73
73
  - 📊 **Text Embeddings** - Generate vector embeddings for RAG and semantic
@@ -93,9 +93,9 @@ import { APICallError } from "@ai-sdk/provider";
93
93
  const provider = createSAPAIProvider();
94
94
 
95
95
  try {
96
- // Generate text with gpt-4o
96
+ // Generate text with gpt-4.1
97
97
  const result = await generateText({
98
- model: provider("gpt-4o"),
98
+ model: provider("gpt-4.1"),
99
99
  prompt: "Explain quantum computing in simple terms.",
100
100
  });
101
101
 
@@ -120,12 +120,12 @@ try {
120
120
  | **Install** | `npm install @jerome-benoit/sap-ai-provider ai` | [Installation](#installation) |
121
121
  | **Auth Setup** | Add `AICORE_SERVICE_KEY` to `.env` | [Environment Setup](./ENVIRONMENT_SETUP.md) |
122
122
  | **Create Provider** | `createSAPAIProvider()` or use `sapai` | [Provider Creation](#provider-creation) |
123
- | **Text Generation** | `generateText({ model: provider("gpt-4o"), prompt })` | [Basic Usage](#text-generation) |
124
- | **Streaming** | `streamText({ model: provider("gpt-4o"), prompt })` | [Streaming](#streaming-responses) |
123
+ | **Text Generation** | `generateText({ model: provider("gpt-4.1"), prompt })` | [Basic Usage](#text-generation) |
124
+ | **Streaming** | `streamText({ model: provider("gpt-4.1"), prompt })` | [Streaming](#streaming-responses) |
125
125
  | **Tool Calling** | `generateText({ tools: { myTool: tool({...}) } })` | [Tool Calling](#tool-calling) |
126
126
  | **Error Handling** | `catch (error instanceof APICallError)` | [API Reference](./API_REFERENCE.md#error-handling--reference) |
127
127
  | **Choose Model** | See 80+ models (GPT, Claude, Gemini, Llama) | [Models](./API_REFERENCE.md#models) |
128
- | **Embeddings** | `embed({ model: provider.embedding("text-embedding-ada-002") })` | [Embeddings](#embeddings) |
128
+ | **Embeddings** | `embed({ model: provider.embedding("text-embedding-3-small") })` | [Embeddings](#embeddings) |
129
129
 
130
130
  ## Installation
131
131
 
@@ -184,13 +184,13 @@ const provider = createSAPAIProvider({
184
184
  });
185
185
 
186
186
  // Model-level API override
187
- const model = provider("gpt-4o", {
187
+ const model = provider("gpt-4.1", {
188
188
  api: "orchestration", // Override for this model only
189
189
  });
190
190
 
191
191
  // Per-call API override via providerOptions
192
192
  const result = await generateText({
193
- model: provider("gpt-4o"),
193
+ model: provider("gpt-4.1"),
194
194
  prompt: "Hello",
195
195
  providerOptions: {
196
196
  [SAP_AI_PROVIDER_NAME]: {
@@ -215,7 +215,7 @@ import { generateText } from "ai";
215
215
 
216
216
  // Use directly with auto-detected configuration
217
217
  const result = await generateText({
218
- model: sapai("gpt-4o"),
218
+ model: sapai("gpt-4.1"),
219
219
  prompt: "Hello!",
220
220
  });
221
221
  ```
@@ -229,11 +229,11 @@ The provider is callable and also exposes explicit methods:
229
229
 
230
230
  ```typescript
231
231
  // Callable syntax (creates language model)
232
- const chatModel = provider("gpt-4o");
232
+ const chatModel = provider("gpt-4.1");
233
233
 
234
234
  // Explicit method syntax
235
- const chatModel = provider.chat("gpt-4o");
236
- const embeddingModel = provider.embedding("text-embedding-ada-002");
235
+ const chatModel = provider.chat("gpt-4.1");
236
+ const embeddingModel = provider.embedding("text-embedding-3-small");
237
237
  ```
238
238
 
239
239
  All methods accept an optional second parameter for model-specific settings.
@@ -255,7 +255,7 @@ instructions, SAP BTP deployment, and troubleshooting.
255
255
 
256
256
  ```typescript
257
257
  const result = await generateText({
258
- model: provider("gpt-4o"),
258
+ model: provider("gpt-4.1"),
259
259
  prompt: "Write a short story about a robot learning to paint.",
260
260
  });
261
261
  console.log(result.text);
@@ -274,7 +274,7 @@ console.log(result.text);
274
274
 
275
275
  ```typescript
276
276
  const result = await generateText({
277
- model: provider("anthropic--claude-3.5-sonnet"),
277
+ model: provider("anthropic--claude-4.5-sonnet"),
278
278
  messages: [
279
279
  { role: "system", content: "You are a helpful coding assistant." },
280
280
  {
@@ -298,7 +298,7 @@ import { APICallError } from "@ai-sdk/provider";
298
298
 
299
299
  try {
300
300
  const result = streamText({
301
- model: provider("gpt-4o"),
301
+ model: provider("gpt-4.1"),
302
302
  prompt: "Explain machine learning concepts.",
303
303
  });
304
304
 
@@ -333,7 +333,7 @@ import { generateText } from "ai";
333
333
 
334
334
  const provider = createSAPAIProvider();
335
335
 
336
- const model = provider("gpt-4o", {
336
+ const model = provider("gpt-4.1", {
337
337
  // Optional: include assistant reasoning parts (chain-of-thought).
338
338
  // Best practice is to keep this disabled.
339
339
  includeReasoning: false,
@@ -367,7 +367,7 @@ const provider = createSAPAIProvider();
367
367
 
368
368
  // Single embedding
369
369
  const { embedding } = await embed({
370
- model: provider.embedding("text-embedding-ada-002"),
370
+ model: provider.embedding("text-embedding-3-small"),
371
371
  value: "What is machine learning?",
372
372
  });
373
373
 
@@ -380,43 +380,24 @@ const { embeddings } = await embedMany({
380
380
 
381
381
  **Run it:** `npx tsx examples/example-embeddings.ts`
382
382
 
383
- **Common embedding models:**
384
-
385
- - `text-embedding-ada-002` - OpenAI Ada v2 (cost-effective)
386
- - `text-embedding-3-small` - OpenAI v3 small (balanced)
387
- - `text-embedding-3-large` - OpenAI v3 large (highest quality)
388
-
389
- > **Note:** Model availability depends on your SAP AI Core tenant configuration.
383
+ > **Note:** Embedding model availability depends on your SAP AI Core tenant
384
+ > configuration. Common providers include OpenAI, Amazon Titan, and NVIDIA.
390
385
 
391
386
  For complete embedding API documentation, see
392
387
  **[API Reference: Embeddings](./API_REFERENCE.md#embeddings)**.
393
388
 
394
389
  ## Supported Models
395
390
 
396
- This provider supports all models available through SAP AI Core, including:
397
-
398
- **Popular models:**
399
-
400
- - **OpenAI**: gpt-4o, gpt-4o-mini, gpt-4.1, o1, o3, o4-mini (recommended for
401
- multi-tool apps)
402
- - **Anthropic Claude**: anthropic--claude-3.5-sonnet, anthropic--claude-4-opus
403
- - **Google Gemini**: gemini-2.5-pro, gemini-2.0-flash
404
-
405
- - **Amazon Nova**: amazon--nova-pro, amazon--nova-lite
406
- - **Open Source**: mistralai--mistral-large-instruct,
407
- meta--llama3.1-70b-instruct
391
+ This provider supports all models available through SAP AI Core, including models
392
+ from **OpenAI**, **Anthropic Claude**, **Google Gemini**, **Amazon Nova**,
393
+ **Mistral AI**, **Cohere**, and **SAP** (ABAP, RPT).
408
394
 
409
395
  > **Note:** Model availability depends on your SAP AI Core tenant configuration,
410
- > region, and subscription.
411
-
412
- **To discover available models in your environment:**
413
-
414
- ```bash
415
- curl "https://<AI_API_URL>/v2/lm/deployments" -H "Authorization: Bearer $TOKEN"
416
- ```
396
+ > region, and subscription. Use `provider("model-name")` with any model ID
397
+ > available in your environment.
417
398
 
418
- For complete model details, capabilities comparison, and limitations, see
419
- **[API Reference: SAPAIModelId](./API_REFERENCE.md#sapaimodelid)**.
399
+ For details on discovering available models, see
400
+ **[API Reference: Supported Models](./API_REFERENCE.md#supported-models)**.
420
401
 
421
402
  ## Advanced Features
422
403
 
@@ -450,7 +431,7 @@ const weatherTool = tool({
450
431
  });
451
432
 
452
433
  const result = await generateText({
453
- model: provider("gpt-4o"),
434
+ model: provider("gpt-4.1"),
454
435
  prompt: "What's the weather in Tokyo?",
455
436
  tools: { getWeather: weatherTool },
456
437
  maxSteps: 3,
@@ -470,7 +451,7 @@ for the complete comparison table.
470
451
 
471
452
  ```typescript
472
453
  const result = await generateText({
473
- model: provider("gpt-4o"),
454
+ model: provider("gpt-4.1"),
474
455
  messages: [
475
456
  {
476
457
  role: "user",
@@ -558,7 +539,7 @@ const provider = createSAPAIProvider({
558
539
  });
559
540
 
560
541
  // Queries are now grounded in your documents
561
- const model = provider("gpt-4o");
542
+ const model = provider("gpt-4.1");
562
543
  ```
563
544
 
564
545
  **Run it:** `npx tsx examples/example-document-grounding.ts`
@@ -590,7 +571,7 @@ const provider = createSAPAIProvider({
590
571
  });
591
572
 
592
573
  // Model handles German input/output automatically
593
- const model = provider("gpt-4o");
574
+ const model = provider("gpt-4.1");
594
575
  ```
595
576
 
596
577
  **Run it:** `npx tsx examples/example-translation.ts`
@@ -607,7 +588,7 @@ import { createSAPAIProvider, SAP_AI_PROVIDER_NAME } from "@jerome-benoit/sap-ai
607
588
  const provider = createSAPAIProvider();
608
589
 
609
590
  const result = await generateText({
610
- model: provider("gpt-4o"),
591
+ model: provider("gpt-4.1"),
611
592
  prompt: "Explain quantum computing",
612
593
  providerOptions: {
613
594
  [SAP_AI_PROVIDER_NAME]: {
@@ -29921,6 +29921,111 @@ var HTTP_STATUS = {
29921
29921
  SERVICE_UNAVAILABLE: 503,
29922
29922
  UNAUTHORIZED: 401
29923
29923
  };
29924
+ var ERROR_MATCHERS = [
29925
+ {
29926
+ category: "network",
29927
+ isRetryable: true,
29928
+ keywords: ["econnrefused", "enotfound", "network", "timeout"],
29929
+ statusCode: HTTP_STATUS.SERVICE_UNAVAILABLE
29930
+ },
29931
+ {
29932
+ category: "destination",
29933
+ isRetryable: false,
29934
+ keywords: ["could not resolve destination"],
29935
+ message: (original) => `SAP AI Core destination error: ${original}
29936
+
29937
+ Check your destination configuration or provide a valid destinationName.`,
29938
+ statusCode: HTTP_STATUS.BAD_REQUEST
29939
+ },
29940
+ {
29941
+ category: "content filtered",
29942
+ isRetryable: false,
29943
+ keywords: ["filtered by the output filter"],
29944
+ message: (original) => `Content was filtered: ${original}
29945
+
29946
+ The model's response was blocked by content safety filters. Try a different prompt.`,
29947
+ statusCode: HTTP_STATUS.BAD_REQUEST
29948
+ },
29949
+ {
29950
+ category: "stream consumption",
29951
+ isRetryable: false,
29952
+ keywords: ["consumed stream"],
29953
+ statusCode: HTTP_STATUS.INTERNAL_ERROR
29954
+ },
29955
+ {
29956
+ category: "streaming",
29957
+ isRetryable: true,
29958
+ keywords: [
29959
+ "iterating over",
29960
+ "parse message into json",
29961
+ "received from",
29962
+ "no body",
29963
+ "invalid sse payload"
29964
+ ],
29965
+ statusCode: HTTP_STATUS.INTERNAL_ERROR
29966
+ },
29967
+ {
29968
+ category: "configuration",
29969
+ isRetryable: false,
29970
+ keywords: [
29971
+ "prompt template or messages must be defined",
29972
+ "filtering parameters cannot be empty",
29973
+ "templating yaml string must be non-empty",
29974
+ "could not access response data",
29975
+ "could not parse json",
29976
+ "error parsing yaml",
29977
+ "yaml does not conform",
29978
+ "validation errors"
29979
+ ],
29980
+ statusCode: HTTP_STATUS.BAD_REQUEST
29981
+ },
29982
+ {
29983
+ category: "environment",
29984
+ isRetryable: false,
29985
+ keywords: ["buffer is not available as globals"],
29986
+ statusCode: HTTP_STATUS.INTERNAL_ERROR
29987
+ },
29988
+ {
29989
+ category: "response stream",
29990
+ isRetryable: false,
29991
+ keywords: ["response stream is undefined"],
29992
+ statusCode: HTTP_STATUS.INTERNAL_ERROR
29993
+ },
29994
+ {
29995
+ category: "response processing",
29996
+ isRetryable: true,
29997
+ keywords: [
29998
+ "response is required to process",
29999
+ "stream is still open",
30000
+ "data is not available yet"
30001
+ ],
30002
+ statusCode: HTTP_STATUS.INTERNAL_ERROR
30003
+ },
30004
+ {
30005
+ category: "deployment retrieval",
30006
+ isRetryable: true,
30007
+ keywords: ["failed to fetch the list of deployments"],
30008
+ statusCode: HTTP_STATUS.SERVICE_UNAVAILABLE
30009
+ },
30010
+ {
30011
+ category: "stream buffer",
30012
+ isRetryable: false,
30013
+ keywords: ["received non-uint8array"],
30014
+ statusCode: HTTP_STATUS.INTERNAL_ERROR
30015
+ }
30016
+ ];
30017
+ var AUTHENTICATION_ERROR_KEYWORDS = [
30018
+ "authentication",
30019
+ "unauthorized",
30020
+ "aicore_service_key",
30021
+ "invalid credentials",
30022
+ "service credentials",
30023
+ "service binding"
30024
+ ];
30025
+ var DEPLOYMENT_ERROR_KEYWORDS = [
30026
+ "failed to resolve deployment",
30027
+ "no deployment matched"
30028
+ ];
29924
30029
  var ApiSwitchError = class extends Error {
29925
30030
  /**
29926
30031
  * Creates a new ApiSwitchError.
@@ -30058,7 +30163,7 @@ function convertToAISDKError(error, context) {
30058
30163
  if (rootError instanceof Error) {
30059
30164
  const errorMsg = rootError.message.toLowerCase();
30060
30165
  const originalErrorMsg = rootError.message;
30061
- if (errorMsg.includes("authentication") || errorMsg.includes("unauthorized") || errorMsg.includes("aicore_service_key") || errorMsg.includes("invalid credentials") || errorMsg.includes("service credentials") || errorMsg.includes("service binding")) {
30166
+ if (AUTHENTICATION_ERROR_KEYWORDS.some((keyword) => errorMsg.includes(keyword))) {
30062
30167
  return new LoadAPIKeyError({
30063
30168
  message: `SAP AI Core authentication failed: ${originalErrorMsg}
30064
30169
 
@@ -30066,31 +30171,7 @@ Make sure your AICORE_SERVICE_KEY environment variable is set correctly.
30066
30171
  See: https://help.sap.com/docs/sap-ai-core/sap-ai-core-service-guide/create-service-key`
30067
30172
  });
30068
30173
  }
30069
- if (errorMsg.includes("econnrefused") || errorMsg.includes("enotfound") || errorMsg.includes("network") || errorMsg.includes("timeout")) {
30070
- return createAPICallError(
30071
- error,
30072
- {
30073
- isRetryable: true,
30074
- message: `Network error connecting to SAP AI Core: ${originalErrorMsg}`,
30075
- statusCode: HTTP_STATUS.SERVICE_UNAVAILABLE
30076
- },
30077
- context
30078
- );
30079
- }
30080
- if (errorMsg.includes("could not resolve destination")) {
30081
- return createAPICallError(
30082
- error,
30083
- {
30084
- isRetryable: false,
30085
- message: `SAP AI Core destination error: ${originalErrorMsg}
30086
-
30087
- Check your destination configuration or provide a valid destinationName.`,
30088
- statusCode: HTTP_STATUS.BAD_REQUEST
30089
- },
30090
- context
30091
- );
30092
- }
30093
- if (errorMsg.includes("failed to resolve deployment") || errorMsg.includes("no deployment matched")) {
30174
+ if (DEPLOYMENT_ERROR_KEYWORDS.some((keyword) => errorMsg.includes(keyword))) {
30094
30175
  const modelId = extractModelIdentifier(originalErrorMsg);
30095
30176
  return new NoSuchModelError({
30096
30177
  message: `SAP AI Core deployment error: ${originalErrorMsg}
@@ -30101,19 +30182,6 @@ See: https://help.sap.com/docs/sap-ai-core/sap-ai-core-service-guide/create-depl
30101
30182
  modelType: "languageModel"
30102
30183
  });
30103
30184
  }
30104
- if (errorMsg.includes("filtered by the output filter")) {
30105
- return createAPICallError(
30106
- error,
30107
- {
30108
- isRetryable: false,
30109
- message: `Content was filtered: ${originalErrorMsg}
30110
-
30111
- The model's response was blocked by content safety filters. Try a different prompt.`,
30112
- statusCode: HTTP_STATUS.BAD_REQUEST
30113
- },
30114
- context
30115
- );
30116
- }
30117
30185
  const statusMatch = /status code (\d+)/i.exec(originalErrorMsg);
30118
30186
  if (statusMatch?.[1]) {
30119
30187
  const extractedStatus = Number.parseInt(statusMatch[1], 10);
@@ -30127,93 +30195,19 @@ The model's response was blocked by content safety filters. Try a different prom
30127
30195
  context
30128
30196
  );
30129
30197
  }
30130
- if (errorMsg.includes("consumed stream")) {
30131
- return createAPICallError(
30132
- error,
30133
- {
30134
- isRetryable: false,
30135
- message: `SAP AI Core stream consumption error: ${originalErrorMsg}`,
30136
- statusCode: HTTP_STATUS.INTERNAL_ERROR
30137
- },
30138
- context
30139
- );
30140
- }
30141
- if (errorMsg.includes("iterating over") || errorMsg.includes("parse message into json") || errorMsg.includes("received from") || errorMsg.includes("no body") || errorMsg.includes("invalid sse payload")) {
30142
- return createAPICallError(
30143
- error,
30144
- {
30145
- isRetryable: true,
30146
- message: `SAP AI Core streaming error: ${originalErrorMsg}`,
30147
- statusCode: HTTP_STATUS.INTERNAL_ERROR
30148
- },
30149
- context
30150
- );
30151
- }
30152
- if (errorMsg.includes("prompt template or messages must be defined") || errorMsg.includes("filtering parameters cannot be empty") || errorMsg.includes("templating yaml string must be non-empty") || errorMsg.includes("could not access response data") || errorMsg.includes("could not parse json") || errorMsg.includes("error parsing yaml") || errorMsg.includes("yaml does not conform") || errorMsg.includes("validation errors")) {
30153
- return createAPICallError(
30154
- error,
30155
- {
30156
- isRetryable: false,
30157
- message: `SAP AI Core configuration error: ${originalErrorMsg}`,
30158
- statusCode: HTTP_STATUS.BAD_REQUEST
30159
- },
30160
- context
30161
- );
30162
- }
30163
- if (errorMsg.includes("buffer is not available as globals")) {
30164
- return createAPICallError(
30165
- error,
30166
- {
30167
- isRetryable: false,
30168
- message: `SAP AI Core environment error: ${originalErrorMsg}`,
30169
- statusCode: HTTP_STATUS.INTERNAL_ERROR
30170
- },
30171
- context
30172
- );
30173
- }
30174
- if (errorMsg.includes("response stream is undefined")) {
30175
- return createAPICallError(
30176
- error,
30177
- {
30178
- isRetryable: false,
30179
- message: `SAP AI Core response stream error: ${originalErrorMsg}`,
30180
- statusCode: HTTP_STATUS.INTERNAL_ERROR
30181
- },
30182
- context
30183
- );
30184
- }
30185
- if (errorMsg.includes("response is required to process") || errorMsg.includes("stream is still open") || errorMsg.includes("data is not available yet")) {
30186
- return createAPICallError(
30187
- error,
30188
- {
30189
- isRetryable: true,
30190
- message: `SAP AI Core response processing error: ${originalErrorMsg}`,
30191
- statusCode: HTTP_STATUS.INTERNAL_ERROR
30192
- },
30193
- context
30194
- );
30195
- }
30196
- if (errorMsg.includes("failed to fetch the list of deployments")) {
30197
- return createAPICallError(
30198
- error,
30199
- {
30200
- isRetryable: true,
30201
- message: `SAP AI Core deployment retrieval error: ${originalErrorMsg}`,
30202
- statusCode: HTTP_STATUS.SERVICE_UNAVAILABLE
30203
- },
30204
- context
30205
- );
30206
- }
30207
- if (errorMsg.includes("received non-uint8array")) {
30208
- return createAPICallError(
30209
- error,
30210
- {
30211
- isRetryable: false,
30212
- message: `SAP AI Core stream buffer error: ${originalErrorMsg}`,
30213
- statusCode: HTTP_STATUS.INTERNAL_ERROR
30214
- },
30215
- context
30216
- );
30198
+ for (const matcher of ERROR_MATCHERS) {
30199
+ if (matcher.keywords.some((keyword) => errorMsg.includes(keyword))) {
30200
+ const message2 = "message" in matcher ? matcher.message(originalErrorMsg) : `SAP AI Core ${matcher.category} error: ${originalErrorMsg}`;
30201
+ return createAPICallError(
30202
+ error,
30203
+ {
30204
+ isRetryable: matcher.isRetryable,
30205
+ message: message2,
30206
+ statusCode: matcher.statusCode
30207
+ },
30208
+ context
30209
+ );
30210
+ }
30217
30211
  }
30218
30212
  }
30219
30213
  const message = rootError instanceof Error ? rootError.message : typeof rootError === "string" ? rootError : "Unknown error occurred";
@@ -30381,7 +30375,7 @@ function tryExtractSAPErrorFromMessage(message) {
30381
30375
  }
30382
30376
 
30383
30377
  // src/version.ts
30384
- var VERSION = true ? "4.4.8" : "0.0.0-test";
30378
+ var VERSION = true ? "4.4.9" : "0.0.0-test";
30385
30379
 
30386
30380
  export {
30387
30381
  __toESM,
@@ -30434,4 +30428,4 @@ mime-types/index.js:
30434
30428
  axios/dist/node/axios.cjs:
30435
30429
  (*! Axios v1.13.4 Copyright (c) 2026 Matt Zabriskie and contributors *)
30436
30430
  */
30437
- //# sourceMappingURL=chunk-PF3ZCJ3H.js.map
30431
+ //# sourceMappingURL=chunk-7VLWN7WJ.js.map