@jerome-benoit/sap-ai-provider 4.6.9 → 4.7.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.
Files changed (40) hide show
  1. package/LICENSE +202 -0
  2. package/README.md +1 -1
  3. package/dist/{chunk-4RRRJBEL.js → chunk-36DFHUVQ.js} +407 -275
  4. package/dist/chunk-36DFHUVQ.js.map +1 -0
  5. package/dist/{chunk-EXOXZ5OU.js → chunk-4JIMBRMV.js} +44 -7
  6. package/dist/chunk-4JIMBRMV.js.map +1 -0
  7. package/dist/{chunk-DYFBCE2W.js → chunk-BZZJKLDG.js} +60 -6
  8. package/dist/chunk-BZZJKLDG.js.map +1 -0
  9. package/dist/chunk-GMMX46AH.js +93 -0
  10. package/dist/chunk-GMMX46AH.js.map +1 -0
  11. package/dist/{chunk-F4MUYVQJ.js → chunk-TVXWNZQT.js} +1714 -865
  12. package/dist/chunk-TVXWNZQT.js.map +1 -0
  13. package/dist/chunk-WDUOKIKD.js +188 -0
  14. package/dist/chunk-WDUOKIKD.js.map +1 -0
  15. package/dist/{foundation-models-embedding-model-strategy-3MMM3QDC.js → foundation-models-embedding-model-strategy-YWPDIJEN.js} +8 -4
  16. package/dist/foundation-models-embedding-model-strategy-YWPDIJEN.js.map +1 -0
  17. package/dist/{foundation-models-language-model-strategy-OPGTN6DA.js → foundation-models-language-model-strategy-WDSQWU64.js} +15 -10
  18. package/dist/foundation-models-language-model-strategy-WDSQWU64.js.map +1 -0
  19. package/dist/index.cjs +2620 -1503
  20. package/dist/index.cjs.map +1 -1
  21. package/dist/index.d.cts +66 -66
  22. package/dist/index.d.ts +66 -66
  23. package/dist/index.js +11 -172
  24. package/dist/index.js.map +1 -1
  25. package/dist/{orchestration-embedding-model-strategy-R6G6VVU6.js → orchestration-embedding-model-strategy-66QYAO64.js} +14 -4
  26. package/dist/orchestration-embedding-model-strategy-66QYAO64.js.map +1 -0
  27. package/dist/{orchestration-language-model-strategy-KFW3CFRY.js → orchestration-language-model-strategy-4TKRZK7U.js} +52 -77
  28. package/dist/orchestration-language-model-strategy-4TKRZK7U.js.map +1 -0
  29. package/package.json +20 -14
  30. package/LICENSE.md +0 -187
  31. package/dist/chunk-4RRRJBEL.js.map +0 -1
  32. package/dist/chunk-DYFBCE2W.js.map +0 -1
  33. package/dist/chunk-EXOXZ5OU.js.map +0 -1
  34. package/dist/chunk-F4MUYVQJ.js.map +0 -1
  35. package/dist/chunk-NQJIUL3F.js +0 -61
  36. package/dist/chunk-NQJIUL3F.js.map +0 -1
  37. package/dist/foundation-models-embedding-model-strategy-3MMM3QDC.js.map +0 -1
  38. package/dist/foundation-models-language-model-strategy-OPGTN6DA.js.map +0 -1
  39. package/dist/orchestration-embedding-model-strategy-R6G6VVU6.js.map +0 -1
  40. package/dist/orchestration-language-model-strategy-KFW3CFRY.js.map +0 -1
