@jerome-benoit/sap-ai-provider-v2 5.0.0 → 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.
Files changed (31) hide show
  1. package/README.md +51 -16
  2. package/dist/{chunk-BIBSYTMU.js → chunk-2KOXKYVT.js} +5 -7
  3. package/dist/{chunk-BIBSYTMU.js.map → chunk-2KOXKYVT.js.map} +1 -1
  4. package/dist/{chunk-WNR7DC4V.js → chunk-643USI3B.js} +7 -7
  5. package/dist/{chunk-WNR7DC4V.js.map → chunk-643USI3B.js.map} +1 -1
  6. package/dist/{chunk-Q5JV4I6D.js → chunk-AFZC2DH2.js} +2 -2
  7. package/dist/chunk-AFZC2DH2.js.map +1 -0
  8. package/dist/{chunk-FY2HO62O.js → chunk-JRUSQTKB.js} +3 -3
  9. package/dist/{chunk-QDUZRLMI.js → chunk-MF3VO3ER.js} +1 -1
  10. package/dist/chunk-MF3VO3ER.js.map +1 -0
  11. package/dist/{chunk-TXZZURBA.js → chunk-U23M3VYO.js} +2 -2
  12. package/dist/{foundation-models-embedding-model-strategy-JJBN3TQI.js → foundation-models-embedding-model-strategy-2GUADNXT.js} +4 -4
  13. package/dist/{foundation-models-language-model-strategy-6ELKE34K.js → foundation-models-language-model-strategy-5AYZ5KHA.js} +5 -5
  14. package/dist/index.cjs +11 -12
  15. package/dist/index.cjs.map +1 -1
  16. package/dist/index.d.cts +46 -26
  17. package/dist/index.d.ts +46 -26
  18. package/dist/index.js +7 -7
  19. package/dist/index.js.map +1 -1
  20. package/dist/{orchestration-embedding-model-strategy-QI72OB3E.js → orchestration-embedding-model-strategy-F7WHDLX7.js} +5 -5
  21. package/dist/{orchestration-language-model-strategy-X4FZNLSA.js → orchestration-language-model-strategy-Z72AFW62.js} +10 -9
  22. package/dist/orchestration-language-model-strategy-Z72AFW62.js.map +1 -0
  23. package/package.json +1 -1
  24. package/dist/chunk-Q5JV4I6D.js.map +0 -1
  25. package/dist/chunk-QDUZRLMI.js.map +0 -1
  26. package/dist/orchestration-language-model-strategy-X4FZNLSA.js.map +0 -1
  27. /package/dist/{chunk-FY2HO62O.js.map → chunk-JRUSQTKB.js.map} +0 -0
  28. /package/dist/{chunk-TXZZURBA.js.map → chunk-U23M3VYO.js.map} +0 -0
  29. /package/dist/{foundation-models-embedding-model-strategy-JJBN3TQI.js.map → foundation-models-embedding-model-strategy-2GUADNXT.js.map} +0 -0
  30. /package/dist/{foundation-models-language-model-strategy-6ELKE34K.js.map → foundation-models-language-model-strategy-5AYZ5KHA.js.map} +0 -0
  31. /package/dist/{orchestration-embedding-model-strategy-QI72OB3E.js.map → orchestration-embedding-model-strategy-F7WHDLX7.js.map} +0 -0
package/dist/index.d.cts CHANGED
@@ -15,7 +15,7 @@ declare const SAP_AI_PROVIDER_NAME: "sap-ai";
15
15
  /**
16
16
  * Extracts the provider name from a provider identifier (e.g., "sap-ai.chat" → "sap-ai").
17
17
  * @param providerIdentifier - The full provider identifier string.
18
- * @returns The provider name without any suffix.
18
+ * @returns The prefix before the first dot, or the unchanged identifier when no dot exists.
19
19
  */
20
20
  declare function getProviderName(providerIdentifier: string): string;
21
21
  /** @internal */
@@ -1682,8 +1682,8 @@ type AzureOpenAiChatExtensionConfiguration = NonNullable<AzureOpenAiChatCompleti
1682
1682
  /**
1683
1683
  * Common model parameters shared between both APIs.
1684
1684
  *
1685
- * These parameters control text generation behavior and are validated by Zod schemas
1686
- * when passed via `providerOptions`.
1685
+ * Known parameters are validated by Zod in constructor settings and per-call
1686
+ * `modelParams` provider options; additional model-specific keys are passed through.
1687
1687
  */
