@ai-sdk/provider 1.0.7 → 1.0.8
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/CHANGELOG.md +6 -0
- package/dist/index.d.mts +55 -22
- package/dist/index.d.ts +55 -22
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
package/dist/index.d.mts
CHANGED
@@ -441,6 +441,53 @@ declare function isJSONValue(value: unknown): value is JSONValue;
|
|
441
441
|
declare function isJSONArray(value: unknown): value is JSONArray;
|
442
442
|
declare function isJSONObject(value: unknown): value is JSONObject;
|
443
443
|
|
444
|
+
/**
|
445
|
+
* Additional provider-specific metadata. They are passed through
|
446
|
+
* to the provider from the AI SDK and enable provider-specific
|
447
|
+
* functionality that can be fully encapsulated in the provider.
|
448
|
+
*
|
449
|
+
* This enables us to quickly ship provider-specific functionality
|
450
|
+
* without affecting the core AI SDK.
|
451
|
+
*
|
452
|
+
* The outer record is keyed by the provider name, and the inner
|
453
|
+
* record is keyed by the provider-specific metadata key.
|
454
|
+
*
|
455
|
+
* ```ts
|
456
|
+
* {
|
457
|
+
* "anthropic": {
|
458
|
+
* "cacheControl": { "type": "ephemeral" }
|
459
|
+
* }
|
460
|
+
* }
|
461
|
+
* ```
|
462
|
+
*/
|
463
|
+
type LanguageModelV1ProviderMetadata = Record<string, Record<string, JSONValue>>;
|
464
|
+
|
465
|
+
/**
|
466
|
+
* A source that has been used as input to generate the response.
|
467
|
+
*/
|
468
|
+
type LanguageModelV1Source = {
|
469
|
+
/**
|
470
|
+
* A URL source. This is return by web search RAG models.
|
471
|
+
*/
|
472
|
+
sourceType: 'url';
|
473
|
+
/**
|
474
|
+
* The ID of the source.
|
475
|
+
*/
|
476
|
+
id: string;
|
477
|
+
/**
|
478
|
+
* The URL of the source.
|
479
|
+
*/
|
480
|
+
url: string;
|
481
|
+
/**
|
482
|
+
* The title of the source.
|
483
|
+
*/
|
484
|
+
title?: string;
|
485
|
+
/**
|
486
|
+
* Additional provider metadata for the source.
|
487
|
+
*/
|
488
|
+
providerMetadata?: LanguageModelV1ProviderMetadata;
|
489
|
+
};
|
490
|
+
|
444
491
|
type LanguageModelV1CallSettings = {
|
445
492
|
/**
|
446
493
|
Maximum number of tokens to generate.
|
@@ -546,27 +593,6 @@ type LanguageModelV1FunctionTool = {
|
|
546
593
|
parameters: JSONSchema7;
|
547
594
|
};
|
548
595
|
|
549
|
-
/**
|
550
|
-
* Additional provider-specific metadata. They are passed through
|
551
|
-
* to the provider from the AI SDK and enable provider-specific
|
552
|
-
* functionality that can be fully encapsulated in the provider.
|
553
|
-
*
|
554
|
-
* This enables us to quickly ship provider-specific functionality
|
555
|
-
* without affecting the core AI SDK.
|
556
|
-
*
|
557
|
-
* The outer record is keyed by the provider name, and the inner
|
558
|
-
* record is keyed by the provider-specific metadata key.
|
559
|
-
*
|
560
|
-
* ```ts
|
561
|
-
* {
|
562
|
-
* "anthropic": {
|
563
|
-
* "cacheControl": { "type": "ephemeral" }
|
564
|
-
* }
|
565
|
-
* }
|
566
|
-
* ```
|
567
|
-
*/
|
568
|
-
type LanguageModelV1ProviderMetadata = Record<string, Record<string, JSONValue>>;
|
569
|
-
|
570
596
|
/**
|
571
597
|
A prompt is a list of messages.
|
572
598
|
|
@@ -1032,6 +1058,10 @@ type LanguageModelV1 = {
|
|
1032
1058
|
*/
|
1033
1059
|
providerMetadata?: LanguageModelV1ProviderMetadata;
|
1034
1060
|
/**
|
1061
|
+
Sources that have been used as input to generate the response.
|
1062
|
+
*/
|
1063
|
+
sources?: LanguageModelV1Source[];
|
1064
|
+
/**
|
1035
1065
|
Logprobs for the completion.
|
1036
1066
|
`undefined` if the mode does not support logprobs or if was not enabled
|
1037
1067
|
|
@@ -1095,6 +1125,9 @@ type LanguageModelV1StreamPart = {
|
|
1095
1125
|
} | {
|
1096
1126
|
type: 'reasoning';
|
1097
1127
|
textDelta: string;
|
1128
|
+
} | {
|
1129
|
+
type: 'source';
|
1130
|
+
source: LanguageModelV1Source;
|
1098
1131
|
} | ({
|
1099
1132
|
type: 'tool-call';
|
1100
1133
|
} & LanguageModelV1FunctionToolCall) | {
|
@@ -1164,4 +1197,4 @@ interface ProviderV1 {
|
|
1164
1197
|
readonly imageModel?: (modelId: string) => ImageModelV1;
|
1165
1198
|
}
|
1166
1199
|
|
1167
|
-
export { AISDKError, APICallError, type EmbeddingModelV1, type EmbeddingModelV1Embedding, EmptyResponseBodyError, type ImageModelV1, type ImageModelV1CallOptions, type ImageModelV1CallWarning, InvalidArgumentError, InvalidPromptError, InvalidResponseDataError, type JSONArray, type JSONObject, JSONParseError, type JSONValue, type LanguageModelV1, type LanguageModelV1CallOptions, type LanguageModelV1CallWarning, type LanguageModelV1FilePart, type LanguageModelV1FinishReason, type LanguageModelV1FunctionTool, type LanguageModelV1FunctionToolCall, type LanguageModelV1ImagePart, type LanguageModelV1LogProbs, type LanguageModelV1Message, type LanguageModelV1ObjectGenerationMode, type LanguageModelV1Prompt, type LanguageModelV1ProviderDefinedTool, type LanguageModelV1ProviderMetadata, type LanguageModelV1StreamPart, type LanguageModelV1TextPart, type LanguageModelV1ToolCallPart, type LanguageModelV1ToolChoice, type LanguageModelV1ToolResultPart, LoadAPIKeyError, LoadSettingError, NoContentGeneratedError, NoSuchModelError, type ProviderV1, TooManyEmbeddingValuesForCallError, TypeValidationError, UnsupportedFunctionalityError, getErrorMessage, isJSONArray, isJSONObject, isJSONValue };
|
1200
|
+
export { AISDKError, APICallError, type EmbeddingModelV1, type EmbeddingModelV1Embedding, EmptyResponseBodyError, type ImageModelV1, type ImageModelV1CallOptions, type ImageModelV1CallWarning, InvalidArgumentError, InvalidPromptError, InvalidResponseDataError, type JSONArray, type JSONObject, JSONParseError, type JSONValue, type LanguageModelV1, type LanguageModelV1CallOptions, type LanguageModelV1CallWarning, type LanguageModelV1FilePart, type LanguageModelV1FinishReason, type LanguageModelV1FunctionTool, type LanguageModelV1FunctionToolCall, type LanguageModelV1ImagePart, type LanguageModelV1LogProbs, type LanguageModelV1Message, type LanguageModelV1ObjectGenerationMode, type LanguageModelV1Prompt, type LanguageModelV1ProviderDefinedTool, type LanguageModelV1ProviderMetadata, type LanguageModelV1Source, type LanguageModelV1StreamPart, type LanguageModelV1TextPart, type LanguageModelV1ToolCallPart, type LanguageModelV1ToolChoice, type LanguageModelV1ToolResultPart, LoadAPIKeyError, LoadSettingError, NoContentGeneratedError, NoSuchModelError, type ProviderV1, TooManyEmbeddingValuesForCallError, TypeValidationError, UnsupportedFunctionalityError, getErrorMessage, isJSONArray, isJSONObject, isJSONValue };
|
package/dist/index.d.ts
CHANGED
@@ -441,6 +441,53 @@ declare function isJSONValue(value: unknown): value is JSONValue;
|
|
441
441
|
declare function isJSONArray(value: unknown): value is JSONArray;
|
442
442
|
declare function isJSONObject(value: unknown): value is JSONObject;
|
443
443
|
|
444
|
+
/**
|
445
|
+
* Additional provider-specific metadata. They are passed through
|
446
|
+
* to the provider from the AI SDK and enable provider-specific
|
447
|
+
* functionality that can be fully encapsulated in the provider.
|
448
|
+
*
|
449
|
+
* This enables us to quickly ship provider-specific functionality
|
450
|
+
* without affecting the core AI SDK.
|
451
|
+
*
|
452
|
+
* The outer record is keyed by the provider name, and the inner
|
453
|
+
* record is keyed by the provider-specific metadata key.
|
454
|
+
*
|
455
|
+
* ```ts
|
456
|
+
* {
|
457
|
+
* "anthropic": {
|
458
|
+
* "cacheControl": { "type": "ephemeral" }
|
459
|
+
* }
|
460
|
+
* }
|
461
|
+
* ```
|
462
|
+
*/
|
463
|
+
type LanguageModelV1ProviderMetadata = Record<string, Record<string, JSONValue>>;
|
464
|
+
|
465
|
+
/**
|
466
|
+
* A source that has been used as input to generate the response.
|
467
|
+
*/
|
468
|
+
type LanguageModelV1Source = {
|
469
|
+
/**
|
470
|
+
* A URL source. This is return by web search RAG models.
|
471
|
+
*/
|
472
|
+
sourceType: 'url';
|
473
|
+
/**
|
474
|
+
* The ID of the source.
|
475
|
+
*/
|
476
|
+
id: string;
|
477
|
+
/**
|
478
|
+
* The URL of the source.
|
479
|
+
*/
|
480
|
+
url: string;
|
481
|
+
/**
|
482
|
+
* The title of the source.
|
483
|
+
*/
|
484
|
+
title?: string;
|
485
|
+
/**
|
486
|
+
* Additional provider metadata for the source.
|
487
|
+
*/
|
488
|
+
providerMetadata?: LanguageModelV1ProviderMetadata;
|
489
|
+
};
|
490
|
+
|
444
491
|
type LanguageModelV1CallSettings = {
|
445
492
|
/**
|
446
493
|
Maximum number of tokens to generate.
|
@@ -546,27 +593,6 @@ type LanguageModelV1FunctionTool = {
|
|
546
593
|
parameters: JSONSchema7;
|
547
594
|
};
|
548
595
|
|
549
|
-
/**
|
550
|
-
* Additional provider-specific metadata. They are passed through
|
551
|
-
* to the provider from the AI SDK and enable provider-specific
|
552
|
-
* functionality that can be fully encapsulated in the provider.
|
553
|
-
*
|
554
|
-
* This enables us to quickly ship provider-specific functionality
|
555
|
-
* without affecting the core AI SDK.
|
556
|
-
*
|
557
|
-
* The outer record is keyed by the provider name, and the inner
|
558
|
-
* record is keyed by the provider-specific metadata key.
|
559
|
-
*
|
560
|
-
* ```ts
|
561
|
-
* {
|
562
|
-
* "anthropic": {
|
563
|
-
* "cacheControl": { "type": "ephemeral" }
|
564
|
-
* }
|
565
|
-
* }
|
566
|
-
* ```
|
567
|
-
*/
|
568
|
-
type LanguageModelV1ProviderMetadata = Record<string, Record<string, JSONValue>>;
|
569
|
-
|
570
596
|
/**
|
571
597
|
A prompt is a list of messages.
|
572
598
|
|
@@ -1032,6 +1058,10 @@ type LanguageModelV1 = {
|
|
1032
1058
|
*/
|
1033
1059
|
providerMetadata?: LanguageModelV1ProviderMetadata;
|
1034
1060
|
/**
|
1061
|
+
Sources that have been used as input to generate the response.
|
1062
|
+
*/
|
1063
|
+
sources?: LanguageModelV1Source[];
|
1064
|
+
/**
|
1035
1065
|
Logprobs for the completion.
|
1036
1066
|
`undefined` if the mode does not support logprobs or if was not enabled
|
1037
1067
|
|
@@ -1095,6 +1125,9 @@ type LanguageModelV1StreamPart = {
|
|
1095
1125
|
} | {
|
1096
1126
|
type: 'reasoning';
|
1097
1127
|
textDelta: string;
|
1128
|
+
} | {
|
1129
|
+
type: 'source';
|
1130
|
+
source: LanguageModelV1Source;
|
1098
1131
|
} | ({
|
1099
1132
|
type: 'tool-call';
|
1100
1133
|
} & LanguageModelV1FunctionToolCall) | {
|
@@ -1164,4 +1197,4 @@ interface ProviderV1 {
|
|
1164
1197
|
readonly imageModel?: (modelId: string) => ImageModelV1;
|
1165
1198
|
}
|
1166
1199
|
|
1167
|
-
export { AISDKError, APICallError, type EmbeddingModelV1, type EmbeddingModelV1Embedding, EmptyResponseBodyError, type ImageModelV1, type ImageModelV1CallOptions, type ImageModelV1CallWarning, InvalidArgumentError, InvalidPromptError, InvalidResponseDataError, type JSONArray, type JSONObject, JSONParseError, type JSONValue, type LanguageModelV1, type LanguageModelV1CallOptions, type LanguageModelV1CallWarning, type LanguageModelV1FilePart, type LanguageModelV1FinishReason, type LanguageModelV1FunctionTool, type LanguageModelV1FunctionToolCall, type LanguageModelV1ImagePart, type LanguageModelV1LogProbs, type LanguageModelV1Message, type LanguageModelV1ObjectGenerationMode, type LanguageModelV1Prompt, type LanguageModelV1ProviderDefinedTool, type LanguageModelV1ProviderMetadata, type LanguageModelV1StreamPart, type LanguageModelV1TextPart, type LanguageModelV1ToolCallPart, type LanguageModelV1ToolChoice, type LanguageModelV1ToolResultPart, LoadAPIKeyError, LoadSettingError, NoContentGeneratedError, NoSuchModelError, type ProviderV1, TooManyEmbeddingValuesForCallError, TypeValidationError, UnsupportedFunctionalityError, getErrorMessage, isJSONArray, isJSONObject, isJSONValue };
|
1200
|
+
export { AISDKError, APICallError, type EmbeddingModelV1, type EmbeddingModelV1Embedding, EmptyResponseBodyError, type ImageModelV1, type ImageModelV1CallOptions, type ImageModelV1CallWarning, InvalidArgumentError, InvalidPromptError, InvalidResponseDataError, type JSONArray, type JSONObject, JSONParseError, type JSONValue, type LanguageModelV1, type LanguageModelV1CallOptions, type LanguageModelV1CallWarning, type LanguageModelV1FilePart, type LanguageModelV1FinishReason, type LanguageModelV1FunctionTool, type LanguageModelV1FunctionToolCall, type LanguageModelV1ImagePart, type LanguageModelV1LogProbs, type LanguageModelV1Message, type LanguageModelV1ObjectGenerationMode, type LanguageModelV1Prompt, type LanguageModelV1ProviderDefinedTool, type LanguageModelV1ProviderMetadata, type LanguageModelV1Source, type LanguageModelV1StreamPart, type LanguageModelV1TextPart, type LanguageModelV1ToolCallPart, type LanguageModelV1ToolChoice, type LanguageModelV1ToolResultPart, LoadAPIKeyError, LoadSettingError, NoContentGeneratedError, NoSuchModelError, type ProviderV1, TooManyEmbeddingValuesForCallError, TypeValidationError, UnsupportedFunctionalityError, getErrorMessage, isJSONArray, isJSONObject, isJSONValue };
|