@jerome-benoit/sap-ai-provider-v2 4.7.1 → 4.9.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.
- package/README.md +5 -0
- package/dist/{chunk-BZWUUBX2.js → chunk-33WLQYKB.js} +8 -2
- package/dist/chunk-33WLQYKB.js.map +1 -0
- package/dist/{chunk-RUCURXS7.js → chunk-3KCERYUB.js} +12 -6
- package/dist/chunk-3KCERYUB.js.map +1 -0
- package/dist/{chunk-XIWHF23D.js → chunk-4PLJVJX4.js} +746 -203
- package/dist/{chunk-XIWHF23D.js.map → chunk-4PLJVJX4.js.map} +1 -1
- package/dist/{chunk-HDOSHLV6.js → chunk-4SQ5HC6Y.js} +2 -2
- package/dist/{chunk-OA6TJHD2.js → chunk-RW6WSPU2.js} +10 -4
- package/dist/chunk-RW6WSPU2.js.map +1 -0
- package/dist/{foundation-models-embedding-model-strategy-TACUPFS2.js → foundation-models-embedding-model-strategy-RVJQSJPU.js} +7 -6
- package/dist/foundation-models-embedding-model-strategy-RVJQSJPU.js.map +1 -0
- package/dist/{foundation-models-language-model-strategy-LLWYUGA3.js → foundation-models-language-model-strategy-UWJ6FHBI.js} +14 -9
- package/dist/foundation-models-language-model-strategy-UWJ6FHBI.js.map +1 -0
- package/dist/index.cjs +795 -222
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +26 -5
- package/dist/index.d.ts +26 -5
- package/dist/index.js +14 -10
- package/dist/index.js.map +1 -1
- package/dist/{orchestration-embedding-model-strategy-RYI3HWRZ.js → orchestration-embedding-model-strategy-OMIXGLHJ.js} +8 -7
- package/dist/orchestration-embedding-model-strategy-OMIXGLHJ.js.map +1 -0
- package/dist/{orchestration-language-model-strategy-NIUPRYDW.js → orchestration-language-model-strategy-UE7OQO5K.js} +16 -10
- package/dist/orchestration-language-model-strategy-UE7OQO5K.js.map +1 -0
- package/package.json +20 -20
- package/dist/chunk-BZWUUBX2.js.map +0 -1
- package/dist/chunk-OA6TJHD2.js.map +0 -1
- package/dist/chunk-RUCURXS7.js.map +0 -1
- package/dist/foundation-models-embedding-model-strategy-TACUPFS2.js.map +0 -1
- package/dist/foundation-models-language-model-strategy-LLWYUGA3.js.map +0 -1
- package/dist/orchestration-embedding-model-strategy-RYI3HWRZ.js.map +0 -1
- package/dist/orchestration-language-model-strategy-NIUPRYDW.js.map +0 -1
- /package/dist/{chunk-HDOSHLV6.js.map → chunk-4SQ5HC6Y.js.map} +0 -0
package/dist/index.d.cts
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import { EmbeddingModelV2, SharedV2ProviderOptions, SharedV2ProviderMetadata, SharedV2Headers, LanguageModelV2, LanguageModelV2CallOptions, LanguageModelV2Content, LanguageModelV2FinishReason, LanguageModelV2ResponseMetadata, LanguageModelV2Usage, LanguageModelV2CallWarning, LanguageModelV2StreamPart, ProviderV2, ImageModelV2 } from '@ai-sdk/provider';
|
|
2
2
|
import { DeploymentIdConfig, ResourceGroupConfig } from '@sap-ai-sdk/ai-api/internal.js';
|
|
3
|
+
import { CustomRequestConfig } from '@sap-ai-sdk/core';
|
|
4
|
+
export { CustomRequestConfig } from '@sap-ai-sdk/core';
|
|
3
5
|
import { HttpDestinationOrFetchOptions } from '@sap-cloud-sdk/connectivity';
|
|
6
|
+
export { HttpDestinationOrFetchOptions } from '@sap-cloud-sdk/connectivity';
|
|
4
7
|
import { AzureOpenAiChatCompletionParameters } from '@sap-ai-sdk/foundation-models';
|
|
5
|
-
import { OrchestrationModuleConfig, FilteringModule, GroundingModule, MaskingModule,
|
|
6
|
-
export { AssistantChatMessage, ChatCompletionRequest, ChatCompletionTool, ChatMessage, ChatMessageContent, ChatMessages, Citation, DeveloperChatMessage, DocumentTranslationApplyToSelector, FileContent, FilteringModule, FunctionObject, GroundingModule, ImageContentUrl, LlmModelDetails, LlmModelParams, MaskingModule, OrchestrationClient, OrchestrationConfigRef, OrchestrationEmbeddingClient, OrchestrationEmbeddingResponse, OrchestrationError, OrchestrationErrorResponse, OrchestrationModuleConfig, OrchestrationModuleConfigList, OrchestrationResponse, OrchestrationStream, OrchestrationStreamChunkResponse, OrchestrationStreamResponse, PromptTemplatingModule, SystemChatMessage, ToolChatMessage, TranslationApplyToCategory, TranslationInputParameters, TranslationModule, TranslationOutputParameters, TranslationTargetLanguage, UserChatMessage, UserChatMessageContent, UserChatMessageContentItem, buildAzureContentSafetyFilter, buildDocumentGroundingConfig, buildDpiMaskingProvider, buildLlamaGuard38BFilter, buildTranslationConfig } from '@sap-ai-sdk/orchestration';
|
|
8
|
+
import { OrchestrationModuleConfig, FilteringModule, GroundingModule, MaskingModule, OrchestrationConfigRefById, OrchestrationConfigRefByName, ChatCompletionTool, TranslationModule, ChatModel } from '@sap-ai-sdk/orchestration';
|
|
9
|
+
export { AssistantChatMessage, ChatCompletionRequest, ChatCompletionTool, ChatMessage, ChatMessageContent, ChatMessages, Citation, DeveloperChatMessage, DocumentTranslationApplyToSelector, FileContent, FilteringModule, FunctionObject, GroundingModule, ImageContentUrl, LlmModelDetails, LlmModelParams, MaskingModule, OrchestrationClient, OrchestrationConfigRef, OrchestrationConfigRefById, OrchestrationConfigRefByName, OrchestrationEmbeddingClient, OrchestrationEmbeddingResponse, OrchestrationError, OrchestrationErrorResponse, OrchestrationModuleConfig, OrchestrationModuleConfigList, OrchestrationResponse, OrchestrationStream, OrchestrationStreamChunkResponse, OrchestrationStreamResponse, PromptTemplatingModule, SystemChatMessage, ToolChatMessage, TranslationApplyToCategory, TranslationInputParameters, TranslationModule, TranslationOutputParameters, TranslationTargetLanguage, UserChatMessage, UserChatMessageContent, UserChatMessageContentItem, buildAzureContentSafetyFilter, buildDocumentGroundingConfig, buildDpiMaskingProvider, buildLlamaGuard38BFilter, buildTranslationConfig } from '@sap-ai-sdk/orchestration';
|
|
7
10
|
import * as _ai_sdk_provider_utils from '@ai-sdk/provider-utils';
|
|
8
11
|
import { InferSchema } from '@ai-sdk/provider-utils';
|
|
9
12
|
|
|
@@ -208,7 +211,7 @@ interface OrchestrationModelSettings {
|
|
|
208
211
|
* @example { id: "f47ac10b-58cc-4372-a567-0e02b2c3d479" }
|
|
209
212
|
* @example { scenario: "customer-support", name: "prod-config", version: "1.0.0" }
|
|
210
213
|
*/
|
|
211
|
-
readonly orchestrationConfigRef?:
|
|
214
|
+
readonly orchestrationConfigRef?: OrchestrationConfigRefById | OrchestrationConfigRefByName;
|
|
212
215
|
readonly placeholderValues?: Record<string, string>;
|
|
213
216
|
readonly promptTemplateRef?: PromptTemplateRef;
|
|
214
217
|
readonly responseFormat?: ResponseFormat;
|
|
@@ -289,7 +292,7 @@ interface SAPAIEmbeddingSettings {
|
|
|
289
292
|
*
|
|
290
293
|
* Model availability depends on tenant configuration and region.
|
|
291
294
|
* Common values include: `'gpt-4.1'`, `'gpt-4.1-mini'`, `'anthropic--claude-4.5-sonnet'`, `'gemini-2.5-pro'`.
|
|
292
|
-
* @see {@link https://help.sap.com/docs/sap-ai-core/sap-ai-core-service-guide/models-and-scenarios-in-generative-ai-hub|SAP AI Core Models}
|
|
295
|
+
* @see {@link https://help.sap.com/docs/sap-ai-core/sap-ai-core-service-guide/models-and-scenarios-in-generative-ai-hub | SAP AI Core Models}
|
|
293
296
|
*/
|
|
294
297
|
type SAPAIModelId = ChatModel;
|
|
295
298
|
/**
|
|
@@ -324,7 +327,7 @@ interface SAPAISettings {
|
|
|
324
327
|
readonly modelParams?: CommonModelParams;
|
|
325
328
|
readonly modelVersion?: string;
|
|
326
329
|
/** Orchestration API only. */
|
|
327
|
-
readonly orchestrationConfigRef?:
|
|
330
|
+
readonly orchestrationConfigRef?: OrchestrationConfigRefById | OrchestrationConfigRefByName;
|
|
328
331
|
/** Orchestration API only. */
|
|
329
332
|
readonly placeholderValues?: Record<string, string>;
|
|
330
333
|
/** Orchestration API only. */
|
|
@@ -353,6 +356,7 @@ interface SAPAIEmbeddingModelV2Config {
|
|
|
353
356
|
readonly destination?: HttpDestinationOrFetchOptions;
|
|
354
357
|
readonly provider: string;
|
|
355
358
|
readonly providerApi?: SAPAIApiType;
|
|
359
|
+
readonly requestConfig?: CustomRequestConfig;
|
|
356
360
|
}
|
|
357
361
|
/**
|
|
358
362
|
* SAP AI Core Embedding Model implementing Vercel AI SDK EmbeddingModelV2.
|
|
@@ -507,6 +511,7 @@ interface SAPAILanguageModelV2Config {
|
|
|
507
511
|
readonly destination?: HttpDestinationOrFetchOptions;
|
|
508
512
|
readonly provider: string;
|
|
509
513
|
readonly providerApi?: SAPAIApiType;
|
|
514
|
+
readonly requestConfig?: CustomRequestConfig;
|
|
510
515
|
}
|
|
511
516
|
/**
|
|
512
517
|
* SAP AI Language Model implementing Vercel AI SDK LanguageModelV2.
|
|
@@ -616,6 +621,21 @@ interface SAPAIProviderSettings {
|
|
|
616
621
|
* @default 'sap-ai'
|
|
617
622
|
*/
|
|
618
623
|
readonly name?: string;
|
|
624
|
+
/**
|
|
625
|
+
* Custom request configuration forwarded to the underlying SAP AI SDK client on every
|
|
626
|
+
* call created from this provider.
|
|
627
|
+
*
|
|
628
|
+
* Provider-level only (not overridable per-call via `providerOptions['sap-ai']`). The
|
|
629
|
+
* AI SDK `abortSignal` option always wins over any `signal` on `requestConfig`; the
|
|
630
|
+
* latter is dropped before the request is forwarded. Node-only knobs (`httpAgent`,
|
|
631
|
+
* `httpsAgent`) are silently ignored on Edge / Cloudflare Workers runtimes.
|
|
632
|
+
*
|
|
633
|
+
* See the "Note on `requestConfig`" section under `SAPAIProviderSettings` in
|
|
634
|
+
* `API_REFERENCE.md` for the full SAP AI Core `AI-*` header guidance.
|
|
635
|
+
* @see {@link https://sap.github.io/ai-sdk/docs/js/getting-started | SAP Cloud SDK for AI (JS)}
|
|
636
|
+
* @see {@link https://github.com/jerome-benoit/sap-ai-provider/blob/main/API_REFERENCE.md#requestconfig-note | Note on `requestConfig` (API_REFERENCE.md)}
|
|
637
|
+
*/
|
|
638
|
+
readonly requestConfig?: CustomRequestConfig;
|
|
619
639
|
/**
|
|
620
640
|
* SAP AI Core resource group for resource isolation and access control.
|
|
621
641
|
* @default 'default'
|
|
@@ -646,6 +666,7 @@ interface SAPAIProviderV2 extends ProviderV2 {
|
|
|
646
666
|
* @param options.destination - Custom SAP Cloud SDK destination configuration.
|
|
647
667
|
* @param options.logLevel - Log level for SAP Cloud SDK loggers (`'debug'`, `'info'`, `'warn'`, `'error'`).
|
|
648
668
|
* @param options.name - Provider name used as key in `providerOptions` (default: `'sap-ai'`).
|
|
669
|
+
* @param options.requestConfig - Provider-level custom request configuration. See {@link SAPAIProviderSettings.requestConfig} for scope, portability, and abort semantics.
|
|
649
670
|
* @param options.resourceGroup - SAP AI Core resource group (default: `'default'`).
|
|
650
671
|
* @param options.warnOnAmbiguousConfig - Whether to warn when both deploymentId and resourceGroup are set.
|
|
651
672
|
* @returns A configured SAP AI provider instance that can be used as a callable or via methods.
|
package/dist/index.d.ts
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import { EmbeddingModelV2, SharedV2ProviderOptions, SharedV2ProviderMetadata, SharedV2Headers, LanguageModelV2, LanguageModelV2CallOptions, LanguageModelV2Content, LanguageModelV2FinishReason, LanguageModelV2ResponseMetadata, LanguageModelV2Usage, LanguageModelV2CallWarning, LanguageModelV2StreamPart, ProviderV2, ImageModelV2 } from '@ai-sdk/provider';
|
|
2
2
|
import { DeploymentIdConfig, ResourceGroupConfig } from '@sap-ai-sdk/ai-api/internal.js';
|
|
3
|
+
import { CustomRequestConfig } from '@sap-ai-sdk/core';
|
|
4
|
+
export { CustomRequestConfig } from '@sap-ai-sdk/core';
|
|
3
5
|
import { HttpDestinationOrFetchOptions } from '@sap-cloud-sdk/connectivity';
|
|
6
|
+
export { HttpDestinationOrFetchOptions } from '@sap-cloud-sdk/connectivity';
|
|
4
7
|
import { AzureOpenAiChatCompletionParameters } from '@sap-ai-sdk/foundation-models';
|
|
5
|
-
import { OrchestrationModuleConfig, FilteringModule, GroundingModule, MaskingModule,
|
|
6
|
-
export { AssistantChatMessage, ChatCompletionRequest, ChatCompletionTool, ChatMessage, ChatMessageContent, ChatMessages, Citation, DeveloperChatMessage, DocumentTranslationApplyToSelector, FileContent, FilteringModule, FunctionObject, GroundingModule, ImageContentUrl, LlmModelDetails, LlmModelParams, MaskingModule, OrchestrationClient, OrchestrationConfigRef, OrchestrationEmbeddingClient, OrchestrationEmbeddingResponse, OrchestrationError, OrchestrationErrorResponse, OrchestrationModuleConfig, OrchestrationModuleConfigList, OrchestrationResponse, OrchestrationStream, OrchestrationStreamChunkResponse, OrchestrationStreamResponse, PromptTemplatingModule, SystemChatMessage, ToolChatMessage, TranslationApplyToCategory, TranslationInputParameters, TranslationModule, TranslationOutputParameters, TranslationTargetLanguage, UserChatMessage, UserChatMessageContent, UserChatMessageContentItem, buildAzureContentSafetyFilter, buildDocumentGroundingConfig, buildDpiMaskingProvider, buildLlamaGuard38BFilter, buildTranslationConfig } from '@sap-ai-sdk/orchestration';
|
|
8
|
+
import { OrchestrationModuleConfig, FilteringModule, GroundingModule, MaskingModule, OrchestrationConfigRefById, OrchestrationConfigRefByName, ChatCompletionTool, TranslationModule, ChatModel } from '@sap-ai-sdk/orchestration';
|
|
9
|
+
export { AssistantChatMessage, ChatCompletionRequest, ChatCompletionTool, ChatMessage, ChatMessageContent, ChatMessages, Citation, DeveloperChatMessage, DocumentTranslationApplyToSelector, FileContent, FilteringModule, FunctionObject, GroundingModule, ImageContentUrl, LlmModelDetails, LlmModelParams, MaskingModule, OrchestrationClient, OrchestrationConfigRef, OrchestrationConfigRefById, OrchestrationConfigRefByName, OrchestrationEmbeddingClient, OrchestrationEmbeddingResponse, OrchestrationError, OrchestrationErrorResponse, OrchestrationModuleConfig, OrchestrationModuleConfigList, OrchestrationResponse, OrchestrationStream, OrchestrationStreamChunkResponse, OrchestrationStreamResponse, PromptTemplatingModule, SystemChatMessage, ToolChatMessage, TranslationApplyToCategory, TranslationInputParameters, TranslationModule, TranslationOutputParameters, TranslationTargetLanguage, UserChatMessage, UserChatMessageContent, UserChatMessageContentItem, buildAzureContentSafetyFilter, buildDocumentGroundingConfig, buildDpiMaskingProvider, buildLlamaGuard38BFilter, buildTranslationConfig } from '@sap-ai-sdk/orchestration';
|
|
7
10
|
import * as _ai_sdk_provider_utils from '@ai-sdk/provider-utils';
|
|
8
11
|
import { InferSchema } from '@ai-sdk/provider-utils';
|
|
9
12
|
|
|
@@ -208,7 +211,7 @@ interface OrchestrationModelSettings {
|
|
|
208
211
|
* @example { id: "f47ac10b-58cc-4372-a567-0e02b2c3d479" }
|
|
209
212
|
* @example { scenario: "customer-support", name: "prod-config", version: "1.0.0" }
|
|
210
213
|
*/
|
|
211
|
-
readonly orchestrationConfigRef?:
|
|
214
|
+
readonly orchestrationConfigRef?: OrchestrationConfigRefById | OrchestrationConfigRefByName;
|
|
212
215
|
readonly placeholderValues?: Record<string, string>;
|
|
213
216
|
readonly promptTemplateRef?: PromptTemplateRef;
|
|
214
217
|
readonly responseFormat?: ResponseFormat;
|
|
@@ -289,7 +292,7 @@ interface SAPAIEmbeddingSettings {
|
|
|
289
292
|
*
|
|
290
293
|
* Model availability depends on tenant configuration and region.
|
|
291
294
|
* Common values include: `'gpt-4.1'`, `'gpt-4.1-mini'`, `'anthropic--claude-4.5-sonnet'`, `'gemini-2.5-pro'`.
|
|
292
|
-
* @see {@link https://help.sap.com/docs/sap-ai-core/sap-ai-core-service-guide/models-and-scenarios-in-generative-ai-hub|SAP AI Core Models}
|
|
295
|
+
* @see {@link https://help.sap.com/docs/sap-ai-core/sap-ai-core-service-guide/models-and-scenarios-in-generative-ai-hub | SAP AI Core Models}
|
|
293
296
|
*/
|
|
294
297
|
type SAPAIModelId = ChatModel;
|
|
295
298
|
/**
|
|
@@ -324,7 +327,7 @@ interface SAPAISettings {
|
|
|
324
327
|
readonly modelParams?: CommonModelParams;
|
|
325
328
|
readonly modelVersion?: string;
|
|
326
329
|
/** Orchestration API only. */
|
|
327
|
-
readonly orchestrationConfigRef?:
|
|
330
|
+
readonly orchestrationConfigRef?: OrchestrationConfigRefById | OrchestrationConfigRefByName;
|
|
328
331
|
/** Orchestration API only. */
|
|
329
332
|
readonly placeholderValues?: Record<string, string>;
|
|
330
333
|
/** Orchestration API only. */
|
|
@@ -353,6 +356,7 @@ interface SAPAIEmbeddingModelV2Config {
|
|
|
353
356
|
readonly destination?: HttpDestinationOrFetchOptions;
|
|
354
357
|
readonly provider: string;
|
|
355
358
|
readonly providerApi?: SAPAIApiType;
|
|
359
|
+
readonly requestConfig?: CustomRequestConfig;
|
|
356
360
|
}
|
|
357
361
|
/**
|
|
358
362
|
* SAP AI Core Embedding Model implementing Vercel AI SDK EmbeddingModelV2.
|
|
@@ -507,6 +511,7 @@ interface SAPAILanguageModelV2Config {
|
|
|
507
511
|
readonly destination?: HttpDestinationOrFetchOptions;
|
|
508
512
|
readonly provider: string;
|
|
509
513
|
readonly providerApi?: SAPAIApiType;
|
|
514
|
+
readonly requestConfig?: CustomRequestConfig;
|
|
510
515
|
}
|
|
511
516
|
/**
|
|
512
517
|
* SAP AI Language Model implementing Vercel AI SDK LanguageModelV2.
|
|
@@ -616,6 +621,21 @@ interface SAPAIProviderSettings {
|
|
|
616
621
|
* @default 'sap-ai'
|
|
617
622
|
*/
|
|
618
623
|
readonly name?: string;
|
|
624
|
+
/**
|
|
625
|
+
* Custom request configuration forwarded to the underlying SAP AI SDK client on every
|
|
626
|
+
* call created from this provider.
|
|
627
|
+
*
|
|
628
|
+
* Provider-level only (not overridable per-call via `providerOptions['sap-ai']`). The
|
|
629
|
+
* AI SDK `abortSignal` option always wins over any `signal` on `requestConfig`; the
|
|
630
|
+
* latter is dropped before the request is forwarded. Node-only knobs (`httpAgent`,
|
|
631
|
+
* `httpsAgent`) are silently ignored on Edge / Cloudflare Workers runtimes.
|
|
632
|
+
*
|
|
633
|
+
* See the "Note on `requestConfig`" section under `SAPAIProviderSettings` in
|
|
634
|
+
* `API_REFERENCE.md` for the full SAP AI Core `AI-*` header guidance.
|
|
635
|
+
* @see {@link https://sap.github.io/ai-sdk/docs/js/getting-started | SAP Cloud SDK for AI (JS)}
|
|
636
|
+
* @see {@link https://github.com/jerome-benoit/sap-ai-provider/blob/main/API_REFERENCE.md#requestconfig-note | Note on `requestConfig` (API_REFERENCE.md)}
|
|
637
|
+
*/
|
|
638
|
+
readonly requestConfig?: CustomRequestConfig;
|
|
619
639
|
/**
|
|
620
640
|
* SAP AI Core resource group for resource isolation and access control.
|
|
621
641
|
* @default 'default'
|
|
@@ -646,6 +666,7 @@ interface SAPAIProviderV2 extends ProviderV2 {
|
|
|
646
666
|
* @param options.destination - Custom SAP Cloud SDK destination configuration.
|
|
647
667
|
* @param options.logLevel - Log level for SAP Cloud SDK loggers (`'debug'`, `'info'`, `'warn'`, `'error'`).
|
|
648
668
|
* @param options.name - Provider name used as key in `providerOptions` (default: `'sap-ai'`).
|
|
669
|
+
* @param options.requestConfig - Provider-level custom request configuration. See {@link SAPAIProviderSettings.requestConfig} for scope, portability, and abort semantics.
|
|
649
670
|
* @param options.resourceGroup - SAP AI Core resource group (default: `'default'`).
|
|
650
671
|
* @param options.warnOnAmbiguousConfig - Whether to warn when both deploymentId and resourceGroup are set.
|
|
651
672
|
* @returns A configured SAP AI provider instance that can be used as a callable or via methods.
|
package/dist/index.js
CHANGED
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
mergeSettingsWithApi,
|
|
4
4
|
resolveApi,
|
|
5
5
|
validateSettings
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-4SQ5HC6Y.js";
|
|
7
7
|
import {
|
|
8
8
|
escapeOrchestrationPlaceholders,
|
|
9
9
|
unescapeOrchestrationPlaceholders
|
|
@@ -20,7 +20,7 @@ import {
|
|
|
20
20
|
sapAILanguageModelProviderOptions,
|
|
21
21
|
validateEmbeddingModelParamsSettings,
|
|
22
22
|
validateModelParamsSettings
|
|
23
|
-
} from "./chunk-
|
|
23
|
+
} from "./chunk-4PLJVJX4.js";
|
|
24
24
|
|
|
25
25
|
// src/sap-ai-adapters-v3-to-v2.ts
|
|
26
26
|
function convertFinishReasonToV2(internalFinishReason) {
|
|
@@ -253,21 +253,21 @@ function getOrCreateLanguageModelStrategy(api) {
|
|
|
253
253
|
async function createEmbeddingModelStrategy(api) {
|
|
254
254
|
if (api === "foundation-models") {
|
|
255
255
|
const { AzureOpenAiEmbeddingClient } = await import("@sap-ai-sdk/foundation-models");
|
|
256
|
-
const { FoundationModelsEmbeddingModelStrategy } = await import("./foundation-models-embedding-model-strategy-
|
|
256
|
+
const { FoundationModelsEmbeddingModelStrategy } = await import("./foundation-models-embedding-model-strategy-RVJQSJPU.js");
|
|
257
257
|
return new FoundationModelsEmbeddingModelStrategy(AzureOpenAiEmbeddingClient);
|
|
258
258
|
}
|
|
259
259
|
const { OrchestrationEmbeddingClient: OrchestrationEmbeddingClient2 } = await import("@sap-ai-sdk/orchestration");
|
|
260
|
-
const { OrchestrationEmbeddingModelStrategy } = await import("./orchestration-embedding-model-strategy-
|
|
260
|
+
const { OrchestrationEmbeddingModelStrategy } = await import("./orchestration-embedding-model-strategy-OMIXGLHJ.js");
|
|
261
261
|
return new OrchestrationEmbeddingModelStrategy(OrchestrationEmbeddingClient2);
|
|
262
262
|
}
|
|
263
263
|
async function createLanguageModelStrategy(api) {
|
|
264
264
|
if (api === "foundation-models") {
|
|
265
265
|
const { AzureOpenAiChatClient } = await import("@sap-ai-sdk/foundation-models");
|
|
266
|
-
const { FoundationModelsLanguageModelStrategy } = await import("./foundation-models-language-model-strategy-
|
|
266
|
+
const { FoundationModelsLanguageModelStrategy } = await import("./foundation-models-language-model-strategy-UWJ6FHBI.js");
|
|
267
267
|
return new FoundationModelsLanguageModelStrategy(AzureOpenAiChatClient);
|
|
268
268
|
}
|
|
269
269
|
const { OrchestrationClient: OrchestrationClient2 } = await import("@sap-ai-sdk/orchestration");
|
|
270
|
-
const { OrchestrationLanguageModelStrategy } = await import("./orchestration-language-model-strategy-
|
|
270
|
+
const { OrchestrationLanguageModelStrategy } = await import("./orchestration-language-model-strategy-UE7OQO5K.js");
|
|
271
271
|
return new OrchestrationLanguageModelStrategy(OrchestrationClient2);
|
|
272
272
|
}
|
|
273
273
|
|
|
@@ -316,7 +316,8 @@ var SAPAIEmbeddingModel = class {
|
|
|
316
316
|
deploymentConfig: this.config.deploymentConfig,
|
|
317
317
|
destination: this.config.destination,
|
|
318
318
|
modelId: this.modelId,
|
|
319
|
-
provider: this.config.provider
|
|
319
|
+
provider: this.config.provider,
|
|
320
|
+
requestConfig: this.config.requestConfig
|
|
320
321
|
};
|
|
321
322
|
return strategy.doEmbed(strategyConfig, this.settings, options, this.maxEmbeddingsPerCall);
|
|
322
323
|
}
|
|
@@ -452,7 +453,8 @@ var SAPAILanguageModel = class {
|
|
|
452
453
|
deploymentConfig: this.config.deploymentConfig,
|
|
453
454
|
destination: this.config.destination,
|
|
454
455
|
modelId: this.modelId,
|
|
455
|
-
provider: this.config.provider
|
|
456
|
+
provider: this.config.provider,
|
|
457
|
+
requestConfig: this.config.requestConfig
|
|
456
458
|
};
|
|
457
459
|
return { strategy, strategyConfig };
|
|
458
460
|
}
|
|
@@ -545,7 +547,8 @@ function createSAPAIProvider(options = {}) {
|
|
|
545
547
|
deploymentConfig,
|
|
546
548
|
destination: options.destination,
|
|
547
549
|
provider: `${providerName}.chat`,
|
|
548
|
-
providerApi
|
|
550
|
+
providerApi,
|
|
551
|
+
requestConfig: options.requestConfig
|
|
549
552
|
});
|
|
550
553
|
};
|
|
551
554
|
const createEmbeddingModel = (modelId, settings = {}) => {
|
|
@@ -561,7 +564,8 @@ function createSAPAIProvider(options = {}) {
|
|
|
561
564
|
deploymentConfig,
|
|
562
565
|
destination: options.destination,
|
|
563
566
|
provider: `${providerName}.embedding`,
|
|
564
|
-
providerApi
|
|
567
|
+
providerApi,
|
|
568
|
+
requestConfig: options.requestConfig
|
|
565
569
|
});
|
|
566
570
|
};
|
|
567
571
|
const provider = function(modelId, settings) {
|