1688
1688
  interface CommonModelParams {
1689
1689
  /**
@@ -1698,7 +1698,7 @@ interface CommonModelParams {
1698
1698
  readonly maxTokens?: number;
1699
1699
  /**
1700
1700
  * Number of completions to generate.
1701
- * Not supported by Amazon/Anthropic models.
1701
+ * Availability depends on the selected SAP API and model; no model-family filtering is applied.
1702
1702
  * Range: Positive integer
1703
1703
  */
1704
1704
  readonly n?: number;
@@ -1749,7 +1749,10 @@ interface FoundationModelsModelSettings {
1749
1749
  readonly api: "foundation-models";
1750
1750
  /** Azure OpenAI "On Your Data" configuration for RAG scenarios. */
1751
1751
  readonly dataSources?: AzureOpenAiChatExtensionConfiguration[];
1752
- /** @default false */
1752
+ /**
1753
+ * Forward assistant reasoning from the input history as text; does not enable reasoning output.
1754
+ * @default false
1755
+ */
1753
1756
  readonly includeReasoning?: boolean;
1754
1757
  readonly modelParams?: FoundationModelsModelParams;
1755
1758
  readonly modelVersion?: string;
@@ -1769,7 +1772,7 @@ interface OrchestrationModelSettings {
1769
1772
  readonly escapeTemplatePlaceholders?: boolean;
1770
1773
  /**
1771
1774
  * Additional module configurations for prompt module fallback.
1772
- * The SDK tries the primary configuration first, then each fallback in order until one succeeds.
1775
+ * These entries follow the primary configuration in the list passed to the SAP SDK.
1773
1776
  * Each entry is a full `OrchestrationModuleConfig` with its own model, prompt, and modules.
1774
1777
  * @example
1775
1778
  * ```ts
@@ -1786,7 +1789,10 @@ interface OrchestrationModelSettings {
1786
1789
  readonly fallbackModuleConfigs?: OrchestrationModuleConfig[];
1787
1790
  readonly filtering?: FilteringModule;
1788
1791
  readonly grounding?: GroundingModule;
1789
- /** @default false */
1792
+ /**
1793
+ * Forward assistant reasoning from the input history as text; does not enable reasoning output.
1794
+ * @default false
1795
+ */
1790
1796
  readonly includeReasoning?: boolean;
1791
1797
  readonly masking?: MaskingModule | {
1792
1798
  providers: MaskingModule["masking_providers"];
@@ -1797,7 +1803,8 @@ interface OrchestrationModelSettings {
1797
1803
  * Reference to a complete orchestration configuration stored in SAP AI Core Prompt Registry.
1798
1804
  * When provided, local module settings (filtering, masking, grounding, translation, tools,
1799
1805
  * promptTemplateRef, responseFormat) are ignored as the full configuration is managed
1800
- * by the referenced config. Only `placeholderValues` and messages are passed through.
1806
+ * by the referenced config. The reference, including its explicit `overrideConfig`,
1807
+ * is passed to the SAP SDK; messages and `placeholderValues` remain request inputs.
1801
1808
  * @example { id: "f47ac10b-58cc-4372-a567-0e02b2c3d479" }
1802
1809
  * @example { scenario: "customer-support", name: "prod-config", version: "1.0.0" }
1803
1810
  */
@@ -1806,8 +1813,8 @@ interface OrchestrationModelSettings {
1806
1813
  readonly promptTemplateRef?: PromptTemplateRef;
1807
1814
  readonly responseFormat?: ResponseFormat;
1808
1815
  /**
1809
- * Options for streaming behavior with post-LLM modules.
1810
- * Only applies when using `streamText()` with orchestration modules.
1816
+ * Options for streaming behavior with locally configured post-LLM modules.
1817
+ * Includes direct `doStream()` calls; ignored when `orchestrationConfigRef` is used.
1811
1818
  */
1812
1819
  readonly streamOptions?: OrchestrationStreamOptions;
1813
1820
  readonly tools?: ChatCompletionTool[];
@@ -1816,6 +1823,8 @@ interface OrchestrationModelSettings {
1816
1823
  /**
1817
1824
  * Stream options for orchestration post-LLM module processing.
1818
1825
  * Controls chunking behavior for translation, filtering, and other modules during streaming.
1826
+ * Ignored with `orchestrationConfigRef`; configure streaming in the stored
1827
+ * configuration or its `overrideConfig` instead.
1819
1828
  */
1820
1829
  interface OrchestrationStreamOptions {
1821
1830
  /**
@@ -1825,7 +1834,7 @@ interface OrchestrationStreamOptions {
1825
1834
  readonly chunkSize?: number;
1826
1835
  /**
1827
1836
  * Delimiters for splitting stream into chunks (e.g., sentence boundaries).
1828
- * Required when translation module is configured.
1837
+ * Recommended for translation; the provider warns when local translation settings lack them.
1829
1838
  * @example ["\n", ".", "?", "!"]
1830
1839
  */
1831
1840
  readonly delimiters?: readonly string[];
@@ -1874,7 +1883,10 @@ interface SAPAIEmbeddingSettings {
1874
1883
  readonly modelParams?: FoundationModelsEmbeddingParams | Record<string, unknown>;
1875
1884
  readonly modelVersion?: string;
1876
1885
  readonly [key: string]: unknown;
1877
- /** @default 'text' */
1886
+ /**
1887
+ * Orchestration embedding input type; ignored by Foundation Models.
1888
+ * @default 'text'
1889
+ */
1878
1890
  readonly type?: "document" | "query" | "text";
1879
1891
  }
1880
1892
  /**
@@ -1908,7 +1920,10 @@ interface SAPAISettings {
1908
1920
  readonly filtering?: FilteringModule;
1909
1921
  /** Orchestration API only. */
1910
1922
  readonly grounding?: GroundingModule;
1911
- /** @default false */
1923
+ /**
1924
+ * Forward assistant reasoning from the input history as text; does not enable reasoning output.
1925
+ * @default false
1926
+ */
1912
1927
  readonly includeReasoning?: boolean;
1913
1928
  /** Orchestration API only. */
1914
1929
  readonly masking?: MaskingModule | {
@@ -1923,7 +1938,7 @@ interface SAPAISettings {
1923
1938
  /** Orchestration API only. */
1924
1939
  readonly promptTemplateRef?: PromptTemplateRef;
1925
1940
  readonly responseFormat?: ResponseFormat;
1926
- /** Orchestration API only. */
1941
+ /** Orchestration API only; ignored when `orchestrationConfigRef` is used. */
1927
1942
  readonly streamOptions?: OrchestrationStreamOptions;
1928
1943
  /** Orchestration API only. */
1929
1944
  readonly tools?: ChatCompletionTool[];
@@ -2068,7 +2083,7 @@ declare class ApiSwitchError extends Error {
2068
2083
  * @example
2069
2084
  * ```typescript
2070
2085
  * throw new UnsupportedFeatureError("Content filtering", "foundation-models", "orchestration");
2071
- * // "Content filtering is only available with Orchestration API and will be ignored by Foundation Models API."
2086
+ * // Rejects the request: content filtering requires the Orchestration API.
2072
2087
  * ```
2073
2088
  * @see {@link validateSettings} - Main validation function that throws this error
2074
2089
  * @see {@link ApiSwitchError} - Related error for API switching conflicts
@@ -2080,7 +2095,7 @@ declare class UnsupportedFeatureError extends Error {
2080
2095
  /**
2081
2096
  * Creates a new UnsupportedFeatureError.
2082
2097
  * @param feature - The name of the unsupported feature (e.g., "Content filtering").
2083
- * @param api - The API being used where the feature will be ignored.
2098
+ * @param api - The API being used that does not support the feature.
2084
2099
  * @param suggestedApi - The API that supports this feature.
2085
2100
  */
2086
2101
  constructor(feature: string, api: SAPAIApiType, suggestedApi: SAPAIApiType);
@@ -2223,14 +2238,15 @@ type DeploymentConfig = DeploymentIdConfig | ResourceGroupConfig;
2223
2238
  */
2224
2239
  interface SAPAIProviderSettings {
2225
2240
  /**
2226
- * SAP AI Core API to use for all models created by this provider.
2227
- * Can be overridden at model creation time or per-call via providerOptions.
2241
+ * Default SAP AI Core API for models created by this provider.
2242
+ * `defaultSettings.api`, per-model `api`, and per-call `providerOptions` take precedence.
2243
+ * This option does not enable automatic failover between APIs.
2228
2244
  * - `'orchestration'` (default): SAP AI Core Orchestration API - supports filtering, grounding, masking, translation
2229
2245
  * - `'foundation-models'`: SAP AI Core Foundation Models API - supports dataSources, logprobs, seed, etc.
2230
2246
  * @default 'orchestration'
2231
2247
  */
2232
2248
  readonly api?: SAPAIApiType;
2233
- /** Default model settings applied to every model instance. Per-call settings override these. */
2249
+ /** Default model settings; settings supplied at model creation override these. */
2234
2250
  readonly defaultSettings?: SAPAISettings;
2235
2251
  /** SAP AI Core deployment ID. If not provided, the SDK resolves deployment automatically. */
2236
2252
  readonly deploymentId?: string;
@@ -2238,13 +2254,16 @@ interface SAPAIProviderSettings {
2238
2254
  readonly destination?: HttpDestinationOrFetchOptions;
2239
2255
  /**
2240
2256
  * Log level for SAP Cloud SDK loggers.
2241
- * Controls verbosity of internal SAP SDK logging (e.g., authentication, service binding).
2257
+ * Controls process-wide SAP SDK logging (e.g., authentication, service binding).
2258
+ * Creating another provider resets this level, using warn when logLevel is omitted.
2242
2259
  * Note: SAP_CLOUD_SDK_LOG_LEVEL environment variable takes precedence if set.
2243
2260
  * @default 'warn'
2244
2261
  */
2245
2262
  readonly logLevel?: "debug" | "error" | "info" | "warn";
2246
2263
  /**
2247
- * Provider name used as key for `providerOptions` and `providerMetadata`.
2264
+ * Name used in model provider identifiers. Call-level `providerOptions` and
2265
+ * `providerMetadata` keys use the prefix before the first dot; avoid dots in names.
2266
+ * Per-part prompt-cache directives always use the fixed `sap-ai` key.
2248
2267
  * @default 'sap-ai'
2249
2268
  */
2250
2269
  readonly name?: string;
@@ -2254,8 +2273,9 @@ interface SAPAIProviderSettings {
2254
2273
  *
2255
2274
  * Provider-level only (not overridable per-call via `providerOptions['sap-ai']`). The
2256
2275
  * AI SDK `abortSignal` option always wins over any `signal` on `requestConfig`; the
2257
- * latter is dropped before the request is forwarded. Node-only knobs (`httpAgent`,
2258
- * `httpsAgent`) are silently ignored on Edge / Cloudflare Workers runtimes.
2276
+ * latter is dropped before the request is forwarded. Other options, including
2277
+ * Node-only agents (`httpAgent`, `httpsAgent`), are forwarded unchanged. The
2278
+ * published package and SAP SDK transport require a Node-compatible runtime.
2259
2279
  *
2260
2280
  * See the "Note on `requestConfig`" section under `SAPAIProviderSettings` in
2261
2281
  * `API_REFERENCE.md` for the full SAP AI Core `AI-*` header guidance.
@@ -2290,12 +2310,12 @@ interface SAPAIProviderV2 extends ProviderV2 {
2290
2310
  * @param options - Provider configuration options.
2291
2311
  * @param options.api - Default API type: `'orchestration'` (default) or `'foundation-models'`.
2292
2312
  * @param options.defaultSettings - Default model settings applied to every model instance.
2293
- * @param options.deploymentId - SAP AI Core deployment ID for automatic deployment resolution.
2313
+ * @param options.deploymentId - Explicit SAP AI Core deployment ID; omit for automatic deployment resolution.
2294
2314
  * @param options.destination - Custom SAP Cloud SDK destination configuration.
2295
2315
  * @param options.logLevel - Log level for SAP Cloud SDK loggers (`'debug'`, `'info'`, `'warn'`, `'error'`).
2296
- * @param options.name - Provider name used as key in `providerOptions` (default: `'sap-ai'`).
2316
+ * @param options.name - Provider name (default: `'sap-ai'`); see {@link SAPAIProviderSettings.name} for namespace rules.
2297
2317
  * @param options.requestConfig - Provider-level custom request configuration. See {@link SAPAIProviderSettings.requestConfig} for scope, portability, and abort semantics.
2298
- * @param options.resourceGroup - SAP AI Core resource group (default: `'default'`).
2318
+ * @param options.resourceGroup - SAP AI Core resource group (default: `'default'`); ignored when deploymentId is set.
2299
2319
  * @param options.warnOnAmbiguousConfig - Whether to warn when both deploymentId and resourceGroup are set.
2300
2320
  * @returns A configured SAP AI provider instance that can be used as a callable or via methods.
2301
2321
  * @example
package/dist/index.d.ts CHANGED
@@ -15,7 +15,7 @@ declare const SAP_AI_PROVIDER_NAME: "sap-ai";
15
15
  /**
16
16
  * Extracts the provider name from a provider identifier (e.g., "sap-ai.chat" → "sap-ai").
17
17
  * @param providerIdentifier - The full provider identifier string.
18
- * @returns The provider name without any suffix.
18
+ * @returns The prefix before the first dot, or the unchanged identifier when no dot exists.
19
19
  */
20
20
  declare function getProviderName(providerIdentifier: string): string;
21
21
  /** @internal */
@@ -1682,8 +1682,8 @@ type AzureOpenAiChatExtensionConfiguration = NonNullable<AzureOpenAiChatCompleti
1682
1682
  /**
1683
1683
  * Common model parameters shared between both APIs.
1684
1684
  *
1685
- * These parameters control text generation behavior and are validated by Zod schemas
1686
- * when passed via `providerOptions`.
1685
+ * Known parameters are validated by Zod in constructor settings and per-call
1686
+ * `modelParams` provider options; additional model-specific keys are passed through.
1687
1687
  */
1688
1688
  interface CommonModelParams {
1689
1689
  /**
@@ -1698,7 +1698,7 @@ interface CommonModelParams {
1698
1698
  readonly maxTokens?: number;
1699
1699
  /**
1700
1700
  * Number of completions to generate.
1701
- * Not supported by Amazon/Anthropic models.
1701
+ * Availability depends on the selected SAP API and model; no model-family filtering is applied.
1702
1702
  * Range: Positive integer
1703
1703
  */
1704
1704
  readonly n?: number;
@@ -1749,7 +1749,10 @@ interface FoundationModelsModelSettings {
1749
1749
  readonly api: "foundation-models";
1750
1750
  /** Azure OpenAI "On Your Data" configuration for RAG scenarios. */
1751
1751
  readonly dataSources?: AzureOpenAiChatExtensionConfiguration[];
1752
- /** @default false */
1752
+ /**
1753
+ * Forward assistant reasoning from the input history as text; does not enable reasoning output.
1754
+ * @default false
1755
+ */
1753
1756
  readonly includeReasoning?: boolean;
1754
1757
  readonly modelParams?: FoundationModelsModelParams;
1755
1758
  readonly modelVersion?: string;
@@ -1769,7 +1772,7 @@ interface OrchestrationModelSettings {
1769
1772
  readonly escapeTemplatePlaceholders?: boolean;
1770
1773
  /**
1771
1774
  * Additional module configurations for prompt module fallback.
1772
- * The SDK tries the primary configuration first, then each fallback in order until one succeeds.
1775
+ * These entries follow the primary configuration in the list passed to the SAP SDK.
1773
1776
  * Each entry is a full `OrchestrationModuleConfig` with its own model, prompt, and modules.
1774
1777
  * @example
1775
1778
  * ```ts
@@ -1786,7 +1789,10 @@ interface OrchestrationModelSettings {
1786
1789
  readonly fallbackModuleConfigs?: OrchestrationModuleConfig[];
1787
1790
  readonly filtering?: FilteringModule;
1788
1791
  readonly grounding?: GroundingModule;
1789
- /** @default false */
1792
+ /**
1793
+ * Forward assistant reasoning from the input history as text; does not enable reasoning output.
1794
+ * @default false
1795
+ */
1790
1796
  readonly includeReasoning?: boolean;
1791
1797
  readonly masking?: MaskingModule | {
1792
1798
  providers: MaskingModule["masking_providers"];
@@ -1797,7 +1803,8 @@ interface OrchestrationModelSettings {
1797
1803
  * Reference to a complete orchestration configuration stored in SAP AI Core Prompt Registry.
1798
1804
  * When provided, local module settings (filtering, masking, grounding, translation, tools,
1799
1805
  * promptTemplateRef, responseFormat) are ignored as the full configuration is managed
1800
- * by the referenced config. Only `placeholderValues` and messages are passed through.
1806
+ * by the referenced config. The reference, including its explicit `overrideConfig`,
1807
+ * is passed to the SAP SDK; messages and `placeholderValues` remain request inputs.
1801
1808
  * @example { id: "f47ac10b-58cc-4372-a567-0e02b2c3d479" }
1802
1809
  * @example { scenario: "customer-support", name: "prod-config", version: "1.0.0" }
1803
1810
  */
@@ -1806,8 +1813,8 @@ interface OrchestrationModelSettings {
1806
1813
  readonly promptTemplateRef?: PromptTemplateRef;
1807
1814
  readonly responseFormat?: ResponseFormat;
1808
1815
  /**
1809
- * Options for streaming behavior with post-LLM modules.
1810
- * Only applies when using `streamText()` with orchestration modules.
1816
+ * Options for streaming behavior with locally configured post-LLM modules.
1817
+ * Includes direct `doStream()` calls; ignored when `orchestrationConfigRef` is used.
1811
1818
  */
1812
1819
  readonly streamOptions?: OrchestrationStreamOptions;
1813
1820
  readonly tools?: ChatCompletionTool[];
@@ -1816,6 +1823,8 @@ interface OrchestrationModelSettings {
1816
1823
  /**
1817
1824
  * Stream options for orchestration post-LLM module processing.
1818
1825
  * Controls chunking behavior for translation, filtering, and other modules during streaming.
1826
+ * Ignored with `orchestrationConfigRef`; configure streaming in the stored
1827
+ * configuration or its `overrideConfig` instead.
1819
1828
  */
1820
1829
  interface OrchestrationStreamOptions {
1821
1830
  /**
@@ -1825,7 +1834,7 @@ interface OrchestrationStreamOptions {
1825
1834
  readonly chunkSize?: number;
1826
1835
  /**
1827
1836
  * Delimiters for splitting stream into chunks (e.g., sentence boundaries).
1828
- * Required when translation module is configured.
1837
+ * Recommended for translation; the provider warns when local translation settings lack them.
1829
1838
  * @example ["\n", ".", "?", "!"]
1830
1839
  */
1831
1840
  readonly delimiters?: readonly string[];
@@ -1874,7 +1883,10 @@ interface SAPAIEmbeddingSettings {
1874
1883
  readonly modelParams?: FoundationModelsEmbeddingParams | Record<string, unknown>;
1875
1884
  readonly modelVersion?: string;
1876
1885
  readonly [key: string]: unknown;
1877
- /** @default 'text' */
1886
+ /**
1887
+ * Orchestration embedding input type; ignored by Foundation Models.
1888
+ * @default 'text'
1889
+ */
1878
1890
  readonly type?: "document" | "query" | "text";
1879
1891
  }
1880
1892
  /**
@@ -1908,7 +1920,10 @@ interface SAPAISettings {
1908
1920
  readonly filtering?: FilteringModule;
1909
1921
  /** Orchestration API only. */
1910
1922
  readonly grounding?: GroundingModule;
1911
- /** @default false */
1923
+ /**
1924
+ * Forward assistant reasoning from the input history as text; does not enable reasoning output.
1925
+ * @default false
1926
+ */
1912
1927
  readonly includeReasoning?: boolean;
1913
1928
  /** Orchestration API only. */
1914
1929
  readonly masking?: MaskingModule | {
@@ -1923,7 +1938,7 @@ interface SAPAISettings {
1923
1938
  /** Orchestration API only. */
1924
1939
  readonly promptTemplateRef?: PromptTemplateRef;
1925
1940
  readonly responseFormat?: ResponseFormat;
1926
- /** Orchestration API only. */
1941
+ /** Orchestration API only; ignored when `orchestrationConfigRef` is used. */
1927
1942
  readonly streamOptions?: OrchestrationStreamOptions;
1928
1943
  /** Orchestration API only. */
1929
1944
  readonly tools?: ChatCompletionTool[];
@@ -2068,7 +2083,7 @@ declare class ApiSwitchError extends Error {
2068
2083
  * @example
2069
2084
  * ```typescript
2070
2085
  * throw new UnsupportedFeatureError("Content filtering", "foundation-models", "orchestration");
2071
- * // "Content filtering is only available with Orchestration API and will be ignored by Foundation Models API."
2086
+ * // Rejects the request: content filtering requires the Orchestration API.
2072
2087
  * ```
2073
2088
  * @see {@link validateSettings} - Main validation function that throws this error
2074
2089
  * @see {@link ApiSwitchError} - Related error for API switching conflicts
@@ -2080,7 +2095,7 @@ declare class UnsupportedFeatureError extends Error {
2080
2095
  /**
2081
2096
  * Creates a new UnsupportedFeatureError.
2082
2097
  * @param feature - The name of the unsupported feature (e.g., "Content filtering").
2083
- * @param api - The API being used where the feature will be ignored.
2098
+ * @param api - The API being used that does not support the feature.
2084
2099
  * @param suggestedApi - The API that supports this feature.
2085
2100
  */
2086
2101
  constructor(feature: string, api: SAPAIApiType, suggestedApi: SAPAIApiType);
@@ -2223,14 +2238,15 @@ type DeploymentConfig = DeploymentIdConfig | ResourceGroupConfig;
2223
2238
  */
2224
2239
  interface SAPAIProviderSettings {
2225
2240
  /**
2226
- * SAP AI Core API to use for all models created by this provider.
2227
- * Can be overridden at model creation time or per-call via providerOptions.
2241
+ * Default SAP AI Core API for models created by this provider.
2242
+ * `defaultSettings.api`, per-model `api`, and per-call `providerOptions` take precedence.
2243
+ * This option does not enable automatic failover between APIs.
2228
2244
  * - `'orchestration'` (default): SAP AI Core Orchestration API - supports filtering, grounding, masking, translation
2229
2245
  * - `'foundation-models'`: SAP AI Core Foundation Models API - supports dataSources, logprobs, seed, etc.
2230
2246
  * @default 'orchestration'
2231
2247
  */
2232
2248
  readonly api?: SAPAIApiType;
2233
- /** Default model settings applied to every model instance. Per-call settings override these. */
2249
+ /** Default model settings; settings supplied at model creation override these. */
2234
2250
  readonly defaultSettings?: SAPAISettings;
2235
2251
  /** SAP AI Core deployment ID. If not provided, the SDK resolves deployment automatically. */
2236
2252
  readonly deploymentId?: string;
@@ -2238,13 +2254,16 @@ interface SAPAIProviderSettings {
2238
2254
  readonly destination?: HttpDestinationOrFetchOptions;
2239
2255
  /**
2240
2256
  * Log level for SAP Cloud SDK loggers.
2241
- * Controls verbosity of internal SAP SDK logging (e.g., authentication, service binding).
2257
+ * Controls process-wide SAP SDK logging (e.g., authentication, service binding).
2258
+ * Creating another provider resets this level, using warn when logLevel is omitted.
2242
2259
  * Note: SAP_CLOUD_SDK_LOG_LEVEL environment variable takes precedence if set.
2243
2260
  * @default 'warn'
2244
2261
  */
2245
2262
  readonly logLevel?: "debug" | "error" | "info" | "warn";
2246
2263
  /**
2247
- * Provider name used as key for `providerOptions` and `providerMetadata`.
2264
+ * Name used in model provider identifiers. Call-level `providerOptions` and
2265
+ * `providerMetadata` keys use the prefix before the first dot; avoid dots in names.
2266
+ * Per-part prompt-cache directives always use the fixed `sap-ai` key.
2248
2267
  * @default 'sap-ai'
2249
2268
  */
2250
2269
  readonly name?: string;
@@ -2254,8 +2273,9 @@ interface SAPAIProviderSettings {
2254
2273
  *
2255
2274
  * Provider-level only (not overridable per-call via `providerOptions['sap-ai']`). The
2256
2275
  * AI SDK `abortSignal` option always wins over any `signal` on `requestConfig`; the
2257
- * latter is dropped before the request is forwarded. Node-only knobs (`httpAgent`,
2258
- * `httpsAgent`) are silently ignored on Edge / Cloudflare Workers runtimes.
2276
+ * latter is dropped before the request is forwarded. Other options, including
2277
+ * Node-only agents (`httpAgent`, `httpsAgent`), are forwarded unchanged. The
2278
+ * published package and SAP SDK transport require a Node-compatible runtime.
2259
2279
  *
2260
2280
  * See the "Note on `requestConfig`" section under `SAPAIProviderSettings` in
2261
2281
  * `API_REFERENCE.md` for the full SAP AI Core `AI-*` header guidance.
@@ -2290,12 +2310,12 @@ interface SAPAIProviderV2 extends ProviderV2 {
2290
2310
  * @param options - Provider configuration options.
2291
2311
  * @param options.api - Default API type: `'orchestration'` (default) or `'foundation-models'`.
2292
2312
  * @param options.defaultSettings - Default model settings applied to every model instance.
2293
- * @param options.deploymentId - SAP AI Core deployment ID for automatic deployment resolution.
2313
+ * @param options.deploymentId - Explicit SAP AI Core deployment ID; omit for automatic deployment resolution.
2294
2314
  * @param options.destination - Custom SAP Cloud SDK destination configuration.
2295
2315
  * @param options.logLevel - Log level for SAP Cloud SDK loggers (`'debug'`, `'info'`, `'warn'`, `'error'`).
2296
- * @param options.name - Provider name used as key in `providerOptions` (default: `'sap-ai'`).
2316
+ * @param options.name - Provider name (default: `'sap-ai'`); see {@link SAPAIProviderSettings.name} for namespace rules.
2297
2317
  * @param options.requestConfig - Provider-level custom request configuration. See {@link SAPAIProviderSettings.requestConfig} for scope, portability, and abort semantics.
2298
- * @param options.resourceGroup - SAP AI Core resource group (default: `'default'`).
2318
+ * @param options.resourceGroup - SAP AI Core resource group (default: `'default'`); ignored when deploymentId is set.
2299
2319
  * @param options.warnOnAmbiguousConfig - Whether to warn when both deploymentId and resourceGroup are set.
2300
2320
  * @returns A configured SAP AI provider instance that can be used as a callable or via methods.
2301
2321
  * @example
package/dist/index.js CHANGED
@@ -3,11 +3,11 @@ import {
3
3
  mergeSettingsWithApi,
4
4
  resolveApi,
5
5
  validateSettings
6
- } from "./chunk-TXZZURBA.js";
6
+ } from "./chunk-U23M3VYO.js";
7
7
  import {
8
8
  escapeOrchestrationPlaceholders,
9
9
  unescapeOrchestrationPlaceholders
10
- } from "./chunk-QDUZRLMI.js";
10
+ } from "./chunk-MF3VO3ER.js";
11
11
  import {
12
12
  ApiSwitchError,
13
13
  SAP_AI_PROVIDER_NAME,
@@ -20,7 +20,7 @@ import {
20
20
  sapAILanguageModelProviderOptions,
21
21
  validateEmbeddingModelParamsSettings,
22
22
  validateModelParamsSettings
23
- } from "./chunk-BIBSYTMU.js";
23
+ } from "./chunk-2KOXKYVT.js";
24
24
 
25
25
  // src/sap-ai-adapters-v3-to-v2.ts
26
26
  function convertFinishReasonToV2(internalFinishReason) {
@@ -254,21 +254,21 @@ function getOrCreateLanguageModelStrategy(api) {
254
254
  async function createEmbeddingModelStrategy(api) {
255
255
  if (api === "foundation-models") {
256
256
  const { AzureOpenAiEmbeddingClient } = await import("@sap-ai-sdk/foundation-models");
257
- const { FoundationModelsEmbeddingModelStrategy } = await import("./foundation-models-embedding-model-strategy-JJBN3TQI.js");
257
+ const { FoundationModelsEmbeddingModelStrategy } = await import("./foundation-models-embedding-model-strategy-2GUADNXT.js");
258
258
  return new FoundationModelsEmbeddingModelStrategy(AzureOpenAiEmbeddingClient);
259
259
  }
260
260
  const { OrchestrationEmbeddingClient: OrchestrationEmbeddingClient2 } = await import("@sap-ai-sdk/orchestration");
261
- const { OrchestrationEmbeddingModelStrategy } = await import("./orchestration-embedding-model-strategy-QI72OB3E.js");
261
+ const { OrchestrationEmbeddingModelStrategy } = await import("./orchestration-embedding-model-strategy-F7WHDLX7.js");
262
262
  return new OrchestrationEmbeddingModelStrategy(OrchestrationEmbeddingClient2);
263
263
  }
264
264
  async function createLanguageModelStrategy(api) {
265
265
  if (api === "foundation-models") {
266
266
  const { AzureOpenAiChatClient } = await import("@sap-ai-sdk/foundation-models");
267
- const { FoundationModelsLanguageModelStrategy } = await import("./foundation-models-language-model-strategy-6ELKE34K.js");
267
+ const { FoundationModelsLanguageModelStrategy } = await import("./foundation-models-language-model-strategy-5AYZ5KHA.js");
268
268
  return new FoundationModelsLanguageModelStrategy(AzureOpenAiChatClient);
269
269
  }
270
270
  const { OrchestrationClient: OrchestrationClient2 } = await import("@sap-ai-sdk/orchestration");
271
- const { OrchestrationLanguageModelStrategy } = await import("./orchestration-language-model-strategy-X4FZNLSA.js");
271
+ const { OrchestrationLanguageModelStrategy } = await import("./orchestration-language-model-strategy-Z72AFW62.js");
272
272
  return new OrchestrationLanguageModelStrategy(OrchestrationClient2);
273
273
  }
274
274