@jerome-benoit/sap-ai-provider-v2 5.0.3 → 5.1.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 +44 -24
- package/dist/chunk-4ILJD6PI.js +333 -0
- package/dist/chunk-4ILJD6PI.js.map +1 -0
- package/dist/chunk-BHA5MIN6.js +224 -0
- package/dist/chunk-BHA5MIN6.js.map +1 -0
- package/dist/{chunk-4JLNWASF.js → chunk-DLGBK3C3.js} +91 -7
- package/dist/chunk-DLGBK3C3.js.map +1 -0
- package/dist/{chunk-E76ZDPIW.js → chunk-EUBI5ENK.js} +54 -27
- package/dist/chunk-EUBI5ENK.js.map +1 -0
- package/dist/{chunk-YP3AADWD.js → chunk-FKHOJ3ZC.js} +24 -3
- package/dist/chunk-FKHOJ3ZC.js.map +1 -0
- package/dist/{chunk-UIBQ5AFS.js → chunk-QFMHNGLB.js} +56 -218
- package/dist/chunk-QFMHNGLB.js.map +1 -0
- package/dist/{chunk-3H5C5U22.js → chunk-QQQYMQPU.js} +19 -10
- package/dist/chunk-QQQYMQPU.js.map +1 -0
- package/dist/{chunk-NF355OFT.js → chunk-ZOBD7PXJ.js} +116 -21
- package/dist/chunk-ZOBD7PXJ.js.map +1 -0
- package/dist/{foundation-models-embedding-model-strategy-SAVQFBF4.js → foundation-models-embedding-model-strategy-3WAKJXBY.js} +5 -4
- package/dist/{foundation-models-embedding-model-strategy-SAVQFBF4.js.map → foundation-models-embedding-model-strategy-3WAKJXBY.js.map} +1 -1
- package/dist/{foundation-models-language-model-strategy-ZDOWVYTA.js → foundation-models-language-model-strategy-PJ26VXEA.js} +21 -8
- package/dist/foundation-models-language-model-strategy-PJ26VXEA.js.map +1 -0
- package/dist/index.cjs +2008 -497
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +798 -185
- package/dist/index.d.ts +798 -185
- package/dist/index.js +148 -24
- package/dist/index.js.map +1 -1
- package/dist/{orchestration-embedding-model-strategy-GT27AFII.js → orchestration-embedding-model-strategy-AZ76XLMD.js} +6 -5
- package/dist/{orchestration-embedding-model-strategy-GT27AFII.js.map → orchestration-embedding-model-strategy-AZ76XLMD.js.map} +1 -1
- package/dist/{orchestration-language-model-strategy-7QTPQHCC.js → orchestration-language-model-strategy-CT6RHCYO.js} +48 -17
- package/dist/orchestration-language-model-strategy-CT6RHCYO.js.map +1 -0
- package/dist/responses-language-model-strategy-UYTV6TPM.js +738 -0
- package/dist/responses-language-model-strategy-UYTV6TPM.js.map +1 -0
- package/dist/sap-ai-error-UPKYWPSS.js +16 -0
- package/dist/sap-ai-error-UPKYWPSS.js.map +1 -0
- package/package.json +79 -39
- package/dist/chunk-3H5C5U22.js.map +0 -1
- package/dist/chunk-4JLNWASF.js.map +0 -1
- package/dist/chunk-E76ZDPIW.js.map +0 -1
- package/dist/chunk-NF355OFT.js.map +0 -1
- package/dist/chunk-UIBQ5AFS.js.map +0 -1
- package/dist/chunk-YP3AADWD.js.map +0 -1
- package/dist/foundation-models-language-model-strategy-ZDOWVYTA.js.map +0 -1
- package/dist/orchestration-language-model-strategy-7QTPQHCC.js.map +0 -1
package/dist/index.d.cts
CHANGED
|
@@ -3,13 +3,748 @@ import { CustomRequestConfig } from '@sap-ai-sdk/core';
|
|
|
3
3
|
export { CustomRequestConfig } from '@sap-ai-sdk/core';
|
|
4
4
|
import { HttpDestinationOrFetchOptions } from '@sap-cloud-sdk/connectivity';
|
|
5
5
|
export { HttpDestinationOrFetchOptions } from '@sap-cloud-sdk/connectivity';
|
|
6
|
+
import { OpenAIResponsesProviderOptions } from '@ai-sdk/openai';
|
|
6
7
|
import { AzureOpenAiChatCompletionParameters } from '@sap-ai-sdk/foundation-models';
|
|
7
8
|
import { OrchestrationConfigRefOverride, OrchestrationModuleConfig, FilteringModule, GroundingModule, MaskingModule, OrchestrationConfigRefById, OrchestrationConfigRefByName, ChatCompletionTool, TranslationModule, ChatModel } from '@sap-ai-sdk/orchestration';
|
|
8
9
|
export { AssistantChatMessage, ChatCompletionRequest, ChatCompletionTool, ChatMessage, ChatMessageContent, ChatMessages, Citation, DeveloperChatMessage, DocumentTranslationApplyToSelector, FileContent, FilteringModule, FunctionObject, GroundingModule, ImageContentUrl, LlmModelDetails, LlmModelParams, MaskingModule, OrchestrationClient, OrchestrationConfigRef, OrchestrationConfigRefById, OrchestrationConfigRefByName, OrchestrationConfigRefOverride, 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';
|
|
9
|
-
import { LanguageModelV2 as LanguageModelV2$1, LanguageModelV2CallOptions as LanguageModelV2CallOptions$1
|
|
10
|
+
import { LanguageModelV2 as LanguageModelV2$1, LanguageModelV2CallOptions as LanguageModelV2CallOptions$1 } from '@ai-sdk/provider';
|
|
10
11
|
import * as _ai_sdk_provider_utils from '@ai-sdk/provider-utils';
|
|
11
12
|
import { InferSchema } from '@ai-sdk/provider-utils';
|
|
12
13
|
|
|
14
|
+
// ==================================================================================================
|
|
15
|
+
// JSON Schema Draft 07
|
|
16
|
+
// ==================================================================================================
|
|
17
|
+
// https://tools.ietf.org/html/draft-handrews-json-schema-validation-01
|
|
18
|
+
// --------------------------------------------------------------------------------------------------
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Primitive type
|
|
22
|
+
* @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-6.1.1
|
|
23
|
+
*/
|
|
24
|
+
type JSONSchema7TypeName =
|
|
25
|
+
| "string" //
|
|
26
|
+
| "number"
|
|
27
|
+
| "integer"
|
|
28
|
+
| "boolean"
|
|
29
|
+
| "object"
|
|
30
|
+
| "array"
|
|
31
|
+
| "null";
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Primitive type
|
|
35
|
+
* @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-6.1.1
|
|
36
|
+
*/
|
|
37
|
+
type JSONSchema7Type =
|
|
38
|
+
| string //
|
|
39
|
+
| number
|
|
40
|
+
| boolean
|
|
41
|
+
| JSONSchema7Object
|
|
42
|
+
| JSONSchema7Array
|
|
43
|
+
| null;
|
|
44
|
+
|
|
45
|
+
// Workaround for infinite type recursion
|
|
46
|
+
interface JSONSchema7Object {
|
|
47
|
+
[key: string]: JSONSchema7Type;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
// Workaround for infinite type recursion
|
|
51
|
+
// https://github.com/Microsoft/TypeScript/issues/3496#issuecomment-128553540
|
|
52
|
+
interface JSONSchema7Array extends Array<JSONSchema7Type> {}
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Meta schema
|
|
56
|
+
*
|
|
57
|
+
* Recommended values:
|
|
58
|
+
* - 'http://json-schema.org/schema#'
|
|
59
|
+
* - 'http://json-schema.org/hyper-schema#'
|
|
60
|
+
* - 'http://json-schema.org/draft-07/schema#'
|
|
61
|
+
* - 'http://json-schema.org/draft-07/hyper-schema#'
|
|
62
|
+
*
|
|
63
|
+
* @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-5
|
|
64
|
+
*/
|
|
65
|
+
type JSONSchema7Version = string;
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* JSON Schema v7
|
|
69
|
+
* @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01
|
|
70
|
+
*/
|
|
71
|
+
type JSONSchema7Definition = JSONSchema7 | boolean;
|
|
72
|
+
interface JSONSchema7 {
|
|
73
|
+
$id?: string | undefined;
|
|
74
|
+
$ref?: string | undefined;
|
|
75
|
+
$schema?: JSONSchema7Version | undefined;
|
|
76
|
+
$comment?: string | undefined;
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* @see https://datatracker.ietf.org/doc/html/draft-bhutton-json-schema-00#section-8.2.4
|
|
80
|
+
* @see https://datatracker.ietf.org/doc/html/draft-bhutton-json-schema-validation-00#appendix-A
|
|
81
|
+
*/
|
|
82
|
+
$defs?: {
|
|
83
|
+
[key: string]: JSONSchema7Definition;
|
|
84
|
+
} | undefined;
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-6.1
|
|
88
|
+
*/
|
|
89
|
+
type?: JSONSchema7TypeName | JSONSchema7TypeName[] | undefined;
|
|
90
|
+
enum?: JSONSchema7Type[] | undefined;
|
|
91
|
+
const?: JSONSchema7Type | undefined;
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-6.2
|
|
95
|
+
*/
|
|
96
|
+
multipleOf?: number | undefined;
|
|
97
|
+
maximum?: number | undefined;
|
|
98
|
+
exclusiveMaximum?: number | undefined;
|
|
99
|
+
minimum?: number | undefined;
|
|
100
|
+
exclusiveMinimum?: number | undefined;
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-6.3
|
|
104
|
+
*/
|
|
105
|
+
maxLength?: number | undefined;
|
|
106
|
+
minLength?: number | undefined;
|
|
107
|
+
pattern?: string | undefined;
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-6.4
|
|
111
|
+
*/
|
|
112
|
+
items?: JSONSchema7Definition | JSONSchema7Definition[] | undefined;
|
|
113
|
+
additionalItems?: JSONSchema7Definition | undefined;
|
|
114
|
+
maxItems?: number | undefined;
|
|
115
|
+
minItems?: number | undefined;
|
|
116
|
+
uniqueItems?: boolean | undefined;
|
|
117
|
+
contains?: JSONSchema7Definition | undefined;
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-6.5
|
|
121
|
+
*/
|
|
122
|
+
maxProperties?: number | undefined;
|
|
123
|
+
minProperties?: number | undefined;
|
|
124
|
+
required?: string[] | undefined;
|
|
125
|
+
properties?: {
|
|
126
|
+
[key: string]: JSONSchema7Definition;
|
|
127
|
+
} | undefined;
|
|
128
|
+
patternProperties?: {
|
|
129
|
+
[key: string]: JSONSchema7Definition;
|
|
130
|
+
} | undefined;
|
|
131
|
+
additionalProperties?: JSONSchema7Definition | undefined;
|
|
132
|
+
dependencies?: {
|
|
133
|
+
[key: string]: JSONSchema7Definition | string[];
|
|
134
|
+
} | undefined;
|
|
135
|
+
propertyNames?: JSONSchema7Definition | undefined;
|
|
136
|
+
|
|
137
|
+
/**
|
|
138
|
+
* @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-6.6
|
|
139
|
+
*/
|
|
140
|
+
if?: JSONSchema7Definition | undefined;
|
|
141
|
+
then?: JSONSchema7Definition | undefined;
|
|
142
|
+
else?: JSONSchema7Definition | undefined;
|
|
143
|
+
|
|
144
|
+
/**
|
|
145
|
+
* @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-6.7
|
|
146
|
+
*/
|
|
147
|
+
allOf?: JSONSchema7Definition[] | undefined;
|
|
148
|
+
anyOf?: JSONSchema7Definition[] | undefined;
|
|
149
|
+
oneOf?: JSONSchema7Definition[] | undefined;
|
|
150
|
+
not?: JSONSchema7Definition | undefined;
|
|
151
|
+
|
|
152
|
+
/**
|
|
153
|
+
* @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-7
|
|
154
|
+
*/
|
|
155
|
+
format?: string | undefined;
|
|
156
|
+
|
|
157
|
+
/**
|
|
158
|
+
* @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-8
|
|
159
|
+
*/
|
|
160
|
+
contentMediaType?: string | undefined;
|
|
161
|
+
contentEncoding?: string | undefined;
|
|
162
|
+
|
|
163
|
+
/**
|
|
164
|
+
* @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-9
|
|
165
|
+
*/
|
|
166
|
+
definitions?: {
|
|
167
|
+
[key: string]: JSONSchema7Definition;
|
|
168
|
+
} | undefined;
|
|
169
|
+
|
|
170
|
+
/**
|
|
171
|
+
* @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-10
|
|
172
|
+
*/
|
|
173
|
+
title?: string | undefined;
|
|
174
|
+
description?: string | undefined;
|
|
175
|
+
default?: JSONSchema7Type | undefined;
|
|
176
|
+
readOnly?: boolean | undefined;
|
|
177
|
+
writeOnly?: boolean | undefined;
|
|
178
|
+
examples?: JSONSchema7Type | undefined;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
/**
|
|
182
|
+
* A JSON value can be a string, number, boolean, object, array, or null.
|
|
183
|
+
* JSON values can be serialized and deserialized by the JSON.stringify and JSON.parse methods.
|
|
184
|
+
*/
|
|
185
|
+
type JSONValue$1 = null | string | number | boolean | JSONObject$1 | JSONArray$1;
|
|
186
|
+
type JSONObject$1 = {
|
|
187
|
+
[key: string]: JSONValue$1 | undefined;
|
|
188
|
+
};
|
|
189
|
+
type JSONArray$1 = JSONValue$1[];
|
|
190
|
+
|
|
191
|
+
/**
|
|
192
|
+
* Additional provider-specific options.
|
|
193
|
+
* Options are additional input to the provider.
|
|
194
|
+
* They are passed through to the provider from the AI SDK
|
|
195
|
+
* and enable provider-specific functionality
|
|
196
|
+
* that can be fully encapsulated in the provider.
|
|
197
|
+
*
|
|
198
|
+
* This enables us to quickly ship provider-specific functionality
|
|
199
|
+
* without affecting the core AI SDK.
|
|
200
|
+
*
|
|
201
|
+
* The outer record is keyed by the provider name, and the inner
|
|
202
|
+
* record is keyed by the provider-specific metadata key.
|
|
203
|
+
*
|
|
204
|
+
* ```ts
|
|
205
|
+
* {
|
|
206
|
+
* "anthropic": {
|
|
207
|
+
* "cacheControl": { "type": "ephemeral" }
|
|
208
|
+
* }
|
|
209
|
+
* }
|
|
210
|
+
* ```
|
|
211
|
+
*/
|
|
212
|
+
type SharedV3ProviderOptions = Record<string, JSONObject$1>;
|
|
213
|
+
|
|
214
|
+
/**
|
|
215
|
+
* A tool has a name, a description, and a set of parameters.
|
|
216
|
+
*
|
|
217
|
+
* Note: this is **not** the user-facing tool definition. The AI SDK methods will
|
|
218
|
+
* map the user-facing tool definitions to this format.
|
|
219
|
+
*/
|
|
220
|
+
type LanguageModelV3FunctionTool = {
|
|
221
|
+
/**
|
|
222
|
+
* The type of the tool (always 'function').
|
|
223
|
+
*/
|
|
224
|
+
type: 'function';
|
|
225
|
+
/**
|
|
226
|
+
* The name of the tool. Unique within this model call.
|
|
227
|
+
*/
|
|
228
|
+
name: string;
|
|
229
|
+
/**
|
|
230
|
+
* A description of the tool. The language model uses this to understand the
|
|
231
|
+
* tool's purpose and to provide better completion suggestions.
|
|
232
|
+
*/
|
|
233
|
+
description?: string;
|
|
234
|
+
/**
|
|
235
|
+
* The parameters that the tool expects. The language model uses this to
|
|
236
|
+
* understand the tool's input requirements and to provide matching suggestions.
|
|
237
|
+
*/
|
|
238
|
+
inputSchema: JSONSchema7;
|
|
239
|
+
/**
|
|
240
|
+
* An optional list of input examples that show the language
|
|
241
|
+
* model what the input should look like.
|
|
242
|
+
*/
|
|
243
|
+
inputExamples?: Array<{
|
|
244
|
+
input: JSONObject$1;
|
|
245
|
+
}>;
|
|
246
|
+
/**
|
|
247
|
+
* Strict mode setting for the tool.
|
|
248
|
+
*
|
|
249
|
+
* Providers that support strict mode will use this setting to determine
|
|
250
|
+
* how the input should be generated. Strict mode will always produce
|
|
251
|
+
* valid inputs, but it might limit what input schemas are supported.
|
|
252
|
+
*/
|
|
253
|
+
strict?: boolean;
|
|
254
|
+
/**
|
|
255
|
+
* The provider-specific options for the tool.
|
|
256
|
+
*/
|
|
257
|
+
providerOptions?: SharedV3ProviderOptions;
|
|
258
|
+
};
|
|
259
|
+
|
|
260
|
+
/**
|
|
261
|
+
* Data content. Can be a Uint8Array, base64 encoded data as a string or a URL.
|
|
262
|
+
*/
|
|
263
|
+
type LanguageModelV3DataContent = Uint8Array | string | URL;
|
|
264
|
+
|
|
265
|
+
/**
|
|
266
|
+
* A prompt is a list of messages.
|
|
267
|
+
*
|
|
268
|
+
* Note: Not all models and prompt formats support multi-modal inputs and
|
|
269
|
+
* tool calls. The validation happens at runtime.
|
|
270
|
+
*
|
|
271
|
+
* Note: This is not a user-facing prompt. The AI SDK methods will map the
|
|
272
|
+
* user-facing prompt types such as chat or instruction prompts to this format.
|
|
273
|
+
*/
|
|
274
|
+
type LanguageModelV3Prompt = Array<LanguageModelV3Message>;
|
|
275
|
+
type LanguageModelV3Message = ({
|
|
276
|
+
role: 'system';
|
|
277
|
+
content: string;
|
|
278
|
+
} | {
|
|
279
|
+
role: 'user';
|
|
280
|
+
content: Array<LanguageModelV3TextPart | LanguageModelV3FilePart>;
|
|
281
|
+
} | {
|
|
282
|
+
role: 'assistant';
|
|
283
|
+
content: Array<LanguageModelV3TextPart | LanguageModelV3FilePart | LanguageModelV3ReasoningPart | LanguageModelV3ToolCallPart | LanguageModelV3ToolResultPart>;
|
|
284
|
+
} | {
|
|
285
|
+
role: 'tool';
|
|
286
|
+
content: Array<LanguageModelV3ToolResultPart | LanguageModelV3ToolApprovalResponsePart>;
|
|
287
|
+
}) & {
|
|
288
|
+
/**
|
|
289
|
+
* Additional provider-specific options. They are passed through
|
|
290
|
+
* to the provider from the AI SDK and enable provider-specific
|
|
291
|
+
* functionality that can be fully encapsulated in the provider.
|
|
292
|
+
*/
|
|
293
|
+
providerOptions?: SharedV3ProviderOptions;
|
|
294
|
+
};
|
|
295
|
+
/**
|
|
296
|
+
* Text content part of a prompt. It contains a string of text.
|
|
297
|
+
*/
|
|
298
|
+
interface LanguageModelV3TextPart {
|
|
299
|
+
type: 'text';
|
|
300
|
+
/**
|
|
301
|
+
* The text content.
|
|
302
|
+
*/
|
|
303
|
+
text: string;
|
|
304
|
+
/**
|
|
305
|
+
* Additional provider-specific options. They are passed through
|
|
306
|
+
* to the provider from the AI SDK and enable provider-specific
|
|
307
|
+
* functionality that can be fully encapsulated in the provider.
|
|
308
|
+
*/
|
|
309
|
+
providerOptions?: SharedV3ProviderOptions;
|
|
310
|
+
}
|
|
311
|
+
/**
|
|
312
|
+
* Reasoning content part of a prompt. It contains a string of reasoning text.
|
|
313
|
+
*/
|
|
314
|
+
interface LanguageModelV3ReasoningPart {
|
|
315
|
+
type: 'reasoning';
|
|
316
|
+
/**
|
|
317
|
+
* The reasoning text.
|
|
318
|
+
*/
|
|
319
|
+
text: string;
|
|
320
|
+
/**
|
|
321
|
+
* Additional provider-specific options. They are passed through
|
|
322
|
+
* to the provider from the AI SDK and enable provider-specific
|
|
323
|
+
* functionality that can be fully encapsulated in the provider.
|
|
324
|
+
*/
|
|
325
|
+
providerOptions?: SharedV3ProviderOptions;
|
|
326
|
+
}
|
|
327
|
+
/**
|
|
328
|
+
* File content part of a prompt. It contains a file.
|
|
329
|
+
*/
|
|
330
|
+
interface LanguageModelV3FilePart {
|
|
331
|
+
type: 'file';
|
|
332
|
+
/**
|
|
333
|
+
* Optional filename of the file.
|
|
334
|
+
*/
|
|
335
|
+
filename?: string;
|
|
336
|
+
/**
|
|
337
|
+
* File data. Can be a Uint8Array, base64 encoded data as a string or a URL.
|
|
338
|
+
*/
|
|
339
|
+
data: LanguageModelV3DataContent;
|
|
340
|
+
/**
|
|
341
|
+
* The original URL string before it was parsed into a URL.
|
|
342
|
+
*
|
|
343
|
+
* This is available when parsing changes the string and a provider needs to
|
|
344
|
+
* preserve an opaque non-HTTP URI exactly.
|
|
345
|
+
*/
|
|
346
|
+
originalUrl?: string;
|
|
347
|
+
/**
|
|
348
|
+
* IANA media type of the file.
|
|
349
|
+
*
|
|
350
|
+
* Can support wildcards, e.g. `image/*` (in which case the provider needs to take appropriate action).
|
|
351
|
+
*
|
|
352
|
+
* @see https://www.iana.org/assignments/media-types/media-types.xhtml
|
|
353
|
+
*/
|
|
354
|
+
mediaType: string;
|
|
355
|
+
/**
|
|
356
|
+
* Additional provider-specific options. They are passed through
|
|
357
|
+
* to the provider from the AI SDK and enable provider-specific
|
|
358
|
+
* functionality that can be fully encapsulated in the provider.
|
|
359
|
+
*/
|
|
360
|
+
providerOptions?: SharedV3ProviderOptions;
|
|
361
|
+
}
|
|
362
|
+
/**
|
|
363
|
+
* Tool call content part of a prompt. It contains a tool call (usually generated by the AI model).
|
|
364
|
+
*/
|
|
365
|
+
interface LanguageModelV3ToolCallPart {
|
|
366
|
+
type: 'tool-call';
|
|
367
|
+
/**
|
|
368
|
+
* ID of the tool call. This ID is used to match the tool call with the tool result.
|
|
369
|
+
*/
|
|
370
|
+
toolCallId: string;
|
|
371
|
+
/**
|
|
372
|
+
* Name of the tool that is being called.
|
|
373
|
+
*/
|
|
374
|
+
toolName: string;
|
|
375
|
+
/**
|
|
376
|
+
* Arguments of the tool call. This is a JSON-serializable object that matches the tool's input schema.
|
|
377
|
+
*/
|
|
378
|
+
input: unknown;
|
|
379
|
+
/**
|
|
380
|
+
* Whether the tool call will be executed by the provider.
|
|
381
|
+
* If this flag is not set or is false, the tool call will be executed by the client.
|
|
382
|
+
*/
|
|
383
|
+
providerExecuted?: boolean;
|
|
384
|
+
/**
|
|
385
|
+
* Additional provider-specific options. They are passed through
|
|
386
|
+
* to the provider from the AI SDK and enable provider-specific
|
|
387
|
+
* functionality that can be fully encapsulated in the provider.
|
|
388
|
+
*/
|
|
389
|
+
providerOptions?: SharedV3ProviderOptions;
|
|
390
|
+
}
|
|
391
|
+
/**
|
|
392
|
+
* Tool result content part of a prompt. It contains the result of the tool call with the matching ID.
|
|
393
|
+
*/
|
|
394
|
+
interface LanguageModelV3ToolResultPart {
|
|
395
|
+
type: 'tool-result';
|
|
396
|
+
/**
|
|
397
|
+
* ID of the tool call that this result is associated with.
|
|
398
|
+
*/
|
|
399
|
+
toolCallId: string;
|
|
400
|
+
/**
|
|
401
|
+
* Name of the tool that generated this result.
|
|
402
|
+
*/
|
|
403
|
+
toolName: string;
|
|
404
|
+
/**
|
|
405
|
+
* Result of the tool call.
|
|
406
|
+
*/
|
|
407
|
+
output: LanguageModelV3ToolResultOutput;
|
|
408
|
+
/**
|
|
409
|
+
* Additional provider-specific options. They are passed through
|
|
410
|
+
* to the provider from the AI SDK and enable provider-specific
|
|
411
|
+
* functionality that can be fully encapsulated in the provider.
|
|
412
|
+
*/
|
|
413
|
+
providerOptions?: SharedV3ProviderOptions;
|
|
414
|
+
}
|
|
415
|
+
/**
|
|
416
|
+
* Tool approval response content part of a prompt. It contains the user's
|
|
417
|
+
* decision to approve or deny a provider-executed tool call.
|
|
418
|
+
*/
|
|
419
|
+
interface LanguageModelV3ToolApprovalResponsePart {
|
|
420
|
+
type: 'tool-approval-response';
|
|
421
|
+
/**
|
|
422
|
+
* ID of the approval request that this response refers to.
|
|
423
|
+
*/
|
|
424
|
+
approvalId: string;
|
|
425
|
+
/**
|
|
426
|
+
* Whether the approval was granted (true) or denied (false).
|
|
427
|
+
*/
|
|
428
|
+
approved: boolean;
|
|
429
|
+
/**
|
|
430
|
+
* Optional reason for approval or denial.
|
|
431
|
+
*/
|
|
432
|
+
reason?: string;
|
|
433
|
+
/**
|
|
434
|
+
* Additional provider-specific options. They are passed through
|
|
435
|
+
* to the provider from the AI SDK and enable provider-specific
|
|
436
|
+
* functionality that can be fully encapsulated in the provider.
|
|
437
|
+
*/
|
|
438
|
+
providerOptions?: SharedV3ProviderOptions;
|
|
439
|
+
}
|
|
440
|
+
/**
|
|
441
|
+
* Result of a tool call.
|
|
442
|
+
*/
|
|
443
|
+
type LanguageModelV3ToolResultOutput = {
|
|
444
|
+
/**
|
|
445
|
+
* Text tool output that should be directly sent to the API.
|
|
446
|
+
*/
|
|
447
|
+
type: 'text';
|
|
448
|
+
value: string;
|
|
449
|
+
/**
|
|
450
|
+
* Provider-specific options.
|
|
451
|
+
*/
|
|
452
|
+
providerOptions?: SharedV3ProviderOptions;
|
|
453
|
+
} | {
|
|
454
|
+
type: 'json';
|
|
455
|
+
value: JSONValue$1;
|
|
456
|
+
/**
|
|
457
|
+
* Provider-specific options.
|
|
458
|
+
*/
|
|
459
|
+
providerOptions?: SharedV3ProviderOptions;
|
|
460
|
+
} | {
|
|
461
|
+
/**
|
|
462
|
+
* Type when the user has denied the execution of the tool call.
|
|
463
|
+
*/
|
|
464
|
+
type: 'execution-denied';
|
|
465
|
+
/**
|
|
466
|
+
* Optional reason for the execution denial.
|
|
467
|
+
*/
|
|
468
|
+
reason?: string;
|
|
469
|
+
/**
|
|
470
|
+
* Provider-specific options.
|
|
471
|
+
*/
|
|
472
|
+
providerOptions?: SharedV3ProviderOptions;
|
|
473
|
+
} | {
|
|
474
|
+
type: 'error-text';
|
|
475
|
+
value: string;
|
|
476
|
+
/**
|
|
477
|
+
* Provider-specific options.
|
|
478
|
+
*/
|
|
479
|
+
providerOptions?: SharedV3ProviderOptions;
|
|
480
|
+
} | {
|
|
481
|
+
type: 'error-json';
|
|
482
|
+
value: JSONValue$1;
|
|
483
|
+
/**
|
|
484
|
+
* Provider-specific options.
|
|
485
|
+
*/
|
|
486
|
+
providerOptions?: SharedV3ProviderOptions;
|
|
487
|
+
} | {
|
|
488
|
+
type: 'content';
|
|
489
|
+
value: Array<{
|
|
490
|
+
type: 'text';
|
|
491
|
+
/**
|
|
492
|
+
* Text content.
|
|
493
|
+
*/
|
|
494
|
+
text: string;
|
|
495
|
+
/**
|
|
496
|
+
* Provider-specific options.
|
|
497
|
+
*/
|
|
498
|
+
providerOptions?: SharedV3ProviderOptions;
|
|
499
|
+
} | {
|
|
500
|
+
type: 'file-data';
|
|
501
|
+
/**
|
|
502
|
+
* Base-64 encoded media data.
|
|
503
|
+
*/
|
|
504
|
+
data: string;
|
|
505
|
+
/**
|
|
506
|
+
* IANA media type.
|
|
507
|
+
* @see https://www.iana.org/assignments/media-types/media-types.xhtml
|
|
508
|
+
*/
|
|
509
|
+
mediaType: string;
|
|
510
|
+
/**
|
|
511
|
+
* Optional filename of the file.
|
|
512
|
+
*/
|
|
513
|
+
filename?: string;
|
|
514
|
+
/**
|
|
515
|
+
* Provider-specific options.
|
|
516
|
+
*/
|
|
517
|
+
providerOptions?: SharedV3ProviderOptions;
|
|
518
|
+
} | {
|
|
519
|
+
type: 'file-url';
|
|
520
|
+
/**
|
|
521
|
+
* URL of the file.
|
|
522
|
+
*/
|
|
523
|
+
url: string;
|
|
524
|
+
/**
|
|
525
|
+
* IANA media type.
|
|
526
|
+
* @see https://www.iana.org/assignments/media-types/media-types.xhtml
|
|
527
|
+
*/
|
|
528
|
+
mediaType?: string;
|
|
529
|
+
/**
|
|
530
|
+
* Provider-specific options.
|
|
531
|
+
*/
|
|
532
|
+
providerOptions?: SharedV3ProviderOptions;
|
|
533
|
+
} | {
|
|
534
|
+
type: 'file-id';
|
|
535
|
+
/**
|
|
536
|
+
* ID of the file.
|
|
537
|
+
*
|
|
538
|
+
* If you use multiple providers, you need to
|
|
539
|
+
* specify the provider specific ids using
|
|
540
|
+
* the Record option. The key is the provider
|
|
541
|
+
* name, e.g. 'openai' or 'anthropic'.
|
|
542
|
+
*/
|
|
543
|
+
fileId: string | Record<string, string>;
|
|
544
|
+
/**
|
|
545
|
+
* Provider-specific options.
|
|
546
|
+
*/
|
|
547
|
+
providerOptions?: SharedV3ProviderOptions;
|
|
548
|
+
} | {
|
|
549
|
+
/**
|
|
550
|
+
* Images that are referenced using base64 encoded data.
|
|
551
|
+
*/
|
|
552
|
+
type: 'image-data';
|
|
553
|
+
/**
|
|
554
|
+
* Base-64 encoded image data.
|
|
555
|
+
*/
|
|
556
|
+
data: string;
|
|
557
|
+
/**
|
|
558
|
+
* IANA media type.
|
|
559
|
+
* @see https://www.iana.org/assignments/media-types/media-types.xhtml
|
|
560
|
+
*/
|
|
561
|
+
mediaType: string;
|
|
562
|
+
/**
|
|
563
|
+
* Provider-specific options.
|
|
564
|
+
*/
|
|
565
|
+
providerOptions?: SharedV3ProviderOptions;
|
|
566
|
+
} | {
|
|
567
|
+
/**
|
|
568
|
+
* Images that are referenced using a URL.
|
|
569
|
+
*/
|
|
570
|
+
type: 'image-url';
|
|
571
|
+
/**
|
|
572
|
+
* URL of the image.
|
|
573
|
+
*/
|
|
574
|
+
url: string;
|
|
575
|
+
/**
|
|
576
|
+
* Provider-specific options.
|
|
577
|
+
*/
|
|
578
|
+
providerOptions?: SharedV3ProviderOptions;
|
|
579
|
+
} | {
|
|
580
|
+
/**
|
|
581
|
+
* Images that are referenced using a provider file id.
|
|
582
|
+
*/
|
|
583
|
+
type: 'image-file-id';
|
|
584
|
+
/**
|
|
585
|
+
* Image that is referenced using a provider file id.
|
|
586
|
+
*
|
|
587
|
+
* If you use multiple providers, you need to
|
|
588
|
+
* specify the provider specific ids using
|
|
589
|
+
* the Record option. The key is the provider
|
|
590
|
+
* name, e.g. 'openai' or 'anthropic'.
|
|
591
|
+
*/
|
|
592
|
+
fileId: string | Record<string, string>;
|
|
593
|
+
/**
|
|
594
|
+
* Provider-specific options.
|
|
595
|
+
*/
|
|
596
|
+
providerOptions?: SharedV3ProviderOptions;
|
|
597
|
+
} | {
|
|
598
|
+
/**
|
|
599
|
+
* Custom content part. This can be used to implement
|
|
600
|
+
* provider-specific content parts.
|
|
601
|
+
*/
|
|
602
|
+
type: 'custom';
|
|
603
|
+
/**
|
|
604
|
+
* Provider-specific options.
|
|
605
|
+
*/
|
|
606
|
+
providerOptions?: SharedV3ProviderOptions;
|
|
607
|
+
}>;
|
|
608
|
+
};
|
|
609
|
+
|
|
610
|
+
/**
|
|
611
|
+
* The configuration of a provider tool.
|
|
612
|
+
*
|
|
613
|
+
* Provider tools are tools that are specific to a certain provider.
|
|
614
|
+
* The input and output schemas are defined be the provider, and
|
|
615
|
+
* some of the tools are also executed on the provider systems.
|
|
616
|
+
*/
|
|
617
|
+
type LanguageModelV3ProviderTool = {
|
|
618
|
+
/**
|
|
619
|
+
* The type of the tool (always 'provider').
|
|
620
|
+
*/
|
|
621
|
+
type: 'provider';
|
|
622
|
+
/**
|
|
623
|
+
* The ID of the tool. Should follow the format `<provider-id>.<unique-tool-name>`.
|
|
624
|
+
*/
|
|
625
|
+
id: `${string}.${string}`;
|
|
626
|
+
/**
|
|
627
|
+
* The name of the tool. Unique within this model call.
|
|
628
|
+
*/
|
|
629
|
+
name: string;
|
|
630
|
+
/**
|
|
631
|
+
* The arguments for configuring the tool. Must match the expected arguments defined by the provider for this tool.
|
|
632
|
+
*/
|
|
633
|
+
args: Record<string, unknown>;
|
|
634
|
+
};
|
|
635
|
+
|
|
636
|
+
type LanguageModelV3ToolChoice = {
|
|
637
|
+
type: 'auto';
|
|
638
|
+
} | {
|
|
639
|
+
type: 'none';
|
|
640
|
+
} | {
|
|
641
|
+
type: 'required';
|
|
642
|
+
} | {
|
|
643
|
+
type: 'tool';
|
|
644
|
+
toolName: string;
|
|
645
|
+
};
|
|
646
|
+
|
|
647
|
+
type LanguageModelV3CallOptions = {
|
|
648
|
+
/**
|
|
649
|
+
* A language mode prompt is a standardized prompt type.
|
|
650
|
+
*
|
|
651
|
+
* Note: This is **not** the user-facing prompt. The AI SDK methods will map the
|
|
652
|
+
* user-facing prompt types such as chat or instruction prompts to this format.
|
|
653
|
+
* That approach allows us to evolve the user facing prompts without breaking
|
|
654
|
+
* the language model interface.
|
|
655
|
+
*/
|
|
656
|
+
prompt: LanguageModelV3Prompt;
|
|
657
|
+
/**
|
|
658
|
+
* Maximum number of tokens to generate.
|
|
659
|
+
*/
|
|
660
|
+
maxOutputTokens?: number;
|
|
661
|
+
/**
|
|
662
|
+
* Temperature setting. The range depends on the provider and model.
|
|
663
|
+
*/
|
|
664
|
+
temperature?: number;
|
|
665
|
+
/**
|
|
666
|
+
* Stop sequences.
|
|
667
|
+
* If set, the model will stop generating text when one of the stop sequences is generated.
|
|
668
|
+
* Providers may have limits on the number of stop sequences.
|
|
669
|
+
*/
|
|
670
|
+
stopSequences?: string[];
|
|
671
|
+
/**
|
|
672
|
+
* Nucleus sampling.
|
|
673
|
+
*/
|
|
674
|
+
topP?: number;
|
|
675
|
+
/**
|
|
676
|
+
* Only sample from the top K options for each subsequent token.
|
|
677
|
+
*
|
|
678
|
+
* Used to remove "long tail" low probability responses.
|
|
679
|
+
* Recommended for advanced use cases only. You usually only need to use temperature.
|
|
680
|
+
*/
|
|
681
|
+
topK?: number;
|
|
682
|
+
/**
|
|
683
|
+
* Presence penalty setting. It affects the likelihood of the model to
|
|
684
|
+
* repeat information that is already in the prompt.
|
|
685
|
+
*/
|
|
686
|
+
presencePenalty?: number;
|
|
687
|
+
/**
|
|
688
|
+
* Frequency penalty setting. It affects the likelihood of the model
|
|
689
|
+
* to repeatedly use the same words or phrases.
|
|
690
|
+
*/
|
|
691
|
+
frequencyPenalty?: number;
|
|
692
|
+
/**
|
|
693
|
+
* Response format. The output can either be text or JSON. Default is text.
|
|
694
|
+
*
|
|
695
|
+
* If JSON is selected, a schema can optionally be provided to guide the LLM.
|
|
696
|
+
*/
|
|
697
|
+
responseFormat?: {
|
|
698
|
+
type: 'text';
|
|
699
|
+
} | {
|
|
700
|
+
type: 'json';
|
|
701
|
+
/**
|
|
702
|
+
* JSON schema that the generated output should conform to.
|
|
703
|
+
*/
|
|
704
|
+
schema?: JSONSchema7;
|
|
705
|
+
/**
|
|
706
|
+
* Name of output that should be generated. Used by some providers for additional LLM guidance.
|
|
707
|
+
*/
|
|
708
|
+
name?: string;
|
|
709
|
+
/**
|
|
710
|
+
* Description of the output that should be generated. Used by some providers for additional LLM guidance.
|
|
711
|
+
*/
|
|
712
|
+
description?: string;
|
|
713
|
+
};
|
|
714
|
+
/**
|
|
715
|
+
* The seed (integer) to use for random sampling. If set and supported
|
|
716
|
+
* by the model, calls will generate deterministic results.
|
|
717
|
+
*/
|
|
718
|
+
seed?: number;
|
|
719
|
+
/**
|
|
720
|
+
* The tools that are available for the model.
|
|
721
|
+
*/
|
|
722
|
+
tools?: Array<LanguageModelV3FunctionTool | LanguageModelV3ProviderTool>;
|
|
723
|
+
/**
|
|
724
|
+
* Specifies how the tool should be selected. Defaults to 'auto'.
|
|
725
|
+
*/
|
|
726
|
+
toolChoice?: LanguageModelV3ToolChoice;
|
|
727
|
+
/**
|
|
728
|
+
* Include raw chunks in the stream. Only applicable for streaming calls.
|
|
729
|
+
*/
|
|
730
|
+
includeRawChunks?: boolean;
|
|
731
|
+
/**
|
|
732
|
+
* Abort signal for cancelling the operation.
|
|
733
|
+
*/
|
|
734
|
+
abortSignal?: AbortSignal;
|
|
735
|
+
/**
|
|
736
|
+
* Additional HTTP headers to be sent with the request.
|
|
737
|
+
* Only applicable for HTTP-based providers.
|
|
738
|
+
*/
|
|
739
|
+
headers?: Record<string, string | undefined>;
|
|
740
|
+
/**
|
|
741
|
+
* Additional provider-specific options. They are passed through
|
|
742
|
+
* to the provider from the AI SDK and enable provider-specific
|
|
743
|
+
* functionality that can be fully encapsulated in the provider.
|
|
744
|
+
*/
|
|
745
|
+
providerOptions?: SharedV3ProviderOptions;
|
|
746
|
+
};
|
|
747
|
+
|
|
13
748
|
/** Default provider name used as key in `providerOptions` and `providerMetadata` objects. */
|
|
14
749
|
declare const SAP_AI_PROVIDER_NAME: "sap-ai";
|
|
15
750
|
/**
|
|
@@ -20,7 +755,8 @@ declare const SAP_AI_PROVIDER_NAME: "sap-ai";
|
|
|
20
755
|
declare function getProviderName(providerIdentifier: string): string;
|
|
21
756
|
/** @internal */
|
|
22
757
|
declare const sapAILanguageModelProviderOptions: _ai_sdk_provider_utils.LazySchema<{
|
|
23
|
-
api?: "orchestration" | "foundation-models" | undefined;
|
|
758
|
+
api?: "orchestration" | "foundation-models" | "responses" | undefined;
|
|
759
|
+
dropUnsupportedParams?: boolean | undefined;
|
|
24
760
|
escapeTemplatePlaceholders?: boolean | undefined;
|
|
25
761
|
includeReasoning?: boolean | undefined;
|
|
26
762
|
modelParams?: {
|
|
@@ -52,12 +788,15 @@ declare const sapAILanguageModelProviderOptions: _ai_sdk_provider_utils.LazySche
|
|
|
52
788
|
version: string;
|
|
53
789
|
scope?: "tenant" | "resource_group" | undefined;
|
|
54
790
|
} | undefined;
|
|
791
|
+
responses?: (JSONObject$1 & {
|
|
792
|
+
readonly metadata?: null | Record<string, string>;
|
|
793
|
+
}) | undefined;
|
|
55
794
|
}>;
|
|
56
795
|
/** @internal */
|
|
57
796
|
type SAPAILanguageModelProviderOptions = InferSchema<typeof sapAILanguageModelProviderOptions>;
|
|
58
797
|
/** @internal */
|
|
59
798
|
declare const sapAIEmbeddingProviderOptions: _ai_sdk_provider_utils.LazySchema<{
|
|
60
|
-
api?: "orchestration" | "foundation-models" | undefined;
|
|
799
|
+
api?: "orchestration" | "foundation-models" | "responses" | undefined;
|
|
61
800
|
modelParams?: {
|
|
62
801
|
[x: string]: unknown;
|
|
63
802
|
dimensions?: number | undefined;
|
|
@@ -88,173 +827,6 @@ declare function escapeOrchestrationPlaceholders(text: string): string;
|
|
|
88
827
|
*/
|
|
89
828
|
declare function unescapeOrchestrationPlaceholders(text: string): string;
|
|
90
829
|
|
|
91
|
-
// ==================================================================================================
|
|
92
|
-
// JSON Schema Draft 07
|
|
93
|
-
// ==================================================================================================
|
|
94
|
-
// https://tools.ietf.org/html/draft-handrews-json-schema-validation-01
|
|
95
|
-
// --------------------------------------------------------------------------------------------------
|
|
96
|
-
|
|
97
|
-
/**
|
|
98
|
-
* Primitive type
|
|
99
|
-
* @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-6.1.1
|
|
100
|
-
*/
|
|
101
|
-
type JSONSchema7TypeName =
|
|
102
|
-
| "string" //
|
|
103
|
-
| "number"
|
|
104
|
-
| "integer"
|
|
105
|
-
| "boolean"
|
|
106
|
-
| "object"
|
|
107
|
-
| "array"
|
|
108
|
-
| "null";
|
|
109
|
-
|
|
110
|
-
/**
|
|
111
|
-
* Primitive type
|
|
112
|
-
* @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-6.1.1
|
|
113
|
-
*/
|
|
114
|
-
type JSONSchema7Type =
|
|
115
|
-
| string //
|
|
116
|
-
| number
|
|
117
|
-
| boolean
|
|
118
|
-
| JSONSchema7Object
|
|
119
|
-
| JSONSchema7Array
|
|
120
|
-
| null;
|
|
121
|
-
|
|
122
|
-
// Workaround for infinite type recursion
|
|
123
|
-
interface JSONSchema7Object {
|
|
124
|
-
[key: string]: JSONSchema7Type;
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
// Workaround for infinite type recursion
|
|
128
|
-
// https://github.com/Microsoft/TypeScript/issues/3496#issuecomment-128553540
|
|
129
|
-
interface JSONSchema7Array extends Array<JSONSchema7Type> {}
|
|
130
|
-
|
|
131
|
-
/**
|
|
132
|
-
* Meta schema
|
|
133
|
-
*
|
|
134
|
-
* Recommended values:
|
|
135
|
-
* - 'http://json-schema.org/schema#'
|
|
136
|
-
* - 'http://json-schema.org/hyper-schema#'
|
|
137
|
-
* - 'http://json-schema.org/draft-07/schema#'
|
|
138
|
-
* - 'http://json-schema.org/draft-07/hyper-schema#'
|
|
139
|
-
*
|
|
140
|
-
* @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-5
|
|
141
|
-
*/
|
|
142
|
-
type JSONSchema7Version = string;
|
|
143
|
-
|
|
144
|
-
/**
|
|
145
|
-
* JSON Schema v7
|
|
146
|
-
* @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01
|
|
147
|
-
*/
|
|
148
|
-
type JSONSchema7Definition = JSONSchema7 | boolean;
|
|
149
|
-
interface JSONSchema7 {
|
|
150
|
-
$id?: string | undefined;
|
|
151
|
-
$ref?: string | undefined;
|
|
152
|
-
$schema?: JSONSchema7Version | undefined;
|
|
153
|
-
$comment?: string | undefined;
|
|
154
|
-
|
|
155
|
-
/**
|
|
156
|
-
* @see https://datatracker.ietf.org/doc/html/draft-bhutton-json-schema-00#section-8.2.4
|
|
157
|
-
* @see https://datatracker.ietf.org/doc/html/draft-bhutton-json-schema-validation-00#appendix-A
|
|
158
|
-
*/
|
|
159
|
-
$defs?: {
|
|
160
|
-
[key: string]: JSONSchema7Definition;
|
|
161
|
-
} | undefined;
|
|
162
|
-
|
|
163
|
-
/**
|
|
164
|
-
* @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-6.1
|
|
165
|
-
*/
|
|
166
|
-
type?: JSONSchema7TypeName | JSONSchema7TypeName[] | undefined;
|
|
167
|
-
enum?: JSONSchema7Type[] | undefined;
|
|
168
|
-
const?: JSONSchema7Type | undefined;
|
|
169
|
-
|
|
170
|
-
/**
|
|
171
|
-
* @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-6.2
|
|
172
|
-
*/
|
|
173
|
-
multipleOf?: number | undefined;
|
|
174
|
-
maximum?: number | undefined;
|
|
175
|
-
exclusiveMaximum?: number | undefined;
|
|
176
|
-
minimum?: number | undefined;
|
|
177
|
-
exclusiveMinimum?: number | undefined;
|
|
178
|
-
|
|
179
|
-
/**
|
|
180
|
-
* @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-6.3
|
|
181
|
-
*/
|
|
182
|
-
maxLength?: number | undefined;
|
|
183
|
-
minLength?: number | undefined;
|
|
184
|
-
pattern?: string | undefined;
|
|
185
|
-
|
|
186
|
-
/**
|
|
187
|
-
* @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-6.4
|
|
188
|
-
*/
|
|
189
|
-
items?: JSONSchema7Definition | JSONSchema7Definition[] | undefined;
|
|
190
|
-
additionalItems?: JSONSchema7Definition | undefined;
|
|
191
|
-
maxItems?: number | undefined;
|
|
192
|
-
minItems?: number | undefined;
|
|
193
|
-
uniqueItems?: boolean | undefined;
|
|
194
|
-
contains?: JSONSchema7Definition | undefined;
|
|
195
|
-
|
|
196
|
-
/**
|
|
197
|
-
* @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-6.5
|
|
198
|
-
*/
|
|
199
|
-
maxProperties?: number | undefined;
|
|
200
|
-
minProperties?: number | undefined;
|
|
201
|
-
required?: string[] | undefined;
|
|
202
|
-
properties?: {
|
|
203
|
-
[key: string]: JSONSchema7Definition;
|
|
204
|
-
} | undefined;
|
|
205
|
-
patternProperties?: {
|
|
206
|
-
[key: string]: JSONSchema7Definition;
|
|
207
|
-
} | undefined;
|
|
208
|
-
additionalProperties?: JSONSchema7Definition | undefined;
|
|
209
|
-
dependencies?: {
|
|
210
|
-
[key: string]: JSONSchema7Definition | string[];
|
|
211
|
-
} | undefined;
|
|
212
|
-
propertyNames?: JSONSchema7Definition | undefined;
|
|
213
|
-
|
|
214
|
-
/**
|
|
215
|
-
* @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-6.6
|
|
216
|
-
*/
|
|
217
|
-
if?: JSONSchema7Definition | undefined;
|
|
218
|
-
then?: JSONSchema7Definition | undefined;
|
|
219
|
-
else?: JSONSchema7Definition | undefined;
|
|
220
|
-
|
|
221
|
-
/**
|
|
222
|
-
* @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-6.7
|
|
223
|
-
*/
|
|
224
|
-
allOf?: JSONSchema7Definition[] | undefined;
|
|
225
|
-
anyOf?: JSONSchema7Definition[] | undefined;
|
|
226
|
-
oneOf?: JSONSchema7Definition[] | undefined;
|
|
227
|
-
not?: JSONSchema7Definition | undefined;
|
|
228
|
-
|
|
229
|
-
/**
|
|
230
|
-
* @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-7
|
|
231
|
-
*/
|
|
232
|
-
format?: string | undefined;
|
|
233
|
-
|
|
234
|
-
/**
|
|
235
|
-
* @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-8
|
|
236
|
-
*/
|
|
237
|
-
contentMediaType?: string | undefined;
|
|
238
|
-
contentEncoding?: string | undefined;
|
|
239
|
-
|
|
240
|
-
/**
|
|
241
|
-
* @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-9
|
|
242
|
-
*/
|
|
243
|
-
definitions?: {
|
|
244
|
-
[key: string]: JSONSchema7Definition;
|
|
245
|
-
} | undefined;
|
|
246
|
-
|
|
247
|
-
/**
|
|
248
|
-
* @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-10
|
|
249
|
-
*/
|
|
250
|
-
title?: string | undefined;
|
|
251
|
-
description?: string | undefined;
|
|
252
|
-
default?: JSONSchema7Type | undefined;
|
|
253
|
-
readOnly?: boolean | undefined;
|
|
254
|
-
writeOnly?: boolean | undefined;
|
|
255
|
-
examples?: JSONSchema7Type | undefined;
|
|
256
|
-
}
|
|
257
|
-
|
|
258
830
|
type SharedV2Headers = Record<string, string>;
|
|
259
831
|
|
|
260
832
|
/**
|
|
@@ -682,6 +1254,13 @@ interface LanguageModelV2FilePart {
|
|
|
682
1254
|
*/
|
|
683
1255
|
data: LanguageModelV2DataContent;
|
|
684
1256
|
/**
|
|
1257
|
+
* The original URL string before it was parsed into a `URL`.
|
|
1258
|
+
*
|
|
1259
|
+
* This is available when parsing would change the string and a provider
|
|
1260
|
+
* needs to preserve an opaque non-HTTP URI exactly.
|
|
1261
|
+
*/
|
|
1262
|
+
originalUrl?: string;
|
|
1263
|
+
/**
|
|
685
1264
|
IANA media type of the file.
|
|
686
1265
|
|
|
687
1266
|
Can support wildcards, e.g. `image/*` (in which case the provider needs to take appropriate action).
|
|
@@ -1680,7 +2259,7 @@ interface ProviderV2 {
|
|
|
1680
2259
|
/** Azure OpenAI chat extension configuration for "On Your Data" RAG scenarios. */
|
|
1681
2260
|
type AzureOpenAiChatExtensionConfiguration = NonNullable<AzureOpenAiChatCompletionParameters["data_sources"]>[number];
|
|
1682
2261
|
/**
|
|
1683
|
-
* Common model parameters shared between
|
|
2262
|
+
* Common model parameters shared between APIs.
|
|
1684
2263
|
*
|
|
1685
2264
|
* Known parameters are validated by Zod in constructor settings and per-call
|
|
1686
2265
|
* `modelParams` provider options; additional model-specific keys are passed through.
|
|
@@ -1768,6 +2347,12 @@ type OrchestrationModelParams = CommonModelParams;
|
|
|
1768
2347
|
/** Model settings when using Orchestration API with filtering, grounding, masking, and translation. */
|
|
1769
2348
|
interface OrchestrationModelSettings {
|
|
1770
2349
|
readonly api?: "orchestration";
|
|
2350
|
+
/**
|
|
2351
|
+
* Whether Orchestration drops parameters unsupported by Responses-only models.
|
|
2352
|
+
* Applies to the primary local model, not fallback models or stored configurations.
|
|
2353
|
+
* Omitted values retain the SAP service default; false requests an explicit error.
|
|
2354
|
+
*/
|
|
2355
|
+
readonly dropUnsupportedParams?: boolean;
|
|
1771
2356
|
/** @default true */
|
|
1772
2357
|
readonly escapeTemplatePlaceholders?: boolean;
|
|
1773
2358
|
/**
|
|
@@ -1862,15 +2447,33 @@ interface PromptTemplateRefByScenarioNameVersion {
|
|
|
1862
2447
|
type PromptTemplateScope = "resource_group" | "tenant";
|
|
1863
2448
|
/** Response format for structured output (OpenAI-compatible). */
|
|
1864
2449
|
type ResponseFormat = AzureOpenAiChatCompletionParameters["response_format"];
|
|
2450
|
+
/** Default settings configuration when using the Responses API. */
|
|
2451
|
+
interface ResponsesDefaultSettings {
|
|
2452
|
+
readonly api: "responses";
|
|
2453
|
+
readonly settings?: ResponsesModelSettings;
|
|
2454
|
+
}
|
|
2455
|
+
/** Model-specific Responses API options, validated by the OpenAI provider. */
|
|
2456
|
+
type ResponsesModelOptions = Omit<OpenAIResponsesProviderOptions, "metadata"> & {
|
|
2457
|
+
readonly metadata?: null | Record<string, string>;
|
|
2458
|
+
};
|
|
2459
|
+
/** Model settings for the OpenAI Responses API through SAP AI Core. */
|
|
2460
|
+
interface ResponsesModelSettings {
|
|
2461
|
+
readonly api: "responses";
|
|
2462
|
+
readonly modelParams?: CommonModelParams;
|
|
2463
|
+
readonly modelVersion?: string;
|
|
2464
|
+
readonly responseFormat?: ResponseFormat;
|
|
2465
|
+
readonly responses?: ResponsesModelOptions;
|
|
2466
|
+
}
|
|
1865
2467
|
/**
|
|
1866
2468
|
* Supported API types for SAP AI Core.
|
|
1867
2469
|
*
|
|
1868
2470
|
* - `'orchestration'` - Full-featured API with data masking, content filtering, document grounding, and translation.
|
|
1869
2471
|
* - `'foundation-models'` - Direct model access with Azure OpenAI-specific parameters like `logprobs`, `seed`, and `dataSources`.
|
|
2472
|
+
* - `'responses'` - OpenAI Responses API with native reasoning and tool-call history.
|
|
1870
2473
|
*/
|
|
1871
|
-
type SAPAIApiType = "foundation-models" | "orchestration";
|
|
2474
|
+
type SAPAIApiType = "foundation-models" | "orchestration" | "responses";
|
|
1872
2475
|
/** Union type for API-specific default settings configuration. */
|
|
1873
|
-
type SAPAIDefaultSettingsConfig = FoundationModelsDefaultSettings | OrchestrationDefaultSettings;
|
|
2476
|
+
type SAPAIDefaultSettingsConfig = FoundationModelsDefaultSettings | OrchestrationDefaultSettings | ResponsesDefaultSettings;
|
|
1874
2477
|
/** Settings for the SAP AI Embedding Model. */
|
|
1875
2478
|
interface SAPAIEmbeddingSettings {
|
|
1876
2479
|
readonly api?: SAPAIApiType;
|
|
@@ -1901,20 +2504,23 @@ interface SAPAIEmbeddingSettings {
|
|
|
1901
2504
|
*/
|
|
1902
2505
|
type SAPAIModelId = ChatModel;
|
|
1903
2506
|
/**
|
|
1904
|
-
* Union type for model settings
|
|
2507
|
+
* Union type for API-specific model settings.
|
|
1905
2508
|
*
|
|
1906
2509
|
* Use `FoundationModelsModelSettings` for Foundation Models API features (dataSources, logprobs, seed).
|
|
1907
2510
|
* Use `OrchestrationModelSettings` for Orchestration API features (filtering, grounding, masking, translation).
|
|
2511
|
+
* Use `ResponsesModelSettings` for native OpenAI Responses options and reasoning history.
|
|
1908
2512
|
*/
|
|
1909
|
-
type SAPAIModelSettings = FoundationModelsModelSettings | OrchestrationModelSettings;
|
|
2513
|
+
type SAPAIModelSettings = FoundationModelsModelSettings | OrchestrationModelSettings | ResponsesModelSettings;
|
|
1910
2514
|
|
|
1911
2515
|
/**
|
|
1912
2516
|
* Settings for configuring SAP AI Core model behavior.
|
|
1913
|
-
* Legacy interface maintained for backward compatibility
|
|
1914
|
-
*
|
|
2517
|
+
* Legacy interface maintained for backward compatibility. Prefer the API-specific
|
|
2518
|
+
* OrchestrationModelSettings, FoundationModelsModelSettings, or ResponsesModelSettings types.
|
|
1915
2519
|
*/
|
|
1916
2520
|
interface SAPAISettings {
|
|
1917
2521
|
readonly api?: SAPAIApiType;
|
|
2522
|
+
/** Orchestration API only; controls unsupported parameters on the primary local model. */
|
|
2523
|
+
readonly dropUnsupportedParams?: boolean;
|
|
1918
2524
|
/** @default true */
|
|
1919
2525
|
readonly escapeTemplatePlaceholders?: boolean;
|
|
1920
2526
|
/** Orchestration API only. */
|
|
@@ -1941,6 +2547,8 @@ interface SAPAISettings {
|
|
|
1941
2547
|
/** Orchestration API only. */
|
|
1942
2548
|
readonly promptTemplateRef?: PromptTemplateRef;
|
|
1943
2549
|
readonly responseFormat?: ResponseFormat;
|
|
2550
|
+
/** Responses API only. */
|
|
2551
|
+
readonly responses?: ResponsesModelOptions;
|
|
1944
2552
|
/** Orchestration API only; ignored when `orchestrationConfigRef` is used. */
|
|
1945
2553
|
readonly streamOptions?: OrchestrationStreamOptions;
|
|
1946
2554
|
/** Orchestration API only. */
|
|
@@ -2122,7 +2730,7 @@ type ConvertedV2Warning = Extract<LanguageModelV2CallWarning, {
|
|
|
2122
2730
|
* SAP AI Language Model V2 - Vercel AI SDK LanguageModelV2 implementation for SAP AI Core.
|
|
2123
2731
|
*
|
|
2124
2732
|
* This module provides the language model implementation that connects to SAP AI Core
|
|
2125
|
-
* services (Orchestration
|
|
2733
|
+
* services (Orchestration, Foundation Models Chat Completions, or OpenAI Responses) for text generation.
|
|
2126
2734
|
* @see {@link https://sdk.vercel.ai/docs/reference/ai-sdk-core/generate-text | Vercel AI SDK generateText()}
|
|
2127
2735
|
* @see {@link https://sdk.vercel.ai/docs/reference/ai-sdk-core/stream-text | Vercel AI SDK streamText()}
|
|
2128
2736
|
*/
|
|
@@ -2142,8 +2750,9 @@ interface SAPAILanguageModelV2Config {
|
|
|
2142
2750
|
* SAP AI Language Model implementing Vercel AI SDK LanguageModelV2.
|
|
2143
2751
|
*
|
|
2144
2752
|
* This class provides chat completion and streaming capabilities through SAP AI Core,
|
|
2145
|
-
* supporting
|
|
2146
|
-
* and translation)
|
|
2753
|
+
* supporting the Orchestration API (with content filtering, grounding, masking,
|
|
2754
|
+
* and translation), Foundation Models Chat Completions, and native OpenAI Responses
|
|
2755
|
+
* through SAP AI Core.
|
|
2147
2756
|
*
|
|
2148
2757
|
* Users typically don't instantiate this class directly. Instead, use the
|
|
2149
2758
|
* {@link createSAPAIProvider} factory function:
|
|
@@ -2226,6 +2835,7 @@ interface SAPAIProviderSettings {
|
|
|
2226
2835
|
* This option does not enable automatic failover between APIs.
|
|
2227
2836
|
* - `'orchestration'` (default): SAP AI Core Orchestration API - supports filtering, grounding, masking, translation
|
|
2228
2837
|
* - `'foundation-models'`: SAP AI Core Foundation Models API - supports dataSources, logprobs, seed, etc.
|
|
2838
|
+
* - `'responses'`: OpenAI Responses API through SAP AI Core - supports reasoning and tool-call history
|
|
2229
2839
|
* @default 'orchestration'
|
|
2230
2840
|
*/
|
|
2231
2841
|
readonly api?: SAPAIApiType;
|
|
@@ -2289,11 +2899,11 @@ interface SAPAIProviderV2 extends ProviderV2 {
|
|
|
2289
2899
|
* Creates an SAP AI Provider V2 instance for use with AI SDK 5.
|
|
2290
2900
|
* AI SDK 6 can also consume this provider through its V2 compatibility layer.
|
|
2291
2901
|
*
|
|
2292
|
-
* Uses
|
|
2293
|
-
*
|
|
2294
|
-
* (VCAP_SERVICES on SAP BTP) or AICORE_SERVICE_KEY environment variable.
|
|
2902
|
+
* Uses SAP AI SDK clients for Orchestration and Foundation Models, and its HTTP
|
|
2903
|
+
* transport with the OpenAI provider for Responses. Authentication uses a service
|
|
2904
|
+
* binding (VCAP_SERVICES on SAP BTP) or the AICORE_SERVICE_KEY environment variable.
|
|
2295
2905
|
* @param options - Provider configuration options.
|
|
2296
|
-
* @param options.api - Default API type: `'orchestration'` (default)
|
|
2906
|
+
* @param options.api - Default API type: `'orchestration'` (default), `'foundation-models'`, or `'responses'`.
|
|
2297
2907
|
* @param options.defaultSettings - Default model settings applied to every model instance.
|
|
2298
2908
|
* @param options.deploymentId - Explicit SAP AI Core deployment ID; omit for automatic deployment resolution.
|
|
2299
2909
|
* @param options.destination - Custom SAP Cloud SDK destination configuration.
|
|
@@ -2335,10 +2945,12 @@ interface ValidateSettingsOptions {
|
|
|
2335
2945
|
readonly embeddingSettings?: SAPAIEmbeddingSettings;
|
|
2336
2946
|
readonly invocationSettings?: {
|
|
2337
2947
|
readonly api?: SAPAIApiType;
|
|
2948
|
+
readonly dropUnsupportedParams?: boolean;
|
|
2338
2949
|
readonly escapeTemplatePlaceholders?: boolean;
|
|
2339
2950
|
readonly orchestrationConfigRef?: unknown;
|
|
2340
2951
|
readonly placeholderValues?: unknown;
|
|
2341
2952
|
readonly promptTemplateRef?: unknown;
|
|
2953
|
+
readonly responses?: unknown;
|
|
2342
2954
|
};
|
|
2343
2955
|
readonly modelApi?: SAPAIApiType;
|
|
2344
2956
|
readonly modelSettings?: SAPAIModelSettings | SAPAISettings;
|
|
@@ -2375,4 +2987,5 @@ declare function validateSettings(options: ValidateSettingsOptions): void;
|
|
|
2375
2987
|
/** Current package version from package.json, injected at build time. */
|
|
2376
2988
|
declare const VERSION: string;
|
|
2377
2989
|
|
|
2378
|
-
export { ApiSwitchError,
|
|
2990
|
+
export { ApiSwitchError, SAPAIEmbeddingModelV2 as SAPAIEmbeddingModel, SAPAILanguageModelV2 as SAPAILanguageModel, SAP_AI_PROVIDER_NAME, UnsupportedFeatureError, VERSION, createSAPAIProvider, escapeOrchestrationPlaceholders, getProviderName, resolveApi, sapAIEmbeddingProviderOptions, sapAILanguageModelProviderOptions, sapai, unescapeOrchestrationPlaceholders, validateSettings };
|
|
2991
|
+
export type { AzureOpenAiChatExtensionConfiguration, CommonModelParams, DeploymentConfig, FoundationModelsDefaultSettings, FoundationModelsEmbeddingParams, FoundationModelsModelParams, FoundationModelsModelSettings, JSONArray, JSONObject, JSONSchema7, JSONValue, LanguageModelV2ResponseMetadata, LanguageModelV3CallOptions, OrchestrationDefaultSettings, OrchestrationModelParams, OrchestrationModelSettings, OrchestrationStreamOptions, PromptTemplateRef, PromptTemplateRefByID, PromptTemplateRefByScenarioNameVersion, PromptTemplateScope, ResponseFormat, ResponsesDefaultSettings, ResponsesModelOptions, ResponsesModelSettings, SAPAIApiType, SAPAIDefaultSettingsConfig, SAPAIEmbeddingModelId, SAPAIEmbeddingProviderOptions, SAPAIEmbeddingSettings, SAPAILanguageModelProviderOptions, SAPAIModelId, SAPAIModelSettings, SAPAIProviderV2 as SAPAIProvider, SAPAIProviderSettings, SAPAISettings, JSONArray$1 as V3JSONArray, JSONObject$1 as V3JSONObject, JSONValue$1 as V3JSONValue };
|