package/dist/index.d.cts CHANGED
@@ -7,6 +7,63 @@ export { AssistantChatMessage, ChatCompletionRequest, ChatCompletionTool, ChatMe
7
7
  import * as _ai_sdk_provider_utils from '@ai-sdk/provider-utils';
8
8
  import { InferSchema } from '@ai-sdk/provider-utils';
9
9
 
10
+ /** Default provider name used as key in `providerOptions` and `providerMetadata` objects. */
11
+ declare const SAP_AI_PROVIDER_NAME: "sap-ai";
12
+ /**
13
+ * Extracts the provider name from a provider identifier (e.g., "sap-ai.chat" → "sap-ai").
14
+ * @param providerIdentifier - The full provider identifier string.
15
+ * @returns The provider name without any suffix.
16
+ */
17
+ declare function getProviderName(providerIdentifier: string): string;
18
+ /** @internal */
19
+ declare const sapAILanguageModelProviderOptions: _ai_sdk_provider_utils.LazySchema<{
20
+ api?: "orchestration" | "foundation-models" | undefined;
21
+ escapeTemplatePlaceholders?: boolean | undefined;
22
+ includeReasoning?: boolean | undefined;
23
+ modelParams?: {
24
+ [x: string]: unknown;
25
+ frequencyPenalty?: number | undefined;
26
+ maxTokens?: number | undefined;
27
+ n?: number | undefined;
28
+ parallel_tool_calls?: boolean | undefined;
29
+ presencePenalty?: number | undefined;
30
+ temperature?: number | undefined;
31
+ topP?: number | undefined;
32
+ } | undefined;
33
+ orchestrationConfigRef?: {
34
+ id: string;
35
+ } | {
36
+ name: string;
37
+ scenario: string;
38
+ version: string;
39
+ } | undefined;
40
+ placeholderValues?: Record<string, string> | undefined;
41
+ promptTemplateRef?: {
42
+ id: string;
43
+ scope?: "tenant" | "resource_group" | undefined;
44
+ } | {
45
+ name: string;
46
+ scenario: string;
47
+ version: string;
48
+ scope?: "tenant" | "resource_group" | undefined;
49
+ } | undefined;
50
+ }>;
51
+ /** @internal */
52
+ type SAPAILanguageModelProviderOptions = InferSchema<typeof sapAILanguageModelProviderOptions>;
53
+ /** @internal */
54
+ declare const sapAIEmbeddingProviderOptions: _ai_sdk_provider_utils.LazySchema<{
55
+ api?: "orchestration" | "foundation-models" | undefined;
56
+ modelParams?: {
57
+ [x: string]: unknown;
58
+ dimensions?: number | undefined;
59
+ encoding_format?: "base64" | "binary" | "float" | undefined;
60
+ normalize?: boolean | undefined;
61
+ } | undefined;
62
+ type?: "document" | "query" | "text" | undefined;
63
+ }>;
64
+ /** @internal */
65
+ type SAPAIEmbeddingProviderOptions = InferSchema<typeof sapAIEmbeddingProviderOptions>;
66
+
10
67
  /**
11
68
  * Escapes Jinja2 template delimiters by inserting zero-width spaces.
12
69
  *
@@ -138,7 +195,9 @@ interface OrchestrationModelSettings {
138
195
  readonly grounding?: GroundingModule;
139
196
  /** @default false */
140
197
  readonly includeReasoning?: boolean;
141
- readonly masking?: MaskingModule;
198
+ readonly masking?: MaskingModule | {
199
+ providers: MaskingModule["masking_providers"];
200
+ };
142
201
  readonly modelParams?: OrchestrationModelParams;
143
202
  readonly modelVersion?: string;
144
203
  /**
@@ -214,7 +273,9 @@ type SAPAIDefaultSettingsConfig = FoundationModelsDefaultSettings | Orchestratio
214
273
  interface SAPAIEmbeddingSettings {
215
274
  readonly api?: SAPAIApiType;
216
275
  /** Orchestration API only. */
217
- readonly masking?: MaskingModule;
276
+ readonly masking?: MaskingModule | {
277
+ providers: MaskingModule["masking_providers"];
278
+ };
218
279
  /** @default 2048 */
219
280
  readonly maxEmbeddingsPerCall?: number;
220
281
  readonly modelParams?: FoundationModelsEmbeddingParams | Record<string, unknown>;
@@ -255,7 +316,9 @@ interface SAPAISettings {
255
316
  /** @default false */
256
317
  readonly includeReasoning?: boolean;
257
318
  /** Orchestration API only. */
258
- readonly masking?: MaskingModule;
319
+ readonly masking?: MaskingModule | {
320
+ providers: MaskingModule["masking_providers"];
321
+ };
259
322
  readonly modelParams?: CommonModelParams;
260
323
  readonly modelVersion?: string;
261
324
  /** Orchestration API only. */
@@ -457,12 +520,6 @@ interface SAPAILanguageModelConfig {
457
520
  declare class SAPAILanguageModel implements LanguageModelV3 {
458
521
  readonly modelId: SAPAIModelId;
459
522
  readonly specificationVersion = "v3";
460
- readonly supportsImageUrls: boolean;
461
- readonly supportsMultipleCompletions: boolean;
462
- readonly supportsParallelToolCalls: boolean;
463
- readonly supportsStreaming: boolean;
464
- readonly supportsStructuredOutputs: boolean;
465
- readonly supportsToolCalls: boolean;
466
523
  get provider(): string;
467
524
  get supportedUrls(): Record<string, RegExp[]>;
468
525
  /** @internal */
@@ -488,63 +545,6 @@ declare class SAPAILanguageModel implements LanguageModelV3 {
488
545
  private prepareInvocation;
489
546
  }
490
547
 
491
- /** Default provider name used as key in `providerOptions` and `providerMetadata` objects. */
492
- declare const SAP_AI_PROVIDER_NAME: "sap-ai";
493
- /**
494
- * Extracts the provider name from a provider identifier (e.g., "sap-ai.chat" → "sap-ai").
495
- * @param providerIdentifier - The full provider identifier string.
496
- * @returns The provider name without any suffix.
497
- */
498
- declare function getProviderName(providerIdentifier: string): string;
499
- /** @internal */
500
- declare const sapAILanguageModelProviderOptions: _ai_sdk_provider_utils.LazySchema<{
501
- api?: "foundation-models" | "orchestration" | undefined;
502
- escapeTemplatePlaceholders?: boolean | undefined;
503
- includeReasoning?: boolean | undefined;
504
- modelParams?: {
505
- [x: string]: unknown;
506
- frequencyPenalty?: number | undefined;
507
- maxTokens?: number | undefined;
508
- n?: number | undefined;
509
- parallel_tool_calls?: boolean | undefined;
510
- presencePenalty?: number | undefined;
511
- temperature?: number | undefined;
512
- topP?: number | undefined;
513
- } | undefined;
514
- orchestrationConfigRef?: {
515
- id: string;
516
- } | {
517
- name: string;
518
- scenario: string;
519
- version: string;
520
- } | undefined;
521
- placeholderValues?: Record<string, string> | undefined;
522
- promptTemplateRef?: {
523
- id: string;
524
- scope?: "resource_group" | "tenant" | undefined;
525
- } | {
526
- name: string;
527
- scenario: string;
528
- version: string;
529
- scope?: "resource_group" | "tenant" | undefined;
530
- } | undefined;
531
- }>;
532
- /** @internal */
533
- type SAPAILanguageModelProviderOptions = InferSchema<typeof sapAILanguageModelProviderOptions>;
534
- /** @internal */
535
- declare const sapAIEmbeddingProviderOptions: _ai_sdk_provider_utils.LazySchema<{
536
- api?: "foundation-models" | "orchestration" | undefined;
537
- modelParams?: {
538
- [x: string]: unknown;
539
- dimensions?: number | undefined;
540
- encoding_format?: "base64" | "binary" | "float" | undefined;
541
- normalize?: boolean | undefined;
542
- } | undefined;
543
- type?: "text" | "document" | "query" | undefined;
544
- }>;
545
- /** @internal */
546
- type SAPAIEmbeddingProviderOptions = InferSchema<typeof sapAIEmbeddingProviderOptions>;
547
-
548
548
  /** SAP AI Core deployment configuration: either a deployment ID or a resource group. */
549
549
  type DeploymentConfig = DeploymentIdConfig | ResourceGroupConfig;
550
550
  /** SAP AI Provider interface extending Vercel AI SDK ProviderV3. */
package/dist/index.d.ts CHANGED
@@ -7,6 +7,63 @@ export { AssistantChatMessage, ChatCompletionRequest, ChatCompletionTool, ChatMe
7
7
  import * as _ai_sdk_provider_utils from '@ai-sdk/provider-utils';
8
8
  import { InferSchema } from '@ai-sdk/provider-utils';
9
9
 
10
+ /** Default provider name used as key in `providerOptions` and `providerMetadata` objects. */
11
+ declare const SAP_AI_PROVIDER_NAME: "sap-ai";
12
+ /**
13
+ * Extracts the provider name from a provider identifier (e.g., "sap-ai.chat" → "sap-ai").
14
+ * @param providerIdentifier - The full provider identifier string.
15
+ * @returns The provider name without any suffix.
16
+ */
17
+ declare function getProviderName(providerIdentifier: string): string;
18
+ /** @internal */
19
+ declare const sapAILanguageModelProviderOptions: _ai_sdk_provider_utils.LazySchema<{
20
+ api?: "orchestration" | "foundation-models" | undefined;
21
+ escapeTemplatePlaceholders?: boolean | undefined;
22
+ includeReasoning?: boolean | undefined;
23
+ modelParams?: {
24
+ [x: string]: unknown;
25
+ frequencyPenalty?: number | undefined;
26
+ maxTokens?: number | undefined;
27
+ n?: number | undefined;
28
+ parallel_tool_calls?: boolean | undefined;
29
+ presencePenalty?: number | undefined;
30
+ temperature?: number | undefined;
31
+ topP?: number | undefined;
32
+ } | undefined;
33
+ orchestrationConfigRef?: {
34
+ id: string;
35
+ } | {
36
+ name: string;
37
+ scenario: string;
38
+ version: string;
39
+ } | undefined;
40
+ placeholderValues?: Record<string, string> | undefined;
41
+ promptTemplateRef?: {
42
+ id: string;
43
+ scope?: "tenant" | "resource_group" | undefined;
44
+ } | {
45
+ name: string;
46
+ scenario: string;
47
+ version: string;
48
+ scope?: "tenant" | "resource_group" | undefined;
49
+ } | undefined;
50
+ }>;
51
+ /** @internal */
52
+ type SAPAILanguageModelProviderOptions = InferSchema<typeof sapAILanguageModelProviderOptions>;
53
+ /** @internal */
54
+ declare const sapAIEmbeddingProviderOptions: _ai_sdk_provider_utils.LazySchema<{
55
+ api?: "orchestration" | "foundation-models" | undefined;
56
+ modelParams?: {
57
+ [x: string]: unknown;
58
+ dimensions?: number | undefined;
59
+ encoding_format?: "base64" | "binary" | "float" | undefined;
60
+ normalize?: boolean | undefined;
61
+ } | undefined;
62
+ type?: "document" | "query" | "text" | undefined;
63
+ }>;
64
+ /** @internal */
65
+ type SAPAIEmbeddingProviderOptions = InferSchema<typeof sapAIEmbeddingProviderOptions>;
66
+
10
67
  /**
11
68
  * Escapes Jinja2 template delimiters by inserting zero-width spaces.
12
69
  *
@@ -138,7 +195,9 @@ interface OrchestrationModelSettings {
138
195
  readonly grounding?: GroundingModule;
139
196
  /** @default false */
140
197
  readonly includeReasoning?: boolean;
141
- readonly masking?: MaskingModule;
198
+ readonly masking?: MaskingModule | {
199
+ providers: MaskingModule["masking_providers"];
200
+ };
142
201
  readonly modelParams?: OrchestrationModelParams;
143
202
  readonly modelVersion?: string;
144
203
  /**
@@ -214,7 +273,9 @@ type SAPAIDefaultSettingsConfig = FoundationModelsDefaultSettings | Orchestratio
214
273
  interface SAPAIEmbeddingSettings {
215
274
  readonly api?: SAPAIApiType;
216
275
  /** Orchestration API only. */
217
- readonly masking?: MaskingModule;
276
+ readonly masking?: MaskingModule | {
277
+ providers: MaskingModule["masking_providers"];
278
+ };
218
279
  /** @default 2048 */
219
280
  readonly maxEmbeddingsPerCall?: number;
220
281
  readonly modelParams?: FoundationModelsEmbeddingParams | Record<string, unknown>;
@@ -255,7 +316,9 @@ interface SAPAISettings {
255
316
  /** @default false */
256
317
  readonly includeReasoning?: boolean;
257
318
  /** Orchestration API only. */
258
- readonly masking?: MaskingModule;
319
+ readonly masking?: MaskingModule | {
320
+ providers: MaskingModule["masking_providers"];
321
+ };
259
322
  readonly modelParams?: CommonModelParams;
260
323
  readonly modelVersion?: string;
261
324
  /** Orchestration API only. */
@@ -457,12 +520,6 @@ interface SAPAILanguageModelConfig {
457
520
  declare class SAPAILanguageModel implements LanguageModelV3 {
458
521
  readonly modelId: SAPAIModelId;
459
522
  readonly specificationVersion = "v3";
460
- readonly supportsImageUrls: boolean;
461
- readonly supportsMultipleCompletions: boolean;
462
- readonly supportsParallelToolCalls: boolean;
463
- readonly supportsStreaming: boolean;
464
- readonly supportsStructuredOutputs: boolean;
465
- readonly supportsToolCalls: boolean;
466
523
  get provider(): string;
467
524
  get supportedUrls(): Record<string, RegExp[]>;
468
525
  /** @internal */
@@ -488,63 +545,6 @@ declare class SAPAILanguageModel implements LanguageModelV3 {
488
545
  private prepareInvocation;
489
546
  }
490
547
 
491
- /** Default provider name used as key in `providerOptions` and `providerMetadata` objects. */
492
- declare const SAP_AI_PROVIDER_NAME: "sap-ai";
493
- /**
494
- * Extracts the provider name from a provider identifier (e.g., "sap-ai.chat" → "sap-ai").
495
- * @param providerIdentifier - The full provider identifier string.
496
- * @returns The provider name without any suffix.
497
- */
498
- declare function getProviderName(providerIdentifier: string): string;
499
- /** @internal */
500
- declare const sapAILanguageModelProviderOptions: _ai_sdk_provider_utils.LazySchema<{
501
- api?: "foundation-models" | "orchestration" | undefined;
502
- escapeTemplatePlaceholders?: boolean | undefined;
503
- includeReasoning?: boolean | undefined;
504
- modelParams?: {
505
- [x: string]: unknown;
506
- frequencyPenalty?: number | undefined;
507
- maxTokens?: number | undefined;
508
- n?: number | undefined;
509
- parallel_tool_calls?: boolean | undefined;
510
- presencePenalty?: number | undefined;
511
- temperature?: number | undefined;
512
- topP?: number | undefined;
513
- } | undefined;
514
- orchestrationConfigRef?: {
515
- id: string;
516
- } | {
517
- name: string;
518
- scenario: string;
519
- version: string;
520
- } | undefined;
521
- placeholderValues?: Record<string, string> | undefined;
522
- promptTemplateRef?: {
523
- id: string;
524
- scope?: "resource_group" | "tenant" | undefined;
525
- } | {
526
- name: string;
527
- scenario: string;
528
- version: string;
529
- scope?: "resource_group" | "tenant" | undefined;
530
- } | undefined;
531
- }>;
532
- /** @internal */
533
- type SAPAILanguageModelProviderOptions = InferSchema<typeof sapAILanguageModelProviderOptions>;
534
- /** @internal */
535
- declare const sapAIEmbeddingProviderOptions: _ai_sdk_provider_utils.LazySchema<{
536
- api?: "foundation-models" | "orchestration" | undefined;
537
- modelParams?: {
538
- [x: string]: unknown;
539
- dimensions?: number | undefined;
540
- encoding_format?: "base64" | "binary" | "float" | undefined;
541
- normalize?: boolean | undefined;
542
- } | undefined;
543
- type?: "text" | "document" | "query" | undefined;
544
- }>;
545
- /** @internal */
546
- type SAPAIEmbeddingProviderOptions = InferSchema<typeof sapAIEmbeddingProviderOptions>;
547
-
548
548
  /** SAP AI Core deployment configuration: either a deployment ID or a resource group. */
549
549
  type DeploymentConfig = DeploymentIdConfig | ResourceGroupConfig;
550
550
  /** SAP AI Provider interface extending Vercel AI SDK ProviderV3. */
package/dist/index.js CHANGED
@@ -1,22 +1,26 @@
1
1
  import {createRequire as __createRequire} from 'module';var require=__createRequire(import.meta.url);
2
+ import {
3
+ mergeSettingsWithApi,
4
+ resolveApi,
5
+ validateSettings
6
+ } from "./chunk-WDUOKIKD.js";
2
7
  import {
3
8
  escapeOrchestrationPlaceholders,
4
9
  unescapeOrchestrationPlaceholders
5
- } from "./chunk-EXOXZ5OU.js";
10
+ } from "./chunk-4JIMBRMV.js";
6
11
  import {
7
12
  ApiSwitchError,
8
13
  SAP_AI_PROVIDER_NAME,
9
14
  UnsupportedFeatureError,
10
15
  VERSION,
11
16
  __toESM,
12
- deepMerge,
13
17
  getProviderName,
14
18
  require_dist,
15
19
  sapAIEmbeddingProviderOptions,
16
20
  sapAILanguageModelProviderOptions,
17
21
  validateEmbeddingModelParamsSettings,
18
22
  validateModelParamsSettings
19
- } from "./chunk-F4MUYVQJ.js";
23
+ } from "./chunk-TVXWNZQT.js";
20
24
 
21
25
  // src/sap-ai-embedding-model.ts
22
26
  import { parseProviderOptions } from "@ai-sdk/provider-utils";
@@ -51,183 +55,24 @@ function getOrCreateLanguageModelStrategy(api) {
51
55
  async function createEmbeddingModelStrategy(api) {
52
56
  if (api === "foundation-models") {
53
57
  const { AzureOpenAiEmbeddingClient } = await import("@sap-ai-sdk/foundation-models");
54
- const { FoundationModelsEmbeddingModelStrategy } = await import("./foundation-models-embedding-model-strategy-3MMM3QDC.js");
58
+ const { FoundationModelsEmbeddingModelStrategy } = await import("./foundation-models-embedding-model-strategy-YWPDIJEN.js");
55
59
  return new FoundationModelsEmbeddingModelStrategy(AzureOpenAiEmbeddingClient);
56
60
  }
57
61
  const { OrchestrationEmbeddingClient: OrchestrationEmbeddingClient2 } = await import("@sap-ai-sdk/orchestration");
58
- const { OrchestrationEmbeddingModelStrategy } = await import("./orchestration-embedding-model-strategy-R6G6VVU6.js");
62
+ const { OrchestrationEmbeddingModelStrategy } = await import("./orchestration-embedding-model-strategy-66QYAO64.js");
59
63
  return new OrchestrationEmbeddingModelStrategy(OrchestrationEmbeddingClient2);
60
64
  }
61
65
  async function createLanguageModelStrategy(api) {
62
66
  if (api === "foundation-models") {
63
67
  const { AzureOpenAiChatClient } = await import("@sap-ai-sdk/foundation-models");
64
- const { FoundationModelsLanguageModelStrategy } = await import("./foundation-models-language-model-strategy-OPGTN6DA.js");
68
+ const { FoundationModelsLanguageModelStrategy } = await import("./foundation-models-language-model-strategy-WDSQWU64.js");
65
69
  return new FoundationModelsLanguageModelStrategy(AzureOpenAiChatClient);
66
70
  }
67
71
  const { OrchestrationClient: OrchestrationClient2 } = await import("@sap-ai-sdk/orchestration");
68
- const { OrchestrationLanguageModelStrategy } = await import("./orchestration-language-model-strategy-KFW3CFRY.js");
72
+ const { OrchestrationLanguageModelStrategy } = await import("./orchestration-language-model-strategy-4TKRZK7U.js");
69
73
  return new OrchestrationLanguageModelStrategy(OrchestrationClient2);
70
74
  }
71
75
 
72
- // src/sap-ai-validation.ts
73
- function validateEscapeTemplatePlaceholders(api, escapeTemplatePlaceholders) {
74
- if (api === "foundation-models" && escapeTemplatePlaceholders === true) {
75
- throw new UnsupportedFeatureError(
76
- ESCAPE_TEMPLATE_PLACEHOLDERS_DESCRIPTION,
77
- "foundation-models",
78
- "orchestration"
79
- );
80
- }
81
- }
82
- function validateFoundationModelsOnlyOptions(settings) {
83
- if (!settings) return;
84
- const fmSettings = settings;
85
- for (const feature of FOUNDATION_MODELS_ONLY_FEATURE_KEYS) {
86
- if (fmSettings[feature] !== void 0) {
87
- throw new UnsupportedFeatureError(
88
- FOUNDATION_MODELS_ONLY_FEATURES[feature],
89
- "orchestration",
90
- "foundation-models"
91
- );
92
- }
93
- }
94
- }
95
- function validateOrchestrationOnlyEmbeddingOptions(settings) {
96
- if (!settings) return;
97
- for (const feature of ORCHESTRATION_ONLY_EMBEDDING_FEATURE_KEYS) {
98
- if (settings[feature] !== void 0) {
99
- throw new UnsupportedFeatureError(
100
- ORCHESTRATION_ONLY_EMBEDDING_FEATURES[feature],
101
- "foundation-models",
102
- "orchestration"
103
- );
104
- }
105
- }
106
- }
107
- function validateOrchestrationOnlyOptions(settings) {
108
- if (!settings) return;
109
- const orchSettings = settings;
110
- for (const feature of ORCHESTRATION_ONLY_FEATURE_KEYS) {
111
- if (orchSettings[feature] !== void 0) {
112
- throw new UnsupportedFeatureError(
113
- ORCHESTRATION_ONLY_FEATURES[feature],
114
- "foundation-models",
115
- "orchestration"
116
- );
117
- }
118
- }
119
- }
120
- var ORCHESTRATION_ONLY_FEATURE_KEYS = [
121
- "filtering",
122
- "grounding",
123
- "masking",
124
- "orchestrationConfigRef",
125
- "placeholderValues",
126
- "promptTemplateRef",
127
- "streamOptions",
128
- "tools",
129
- "translation"
130
- ];
131
- var ORCHESTRATION_ONLY_FEATURES = {
132
- filtering: "Content filtering",
133
- grounding: "Document grounding",
134
- masking: "Data masking",
135
- orchestrationConfigRef: "Orchestration config reference (orchestrationConfigRef)",
136
- placeholderValues: "Placeholder values (placeholderValues)",
137
- promptTemplateRef: "Prompt template reference (promptTemplateRef)",
138
- streamOptions: "Stream options for post-LLM modules",
139
- tools: "SAP-format tool definitions (use AI SDK tools instead)",
140
- translation: "Translation"
141
- };
142
- var FOUNDATION_MODELS_ONLY_FEATURE_KEYS = ["dataSources"];
143
- var FOUNDATION_MODELS_ONLY_FEATURES = {
144
- dataSources: "Azure On Your Data (dataSources)"
145
- };
146
- var ORCHESTRATION_ONLY_INVOCATION_FEATURE_KEYS = [
147
- "orchestrationConfigRef",
148
- "placeholderValues",
149
- "promptTemplateRef"
150
- ];
151
- var ORCHESTRATION_ONLY_EMBEDDING_FEATURE_KEYS = ["masking"];
152
- var ORCHESTRATION_ONLY_EMBEDDING_FEATURES = {
153
- masking: ORCHESTRATION_ONLY_FEATURES.masking
154
- };
155
- var ESCAPE_TEMPLATE_PLACEHOLDERS_DESCRIPTION = "escapeTemplatePlaceholders (Jinja2 template escaping)";
156
- function validateApiSwitch(fromApi, toApi, modelSettings) {
157
- if (fromApi === toApi) return;
158
- if (!modelSettings) return;
159
- if (fromApi === "orchestration" && toApi === "foundation-models") {
160
- const orchSettings = modelSettings;
161
- for (const feature of ORCHESTRATION_ONLY_FEATURE_KEYS) {
162
- if (orchSettings[feature] !== void 0) {
163
- throw new ApiSwitchError(fromApi, toApi, feature);
164
- }
165
- }
166
- }
167
- if (fromApi === "foundation-models" && toApi === "orchestration") {
168
- const fmSettings = modelSettings;
169
- for (const feature of FOUNDATION_MODELS_ONLY_FEATURE_KEYS) {
170
- if (fmSettings[feature] !== void 0) {
171
- throw new ApiSwitchError(fromApi, toApi, feature);
172
- }
173
- }
174
- }
175
- }
176
- var VALID_API_TYPES = ["orchestration", "foundation-models"];
177
- function mergeSettingsWithApi(defaultSettings, callSettings, fallbackApi) {
178
- return {
179
- ...deepMerge(defaultSettings, callSettings),
180
- api: callSettings.api ?? defaultSettings?.api ?? fallbackApi
181
- };
182
- }
183
- function resolveApi(providerApi, modelApi, invocationApi) {
184
- return invocationApi ?? modelApi ?? providerApi ?? "orchestration";
185
- }
186
- function validateApiInput(api) {
187
- if (api === void 0) return;
188
- if (typeof api !== "string" || !VALID_API_TYPES.includes(api)) {
189
- throw new Error(
190
- `Invalid API type: ${JSON.stringify(api)}. Valid values are: ${VALID_API_TYPES.map((t) => `"${t}"`).join(", ")}`
191
- );
192
- }
193
- }
194
- function validateSettings(options) {
195
- const { api, embeddingSettings, invocationSettings, modelApi, modelSettings } = options;
196
- validateApiInput(api);
197
- if (invocationSettings?.api !== void 0) {
198
- validateApiInput(invocationSettings.api);
199
- }
200
- if (invocationSettings?.api !== void 0) {
201
- const effectiveModelApi = modelApi ?? "orchestration";
202
- if (effectiveModelApi !== invocationSettings.api) {
203
- validateApiSwitch(effectiveModelApi, invocationSettings.api, modelSettings);
204
- }
205
- }
206
- if (api === "foundation-models") {
207
- validateOrchestrationOnlyOptions(modelSettings);
208
- validateOrchestrationOnlyInvocationOptions(invocationSettings);
209
- validateOrchestrationOnlyEmbeddingOptions(embeddingSettings);
210
- } else {
211
- validateFoundationModelsOnlyOptions(modelSettings);
212
- }
213
- const modelEscape = modelSettings?.escapeTemplatePlaceholders;
214
- const invocationEscape = invocationSettings?.escapeTemplatePlaceholders;
215
- const effectiveEscape = invocationEscape ?? modelEscape;
216
- validateEscapeTemplatePlaceholders(api, effectiveEscape);
217
- }
218
- function validateOrchestrationOnlyInvocationOptions(invocationSettings) {
219
- if (!invocationSettings) return;
220
- for (const feature of ORCHESTRATION_ONLY_INVOCATION_FEATURE_KEYS) {
221
- if (invocationSettings[feature] !== void 0) {
222
- throw new UnsupportedFeatureError(
223
- ORCHESTRATION_ONLY_FEATURES[feature],
224
- "foundation-models",
225
- "orchestration"
226
- );
227
- }
228
- }
229
- }
230
-
231
76
  // src/sap-ai-embedding-model.ts
232
77
  var DEFAULT_MAX_EMBEDDINGS_PER_CALL = 2048;
233
78
  var SAPAIEmbeddingModel = class {
@@ -284,12 +129,6 @@ import { parseProviderOptions as parseProviderOptions2 } from "@ai-sdk/provider-
284
129
  var SAPAILanguageModel = class {
285
130
  modelId;
286
131
  specificationVersion = "v3";
287
- supportsImageUrls = true;
288
- supportsMultipleCompletions = true;
289
- supportsParallelToolCalls = true;
290
- supportsStreaming = true;
291
- supportsStructuredOutputs = true;
292
- supportsToolCalls = true;
293
132
  get provider() {
294
133
  return this.config.provider;
295
134
  }