ai 7.0.0-beta.113 → 7.0.0-beta.115
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 +32 -0
- package/dist/index.d.ts +1506 -1468
- package/dist/index.js +889 -979
- package/dist/index.js.map +1 -1
- package/dist/internal/index.d.ts +273 -273
- package/dist/internal/index.js +367 -405
- package/dist/internal/index.js.map +1 -1
- package/dist/test/index.d.ts +18 -18
- package/dist/test/index.js +22 -22
- package/dist/test/index.js.map +1 -1
- package/docs/02-foundations/03-prompts.mdx +13 -11
- package/docs/03-ai-sdk-core/15-tools-and-tool-calling.mdx +2 -1
- package/docs/03-ai-sdk-core/39-file-uploads.mdx +1 -1
- package/docs/03-ai-sdk-core/45-provider-management.mdx +1 -1
- package/docs/03-ai-sdk-core/60-telemetry.mdx +87 -13
- package/docs/07-reference/01-ai-sdk-core/12-generate-speech.mdx +2 -2
- package/docs/07-reference/01-ai-sdk-core/20-tool.mdx +7 -0
- package/docs/07-reference/01-ai-sdk-core/22-dynamic-tool.mdx +7 -0
- package/docs/07-reference/01-ai-sdk-core/30-model-message.mdx +9 -1
- package/docs/07-reference/01-ai-sdk-core/40-provider-registry.mdx +104 -0
- package/docs/07-reference/01-ai-sdk-core/42-custom-provider.mdx +56 -10
- package/docs/07-reference/02-ai-sdk-ui/31-convert-to-model-messages.mdx +1 -1
- package/docs/08-migration-guides/23-migration-guide-7-0.mdx +42 -0
- package/docs/09-troubleshooting/70-high-memory-usage-with-images.mdx +2 -2
- package/package.json +5 -5
- package/src/agent/agent.ts +13 -9
- package/src/agent/create-agent-ui-stream-response.ts +8 -8
- package/src/agent/create-agent-ui-stream.ts +9 -9
- package/src/agent/infer-agent-tools.ts +1 -1
- package/src/agent/infer-agent-ui-message.ts +2 -2
- package/src/agent/pipe-agent-ui-stream-to-response.ts +9 -9
- package/src/agent/tool-loop-agent-settings.ts +17 -19
- package/src/agent/tool-loop-agent.ts +16 -8
- package/src/embed/embed-many-result.ts +3 -4
- package/src/embed/embed-many.ts +5 -5
- package/src/embed/embed-result.ts +3 -4
- package/src/embed/embed.ts +4 -4
- package/src/error/invalid-stream-part-error.ts +1 -1
- package/src/error/no-image-generated-error.ts +1 -1
- package/src/error/no-object-generated-error.ts +3 -3
- package/src/error/no-speech-generated-error.ts +1 -1
- package/src/error/no-transcript-generated-error.ts +1 -1
- package/src/error/no-video-generated-error.ts +1 -1
- package/src/error/tool-call-repair-error.ts +2 -2
- package/src/error/verify-no-object-generated-error.ts +1 -1
- package/src/generate-image/generate-image-result.ts +5 -5
- package/src/generate-image/generate-image.ts +12 -15
- package/src/generate-image/index.ts +3 -2
- package/src/generate-object/generate-object-result.ts +2 -2
- package/src/generate-object/generate-object.ts +14 -14
- package/src/generate-object/inject-json-instruction.ts +1 -1
- package/src/generate-object/output-strategy.ts +10 -10
- package/src/generate-object/parse-and-validate-object-result.ts +1 -1
- package/src/generate-object/repair-text.ts +1 -1
- package/src/generate-object/stream-object-result.ts +4 -4
- package/src/generate-object/stream-object.ts +22 -19
- package/src/generate-object/validate-object-generation-input.ts +1 -1
- package/src/generate-speech/generate-speech-result.ts +4 -4
- package/src/generate-speech/generate-speech.ts +12 -13
- package/src/generate-speech/generated-audio-file.ts +1 -2
- package/src/generate-text/collect-tool-approvals.ts +4 -4
- package/src/generate-text/content-part.ts +9 -9
- package/src/generate-text/create-execute-tools-transformation.ts +9 -7
- package/src/generate-text/execute-tool-call.ts +11 -13
- package/src/generate-text/extract-reasoning-content.ts +1 -1
- package/src/generate-text/extract-text-content.ts +4 -1
- package/src/generate-text/generate-text-events.ts +2 -2
- package/src/generate-text/generate-text-result.ts +18 -14
- package/src/generate-text/generate-text.ts +42 -38
- package/src/generate-text/invoke-tool-callbacks-from-stream.ts +2 -3
- package/src/generate-text/output-utils.ts +1 -1
- package/src/generate-text/output.ts +8 -8
- package/src/generate-text/parse-tool-call.ts +36 -9
- package/src/generate-text/prepare-step.ts +3 -5
- package/src/generate-text/prune-messages.ts +1 -1
- package/src/generate-text/reasoning-output.ts +26 -9
- package/src/generate-text/reasoning.ts +1 -1
- package/src/generate-text/resolve-tool-approval.ts +3 -3
- package/src/generate-text/response-message.ts +1 -1
- package/src/generate-text/restricted-telemetry-dispatcher.ts +1 -1
- package/src/generate-text/smooth-stream.ts +6 -5
- package/src/generate-text/step-result.ts +16 -11
- package/src/generate-text/stop-condition.ts +1 -1
- package/src/generate-text/stream-language-model-call.ts +26 -21
- package/src/generate-text/stream-text-result.ts +29 -26
- package/src/generate-text/stream-text.ts +48 -46
- package/src/generate-text/to-response-messages.ts +2 -2
- package/src/generate-text/tool-approval-configuration.ts +2 -2
- package/src/generate-text/tool-approval-request-output.ts +1 -1
- package/src/generate-text/tool-approval-response-output.ts +1 -1
- package/src/generate-text/tool-call-repair-function.ts +4 -4
- package/src/generate-text/tool-call.ts +3 -4
- package/src/generate-text/tool-error.ts +3 -4
- package/src/generate-text/tool-execution-events.ts +2 -2
- package/src/generate-text/tool-output-denied.ts +1 -1
- package/src/generate-text/tool-output.ts +2 -2
- package/src/generate-text/tool-result.ts +7 -4
- package/src/generate-text/tools-context-parameter.ts +1 -1
- package/src/generate-text/validate-tool-context.ts +1 -2
- package/src/generate-video/generate-video-result.ts +4 -4
- package/src/generate-video/generate-video.ts +6 -10
- package/src/global.ts +2 -2
- package/src/index.ts +3 -3
- package/src/logger/log-warnings.ts +1 -1
- package/src/middleware/add-tool-input-examples-middleware.ts +2 -2
- package/src/middleware/default-embedding-settings-middleware.ts +2 -2
- package/src/middleware/default-settings-middleware.ts +2 -2
- package/src/middleware/extract-json-middleware.ts +1 -1
- package/src/middleware/extract-reasoning-middleware.ts +1 -1
- package/src/middleware/simulate-streaming-middleware.ts +1 -1
- package/src/middleware/wrap-embedding-model.ts +2 -2
- package/src/middleware/wrap-image-model.ts +2 -2
- package/src/middleware/wrap-language-model.ts +2 -2
- package/src/middleware/wrap-provider.ts +2 -2
- package/src/model/as-embedding-model-v3.ts +1 -1
- package/src/model/as-embedding-model-v4.ts +1 -1
- package/src/model/as-image-model-v3.ts +1 -1
- package/src/model/as-image-model-v4.ts +5 -1
- package/src/model/as-language-model-v3.ts +1 -1
- package/src/model/as-language-model-v4.ts +1 -1
- package/src/model/as-provider-v3.ts +1 -1
- package/src/model/as-provider-v4.ts +1 -1
- package/src/model/as-reranking-model-v4.ts +1 -1
- package/src/model/as-speech-model-v3.ts +1 -1
- package/src/model/as-speech-model-v4.ts +5 -1
- package/src/model/as-transcription-model-v3.ts +4 -1
- package/src/model/as-transcription-model-v4.ts +1 -1
- package/src/model/as-video-model-v4.ts +1 -1
- package/src/model/resolve-model.ts +8 -8
- package/src/prompt/content-part.ts +45 -15
- package/src/prompt/convert-to-language-model-prompt.ts +108 -122
- package/src/prompt/create-tool-model-output.ts +2 -2
- package/src/prompt/data-content.ts +1 -78
- package/src/prompt/file-part-data.ts +125 -0
- package/src/prompt/index.ts +3 -2
- package/src/prompt/language-model-call-options.ts +1 -1
- package/src/prompt/message-conversion-error.ts +1 -1
- package/src/prompt/message.ts +1 -1
- package/src/prompt/prepare-language-model-call-options.ts +1 -1
- package/src/prompt/prepare-tool-choice.ts +2 -2
- package/src/prompt/prepare-tools.ts +2 -2
- package/src/prompt/prompt.ts +1 -1
- package/src/prompt/standardize-prompt.ts +3 -3
- package/src/registry/custom-provider.ts +127 -92
- package/src/registry/index.ts +1 -1
- package/src/registry/provider-registry.ts +91 -87
- package/src/rerank/rerank-result.ts +1 -1
- package/src/rerank/rerank.ts +8 -5
- package/src/telemetry/create-telemetry-dispatcher.ts +11 -1
- package/src/telemetry/diagnostic-channel-publisher.ts +50 -0
- package/src/telemetry/diagnostic-channel.ts +24 -0
- package/src/telemetry/index.ts +5 -0
- package/src/telemetry/telemetry.ts +1 -1
- package/src/test/mock-embedding-model-v2.ts +1 -1
- package/src/test/mock-embedding-model-v3.ts +1 -1
- package/src/test/mock-embedding-model-v4.ts +1 -1
- package/src/test/mock-image-model-v2.ts +1 -1
- package/src/test/mock-image-model-v3.ts +1 -1
- package/src/test/mock-image-model-v4.ts +1 -1
- package/src/test/mock-language-model-v2.ts +1 -1
- package/src/test/mock-language-model-v3.ts +1 -1
- package/src/test/mock-language-model-v4.ts +1 -1
- package/src/test/mock-provider-v2.ts +6 -7
- package/src/test/mock-provider-v3.ts +7 -8
- package/src/test/mock-provider-v4.ts +7 -8
- package/src/test/mock-reranking-model-v3.ts +1 -1
- package/src/test/mock-reranking-model-v4.ts +1 -1
- package/src/test/mock-server-response.ts +1 -1
- package/src/test/mock-speech-model-v2.ts +1 -1
- package/src/test/mock-speech-model-v3.ts +1 -1
- package/src/test/mock-speech-model-v4.ts +1 -1
- package/src/test/mock-transcription-model-v2.ts +1 -1
- package/src/test/mock-transcription-model-v3.ts +1 -1
- package/src/test/mock-transcription-model-v4.ts +1 -1
- package/src/test/mock-video-model-v3.ts +1 -1
- package/src/test/mock-video-model-v4.ts +1 -1
- package/src/text-stream/pipe-text-stream-to-response.ts +1 -1
- package/src/transcribe/transcribe-result.ts +3 -3
- package/src/transcribe/transcribe.ts +12 -12
- package/src/types/embedding-model-middleware.ts +1 -1
- package/src/types/embedding-model.ts +1 -1
- package/src/types/image-model-middleware.ts +1 -1
- package/src/types/image-model.ts +1 -1
- package/src/types/json-value.ts +1 -1
- package/src/types/language-model-middleware.ts +1 -1
- package/src/types/language-model.ts +2 -2
- package/src/types/provider-metadata.ts +1 -1
- package/src/types/provider-reference.ts +1 -1
- package/src/types/provider.ts +4 -4
- package/src/types/reranking-model.ts +1 -1
- package/src/types/speech-model.ts +5 -1
- package/src/types/transcription-model.ts +1 -1
- package/src/types/usage.ts +1 -1
- package/src/types/video-model.ts +1 -1
- package/src/types/warning.ts +1 -1
- package/src/ui/call-completion-api.ts +2 -2
- package/src/ui/chat-transport.ts +3 -3
- package/src/ui/chat.ts +10 -11
- package/src/ui/convert-file-list-to-file-ui-parts.ts +1 -1
- package/src/ui/convert-to-model-messages.ts +34 -23
- package/src/ui/default-chat-transport.ts +4 -4
- package/src/ui/direct-chat-transport.ts +6 -6
- package/src/ui/http-chat-transport.ts +5 -5
- package/src/ui/last-assistant-message-is-complete-with-approval-responses.ts +0 -1
- package/src/ui/last-assistant-message-is-complete-with-tool-calls.ts +0 -1
- package/src/ui/process-ui-message-stream.ts +20 -21
- package/src/ui/text-stream-chat-transport.ts +3 -3
- package/src/ui/transform-text-to-ui-message-stream.ts +1 -1
- package/src/ui/ui-messages.ts +13 -6
- package/src/ui/use-completion.ts +1 -1
- package/src/ui/validate-ui-messages.ts +3 -3
- package/src/ui-message-stream/create-ui-message-stream-response.ts +2 -2
- package/src/ui-message-stream/create-ui-message-stream.ts +6 -6
- package/src/ui-message-stream/get-response-ui-message-id.ts +2 -2
- package/src/ui-message-stream/handle-ui-message-stream-finish.ts +6 -6
- package/src/ui-message-stream/pipe-ui-message-stream-to-response.ts +3 -3
- package/src/ui-message-stream/read-ui-message-stream.ts +4 -4
- package/src/ui-message-stream/ui-message-chunks.ts +4 -4
- package/src/ui-message-stream/ui-message-stream-on-finish-callback.ts +2 -2
- package/src/ui-message-stream/ui-message-stream-on-step-finish-callback.ts +1 -1
- package/src/ui-message-stream/ui-message-stream-writer.ts +3 -3
- package/src/upload-file/upload-file-result.ts +3 -3
- package/src/upload-file/upload-file.ts +34 -56
- package/src/upload-skill/upload-skill-result.ts +3 -3
- package/src/upload-skill/upload-skill.ts +27 -8
- package/src/util/create-resolvable-promise.ts +1 -1
- package/src/util/deep-partial.ts +1 -1
- package/src/util/download/download.ts +0 -2
- package/src/util/extract-literal-union.ts +18 -0
- package/src/util/is-node-runtime.ts +3 -0
- package/src/util/notify.ts +1 -1
- package/src/util/parse-partial-json.ts +1 -1
- package/src/util/prepare-retries.ts +1 -2
- package/src/util/serial-job-executor.ts +1 -1
- package/src/util/write-to-server-response.ts +1 -1
- package/src/util/detect-media-type.ts +0 -235
|
@@ -11,6 +11,10 @@ in a central place and access the models through simple string ids.
|
|
|
11
11
|
`createProviderRegistry` lets you create a registry with multiple providers that you
|
|
12
12
|
can access by their ids in the format `providerId:modelId`.
|
|
13
13
|
|
|
14
|
+
In TypeScript, registry model IDs are inferred from the registered provider IDs.
|
|
15
|
+
When a provider exposes literal model ID types, editors can suggest the combined
|
|
16
|
+
`providerId:modelId` values.
|
|
17
|
+
|
|
14
18
|
### Setup
|
|
15
19
|
|
|
16
20
|
You can create a registry with multiple providers and models using `createProviderRegistry`.
|
|
@@ -93,6 +97,28 @@ const { image } = await generateImage({
|
|
|
93
97
|
});
|
|
94
98
|
```
|
|
95
99
|
|
|
100
|
+
### Video models
|
|
101
|
+
|
|
102
|
+
You can access video models by using the `videoModel` method on the registry.
|
|
103
|
+
The provider id will become the prefix of the model id: `providerId:modelId`.
|
|
104
|
+
|
|
105
|
+
```ts highlight={"5"}
|
|
106
|
+
import { fal } from '@ai-sdk/fal';
|
|
107
|
+
import { createProviderRegistry, experimental_generateVideo } from 'ai';
|
|
108
|
+
|
|
109
|
+
const registry = createProviderRegistry({ fal });
|
|
110
|
+
|
|
111
|
+
const { videos } = await experimental_generateVideo({
|
|
112
|
+
model: registry.videoModel('fal:luma-dream-machine/ray-2'),
|
|
113
|
+
prompt: 'A cat walking on a beach at sunset',
|
|
114
|
+
});
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
### Files and skills
|
|
118
|
+
|
|
119
|
+
You can access a provider's files and skills interfaces by calling
|
|
120
|
+
`registry.files(providerId)` and `registry.skills(providerId)`.
|
|
121
|
+
|
|
96
122
|
## Import
|
|
97
123
|
|
|
98
124
|
<Snippet text={`import { createProviderRegistry } from "ai"`} prompt={false} />
|
|
@@ -129,6 +155,48 @@ const { image } = await generateImage({
|
|
|
129
155
|
type: '(id: string) => ImageModel',
|
|
130
156
|
description: 'A function that returns an image model by its id.',
|
|
131
157
|
},
|
|
158
|
+
{
|
|
159
|
+
name: 'transcriptionModel',
|
|
160
|
+
type: '(id: string) => TranscriptionModel',
|
|
161
|
+
isOptional: true,
|
|
162
|
+
description:
|
|
163
|
+
'A function that returns a transcription model by its id.',
|
|
164
|
+
},
|
|
165
|
+
{
|
|
166
|
+
name: 'speechModel',
|
|
167
|
+
type: '(id: string) => SpeechModel',
|
|
168
|
+
isOptional: true,
|
|
169
|
+
description:
|
|
170
|
+
'A function that returns a speech model by its id.',
|
|
171
|
+
},
|
|
172
|
+
{
|
|
173
|
+
name: 'rerankingModel',
|
|
174
|
+
type: '(id: string) => RerankingModel',
|
|
175
|
+
isOptional: true,
|
|
176
|
+
description:
|
|
177
|
+
'A function that returns a reranking model by its id.',
|
|
178
|
+
},
|
|
179
|
+
{
|
|
180
|
+
name: 'videoModel',
|
|
181
|
+
type: '(id: string) => VideoModelV4',
|
|
182
|
+
isOptional: true,
|
|
183
|
+
description:
|
|
184
|
+
'A function that returns a video model by its id.',
|
|
185
|
+
},
|
|
186
|
+
{
|
|
187
|
+
name: 'files',
|
|
188
|
+
type: '() => FilesV4',
|
|
189
|
+
isOptional: true,
|
|
190
|
+
description:
|
|
191
|
+
'A function that returns the provider files API interface.',
|
|
192
|
+
},
|
|
193
|
+
{
|
|
194
|
+
name: 'skills',
|
|
195
|
+
type: '() => SkillsV4',
|
|
196
|
+
isOptional: true,
|
|
197
|
+
description:
|
|
198
|
+
'A function that returns the provider skills API interface.',
|
|
199
|
+
},
|
|
132
200
|
],
|
|
133
201
|
},
|
|
134
202
|
],
|
|
@@ -194,5 +262,41 @@ The `createProviderRegistry` function returns a `Provider` instance. It has the
|
|
|
194
262
|
description:
|
|
195
263
|
'A function that returns an image model by its id (format: providerId:modelId)',
|
|
196
264
|
},
|
|
265
|
+
{
|
|
266
|
+
name: 'transcriptionModel',
|
|
267
|
+
type: '(id: string) => TranscriptionModel',
|
|
268
|
+
description:
|
|
269
|
+
'A function that returns a transcription model by its id (format: providerId:modelId)',
|
|
270
|
+
},
|
|
271
|
+
{
|
|
272
|
+
name: 'speechModel',
|
|
273
|
+
type: '(id: string) => SpeechModel',
|
|
274
|
+
description:
|
|
275
|
+
'A function that returns a speech model by its id (format: providerId:modelId)',
|
|
276
|
+
},
|
|
277
|
+
{
|
|
278
|
+
name: 'rerankingModel',
|
|
279
|
+
type: '(id: string) => RerankingModel',
|
|
280
|
+
description:
|
|
281
|
+
'A function that returns a reranking model by its id (format: providerId:modelId)',
|
|
282
|
+
},
|
|
283
|
+
{
|
|
284
|
+
name: 'videoModel',
|
|
285
|
+
type: '(id: string) => VideoModelV4',
|
|
286
|
+
description:
|
|
287
|
+
'A function that returns a video model by its id (format: providerId:modelId)',
|
|
288
|
+
},
|
|
289
|
+
{
|
|
290
|
+
name: 'files',
|
|
291
|
+
type: '(providerId: string) => FilesV4',
|
|
292
|
+
description:
|
|
293
|
+
'A function that returns a provider files API interface by provider id.',
|
|
294
|
+
},
|
|
295
|
+
{
|
|
296
|
+
name: 'skills',
|
|
297
|
+
type: '(providerId: string) => SkillsV4',
|
|
298
|
+
description:
|
|
299
|
+
'A function that returns a provider skills API interface by provider id.',
|
|
300
|
+
},
|
|
197
301
|
]}
|
|
198
302
|
/>
|
|
@@ -8,7 +8,9 @@ description: Custom provider that uses models from a different provider (API Ref
|
|
|
8
8
|
With a custom provider, you can map ids to any model.
|
|
9
9
|
This allows you to set up custom model configurations, alias names, and more.
|
|
10
10
|
The custom provider also supports a fallback provider, which is useful for
|
|
11
|
-
wrapping existing providers and adding additional functionality.
|
|
11
|
+
wrapping existing providers and adding additional functionality. Custom
|
|
12
|
+
providers can expose language, embedding, image, transcription, speech,
|
|
13
|
+
reranking, video, files, and skills capabilities.
|
|
12
14
|
|
|
13
15
|
### Example: custom model settings
|
|
14
16
|
|
|
@@ -54,7 +56,7 @@ export const myOpenAI = customProvider({
|
|
|
54
56
|
|
|
55
57
|
## Import
|
|
56
58
|
|
|
57
|
-
<Snippet text={`import {
|
|
59
|
+
<Snippet text={`import { customProvider } from "ai"`} prompt={false} />
|
|
58
60
|
|
|
59
61
|
## API Signature
|
|
60
62
|
|
|
@@ -70,7 +72,7 @@ export const myOpenAI = customProvider({
|
|
|
70
72
|
'A record of language models, where keys are model IDs and values are LanguageModel instances.',
|
|
71
73
|
},
|
|
72
74
|
{
|
|
73
|
-
name: '
|
|
75
|
+
name: 'embeddingModels',
|
|
74
76
|
type: 'Record<string, EmbeddingModel<string>>',
|
|
75
77
|
isOptional: true,
|
|
76
78
|
description:
|
|
@@ -104,12 +106,33 @@ export const myOpenAI = customProvider({
|
|
|
104
106
|
description:
|
|
105
107
|
'A record of reranking models, where keys are model IDs and values are RerankingModel instances.',
|
|
106
108
|
},
|
|
109
|
+
{
|
|
110
|
+
name: 'videoModels',
|
|
111
|
+
type: 'Record<string, VideoModel>',
|
|
112
|
+
isOptional: true,
|
|
113
|
+
description:
|
|
114
|
+
'A record of video models, where keys are model IDs and values are VideoModel instances.',
|
|
115
|
+
},
|
|
116
|
+
{
|
|
117
|
+
name: 'files',
|
|
118
|
+
type: 'FilesV4',
|
|
119
|
+
isOptional: true,
|
|
120
|
+
description:
|
|
121
|
+
'A files API interface to expose through the custom provider.',
|
|
122
|
+
},
|
|
123
|
+
{
|
|
124
|
+
name: 'skills',
|
|
125
|
+
type: 'SkillsV4',
|
|
126
|
+
isOptional: true,
|
|
127
|
+
description:
|
|
128
|
+
'A skills API interface to expose through the custom provider.',
|
|
129
|
+
},
|
|
107
130
|
{
|
|
108
131
|
name: 'fallbackProvider',
|
|
109
132
|
type: 'Provider',
|
|
110
133
|
isOptional: true,
|
|
111
134
|
description:
|
|
112
|
-
'An optional fallback provider to use when a requested model is not found in the custom provider.',
|
|
135
|
+
'An optional fallback provider to use when a requested model or capability is not found in the custom provider.',
|
|
113
136
|
},
|
|
114
137
|
]}
|
|
115
138
|
/>
|
|
@@ -124,34 +147,57 @@ The `customProvider` function returns a `Provider` instance. It has the followin
|
|
|
124
147
|
name: 'languageModel',
|
|
125
148
|
type: '(id: string) => LanguageModel',
|
|
126
149
|
description:
|
|
127
|
-
'A function that returns a language model by its
|
|
150
|
+
'A function that returns a language model by its custom provider model ID.',
|
|
128
151
|
},
|
|
129
152
|
{
|
|
130
153
|
name: 'embeddingModel',
|
|
131
154
|
type: '(id: string) => EmbeddingModel<string>',
|
|
132
155
|
description:
|
|
133
|
-
'A function that returns a text embedding model by its
|
|
156
|
+
'A function that returns a text embedding model by its custom provider model ID.',
|
|
134
157
|
},
|
|
135
158
|
{
|
|
136
159
|
name: 'imageModel',
|
|
137
160
|
type: '(id: string) => ImageModel',
|
|
138
161
|
description:
|
|
139
|
-
'A function that returns an image model by its
|
|
162
|
+
'A function that returns an image model by its custom provider model ID.',
|
|
140
163
|
},
|
|
141
164
|
{
|
|
142
165
|
name: 'transcriptionModel',
|
|
143
166
|
type: '(id: string) => TranscriptionModel',
|
|
144
|
-
description:
|
|
167
|
+
description:
|
|
168
|
+
'A function that returns a transcription model by its custom provider model ID.',
|
|
145
169
|
},
|
|
146
170
|
{
|
|
147
171
|
name: 'speechModel',
|
|
148
172
|
type: '(id: string) => SpeechModel',
|
|
149
|
-
description:
|
|
173
|
+
description:
|
|
174
|
+
'A function that returns a speech model by its custom provider model ID.',
|
|
150
175
|
},
|
|
151
176
|
{
|
|
152
177
|
name: 'rerankingModel',
|
|
153
178
|
type: '(id: string) => RerankingModel',
|
|
154
|
-
description:
|
|
179
|
+
description:
|
|
180
|
+
'A function that returns a reranking model by its custom provider model ID.',
|
|
181
|
+
},
|
|
182
|
+
{
|
|
183
|
+
name: 'videoModel',
|
|
184
|
+
type: '(id: string) => VideoModelV4',
|
|
185
|
+
description:
|
|
186
|
+
'A function that returns a video model by its custom provider model ID.',
|
|
187
|
+
},
|
|
188
|
+
{
|
|
189
|
+
name: 'files',
|
|
190
|
+
type: '() => FilesV4',
|
|
191
|
+
isOptional: true,
|
|
192
|
+
description:
|
|
193
|
+
'A function that returns the custom provider files API interface, when configured directly or inherited from the fallback provider.',
|
|
194
|
+
},
|
|
195
|
+
{
|
|
196
|
+
name: 'skills',
|
|
197
|
+
type: '() => SkillsV4',
|
|
198
|
+
isOptional: true,
|
|
199
|
+
description:
|
|
200
|
+
'A function that returns the custom provider skills API interface, when configured directly or inherited from the fallback provider.',
|
|
155
201
|
},
|
|
156
202
|
]}
|
|
157
203
|
/>
|
|
@@ -84,7 +84,7 @@ import { z } from 'zod';
|
|
|
84
84
|
const screenshotTool = tool({
|
|
85
85
|
inputSchema: z.object({}),
|
|
86
86
|
execute: async () => 'imgbase64',
|
|
87
|
-
toModelOutput: ({ output }) => [{ type: '
|
|
87
|
+
toModelOutput: ({ output }) => [{ type: 'file-data', data: output, mediaType: 'image/png' }],
|
|
88
88
|
});
|
|
89
89
|
|
|
90
90
|
const result = streamText({
|
|
@@ -41,6 +41,34 @@ If your `package.json` does not already include `"type": "module"`, add it or re
|
|
|
41
41
|
|
|
42
42
|
## AI SDK Core
|
|
43
43
|
|
|
44
|
+
### Provider Management: Remove Deprecated `experimental_customProvider`
|
|
45
|
+
|
|
46
|
+
The deprecated `experimental_customProvider` export has been removed in AI SDK
|
|
47
|
+
7. Replace it with `customProvider`.
|
|
48
|
+
|
|
49
|
+
```tsx filename="AI SDK 6"
|
|
50
|
+
import { experimental_customProvider } from 'ai';
|
|
51
|
+
|
|
52
|
+
export const myProvider = experimental_customProvider({
|
|
53
|
+
languageModels: {
|
|
54
|
+
// ...
|
|
55
|
+
},
|
|
56
|
+
});
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
```tsx filename="AI SDK 7"
|
|
60
|
+
import { customProvider } from 'ai';
|
|
61
|
+
|
|
62
|
+
export const myProvider = customProvider({
|
|
63
|
+
languageModels: {
|
|
64
|
+
// ...
|
|
65
|
+
},
|
|
66
|
+
});
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
This is only an import and symbol rename. The `customProvider` options and
|
|
70
|
+
behavior are unchanged.
|
|
71
|
+
|
|
44
72
|
### Prompt Messages: System Messages in `prompt` or `messages` Are Rejected by Default
|
|
45
73
|
|
|
46
74
|
AI SDK 7 rejects system messages in the `prompt` or `messages` fields by default. System instructions should usually be passed with the top-level `system` option.
|
|
@@ -547,6 +575,20 @@ Note that `file-url` now requires a `mediaType` field so providers can correctly
|
|
|
547
575
|
- `file-url` (replaces `image-url`) — now requires `mediaType`
|
|
548
576
|
- `file-reference` (replaces `image-file-reference`, `file-id`, `image-file-id`)
|
|
549
577
|
|
|
578
|
+
### Message Parts: Migrate Away From Deprecated `image` Part
|
|
579
|
+
|
|
580
|
+
The `{ type: 'image', image, mediaType? }` user-message content part is deprecated. Use `{ type: 'file', data, mediaType }` with an image `mediaType` instead.
|
|
581
|
+
|
|
582
|
+
```tsx filename="AI SDK 6"
|
|
583
|
+
{ type: 'image', image: bytes }
|
|
584
|
+
```
|
|
585
|
+
|
|
586
|
+
```tsx filename="AI SDK 7"
|
|
587
|
+
{ type: 'file', mediaType: 'image', data: bytes }
|
|
588
|
+
```
|
|
589
|
+
|
|
590
|
+
`mediaType` on `FilePart` now accepts either a full IANA type (e.g. `'image/png'`) or just a top-level segment (e.g. `'image'`). When only a top-level segment is provided, the subtype is auto-detected from inline bytes where possible.
|
|
591
|
+
|
|
550
592
|
### Message Parts: Handle New `reasoning-file` Content Type
|
|
551
593
|
|
|
552
594
|
Some models can now return files as part of their reasoning trace, separate from regular output files. These files, which would have previously were using the `file` type, are now in a distinct `reasoning-file` type.
|
|
@@ -36,7 +36,7 @@ const result = await generateText({
|
|
|
36
36
|
role: 'user',
|
|
37
37
|
content: [
|
|
38
38
|
{ type: 'text', text: 'Describe this image' },
|
|
39
|
-
{ type: 'image',
|
|
39
|
+
{ type: 'file', mediaType: 'image', data: imageUrl },
|
|
40
40
|
],
|
|
41
41
|
},
|
|
42
42
|
],
|
|
@@ -88,7 +88,7 @@ for (const imageUrl of imageUrls) {
|
|
|
88
88
|
role: 'user',
|
|
89
89
|
content: [
|
|
90
90
|
{ type: 'text', text: 'Describe this image' },
|
|
91
|
-
{ type: 'image',
|
|
91
|
+
{ type: 'file', mediaType: 'image', data: imageUrl },
|
|
92
92
|
],
|
|
93
93
|
},
|
|
94
94
|
],
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ai",
|
|
3
|
-
"version": "7.0.0-beta.
|
|
3
|
+
"version": "7.0.0-beta.115",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "AI SDK by Vercel - build apps like ChatGPT, Claude, Gemini, and more with a single interface for any model using the Vercel AI Gateway or go direct to OpenAI, Anthropic, Google, or any other model provider.",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -42,9 +42,9 @@
|
|
|
42
42
|
}
|
|
43
43
|
},
|
|
44
44
|
"dependencies": {
|
|
45
|
-
"@ai-sdk/gateway": "4.0.0-beta.
|
|
46
|
-
"@ai-sdk/provider": "4.0.0-beta.
|
|
47
|
-
"@ai-sdk/provider-utils": "5.0.0-beta.
|
|
45
|
+
"@ai-sdk/gateway": "4.0.0-beta.66",
|
|
46
|
+
"@ai-sdk/provider": "4.0.0-beta.14",
|
|
47
|
+
"@ai-sdk/provider-utils": "5.0.0-beta.30"
|
|
48
48
|
},
|
|
49
49
|
"devDependencies": {
|
|
50
50
|
"@edge-runtime/vm": "^5.0.0",
|
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
"tsx": "^4.19.2",
|
|
56
56
|
"typescript": "5.8.3",
|
|
57
57
|
"zod": "3.25.76",
|
|
58
|
-
"@ai-sdk/test-server": "2.0.0-beta.
|
|
58
|
+
"@ai-sdk/test-server": "2.0.0-beta.3",
|
|
59
59
|
"@vercel/ai-tsconfig": "0.0.0"
|
|
60
60
|
},
|
|
61
61
|
"peerDependencies": {
|
package/src/agent/agent.ts
CHANGED
|
@@ -1,20 +1,24 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import type {
|
|
2
|
+
Arrayable,
|
|
3
|
+
Context,
|
|
4
|
+
ModelMessage,
|
|
5
|
+
ToolSet,
|
|
6
|
+
} from '@ai-sdk/provider-utils';
|
|
7
|
+
import type {
|
|
4
8
|
GenerateTextOnFinishCallback,
|
|
5
9
|
GenerateTextOnStartCallback,
|
|
6
10
|
GenerateTextOnStepFinishCallback,
|
|
7
11
|
GenerateTextOnStepStartCallback,
|
|
8
12
|
} from '../generate-text/generate-text-events';
|
|
9
|
-
import { GenerateTextResult } from '../generate-text/generate-text-result';
|
|
10
|
-
import { Output } from '../generate-text/output';
|
|
11
|
-
import { StreamTextTransform } from '../generate-text/stream-text';
|
|
12
|
-
import { StreamTextResult } from '../generate-text/stream-text-result';
|
|
13
|
-
import {
|
|
13
|
+
import type { GenerateTextResult } from '../generate-text/generate-text-result';
|
|
14
|
+
import type { Output } from '../generate-text/output';
|
|
15
|
+
import type { StreamTextTransform } from '../generate-text/stream-text';
|
|
16
|
+
import type { StreamTextResult } from '../generate-text/stream-text-result';
|
|
17
|
+
import type {
|
|
14
18
|
OnToolExecutionEndCallback,
|
|
15
19
|
OnToolExecutionStartCallback,
|
|
16
20
|
} from '../generate-text/tool-execution-events';
|
|
17
|
-
import { TimeoutConfiguration } from '../prompt/request-options';
|
|
21
|
+
import type { TimeoutConfiguration } from '../prompt/request-options';
|
|
18
22
|
|
|
19
23
|
/**
|
|
20
24
|
* Parameters for calling an agent.
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import type { Arrayable, Context, ToolSet } from '@ai-sdk/provider-utils';
|
|
2
|
-
import { GenerateTextOnStepFinishCallback } from '../generate-text/generate-text-events';
|
|
3
|
-
import { Output } from '../generate-text/output';
|
|
4
|
-
import { StreamTextTransform } from '../generate-text/stream-text';
|
|
5
|
-
import { UIMessageStreamOptions } from '../generate-text/stream-text-result';
|
|
6
|
-
import { TimeoutConfiguration } from '../prompt/request-options';
|
|
2
|
+
import type { GenerateTextOnStepFinishCallback } from '../generate-text/generate-text-events';
|
|
3
|
+
import type { Output } from '../generate-text/output';
|
|
4
|
+
import type { StreamTextTransform } from '../generate-text/stream-text';
|
|
5
|
+
import type { UIMessageStreamOptions } from '../generate-text/stream-text-result';
|
|
6
|
+
import type { TimeoutConfiguration } from '../prompt/request-options';
|
|
7
7
|
import { createUIMessageStreamResponse } from '../ui-message-stream';
|
|
8
|
-
import { UIMessageStreamResponseInit } from '../ui-message-stream/ui-message-stream-response-init';
|
|
9
|
-
import { InferUITools, UIMessage } from '../ui/ui-messages';
|
|
10
|
-
import { Agent } from './agent';
|
|
8
|
+
import type { UIMessageStreamResponseInit } from '../ui-message-stream/ui-message-stream-response-init';
|
|
9
|
+
import type { InferUITools, UIMessage } from '../ui/ui-messages';
|
|
10
|
+
import type { Agent } from './agent';
|
|
11
11
|
import { createAgentUIStream } from './create-agent-ui-stream';
|
|
12
12
|
|
|
13
13
|
/**
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import type { Arrayable, Context, ToolSet } from '@ai-sdk/provider-utils';
|
|
2
|
-
import { GenerateTextOnStepFinishCallback } from '../generate-text/generate-text-events';
|
|
3
|
-
import { Output } from '../generate-text/output';
|
|
4
|
-
import { StreamTextTransform } from '../generate-text/stream-text';
|
|
5
|
-
import { UIMessageStreamOptions } from '../generate-text/stream-text-result';
|
|
6
|
-
import { TimeoutConfiguration } from '../prompt/request-options';
|
|
7
|
-
import { InferUIMessageChunk } from '../ui-message-stream';
|
|
2
|
+
import type { GenerateTextOnStepFinishCallback } from '../generate-text/generate-text-events';
|
|
3
|
+
import type { Output } from '../generate-text/output';
|
|
4
|
+
import type { StreamTextTransform } from '../generate-text/stream-text';
|
|
5
|
+
import type { UIMessageStreamOptions } from '../generate-text/stream-text-result';
|
|
6
|
+
import type { TimeoutConfiguration } from '../prompt/request-options';
|
|
7
|
+
import type { InferUIMessageChunk } from '../ui-message-stream';
|
|
8
8
|
import { convertToModelMessages } from '../ui/convert-to-model-messages';
|
|
9
|
-
import { InferUITools, UIMessage } from '../ui/ui-messages';
|
|
9
|
+
import type { InferUITools, UIMessage } from '../ui/ui-messages';
|
|
10
10
|
import { validateUIMessages } from '../ui/validate-ui-messages';
|
|
11
|
-
import { AsyncIterableStream } from '../util/async-iterable-stream';
|
|
12
|
-
import { Agent } from './agent';
|
|
11
|
+
import type { AsyncIterableStream } from '../util/async-iterable-stream';
|
|
12
|
+
import type { Agent } from './agent';
|
|
13
13
|
|
|
14
14
|
/**
|
|
15
15
|
* Runs the agent and stream the output as a UI message stream.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { InferUITools, UIMessage } from '../ui/ui-messages';
|
|
2
|
-
import { InferAgentTools } from './infer-agent-tools';
|
|
1
|
+
import type { InferUITools, UIMessage } from '../ui/ui-messages';
|
|
2
|
+
import type { InferAgentTools } from './infer-agent-tools';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Infer the UI message type of an agent.
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import type { Arrayable, Context, ToolSet } from '@ai-sdk/provider-utils';
|
|
2
|
-
import { ServerResponse } from 'node:http';
|
|
3
|
-
import { GenerateTextOnStepFinishCallback } from '../generate-text/generate-text-events';
|
|
4
|
-
import { Output } from '../generate-text/output';
|
|
5
|
-
import { StreamTextTransform } from '../generate-text/stream-text';
|
|
6
|
-
import { UIMessageStreamOptions } from '../generate-text/stream-text-result';
|
|
7
|
-
import { TimeoutConfiguration } from '../prompt/request-options';
|
|
2
|
+
import type { ServerResponse } from 'node:http';
|
|
3
|
+
import type { GenerateTextOnStepFinishCallback } from '../generate-text/generate-text-events';
|
|
4
|
+
import type { Output } from '../generate-text/output';
|
|
5
|
+
import type { StreamTextTransform } from '../generate-text/stream-text';
|
|
6
|
+
import type { UIMessageStreamOptions } from '../generate-text/stream-text-result';
|
|
7
|
+
import type { TimeoutConfiguration } from '../prompt/request-options';
|
|
8
8
|
import { pipeUIMessageStreamToResponse } from '../ui-message-stream';
|
|
9
|
-
import { UIMessageStreamResponseInit } from '../ui-message-stream/ui-message-stream-response-init';
|
|
10
|
-
import { InferUITools, UIMessage } from '../ui/ui-messages';
|
|
11
|
-
import { Agent } from './agent';
|
|
9
|
+
import type { UIMessageStreamResponseInit } from '../ui-message-stream/ui-message-stream-response-init';
|
|
10
|
+
import type { InferUITools, UIMessage } from '../ui/ui-messages';
|
|
11
|
+
import type { Agent } from './agent';
|
|
12
12
|
import { createAgentUIStream } from './create-agent-ui-stream';
|
|
13
13
|
|
|
14
14
|
/**
|
|
@@ -1,16 +1,14 @@
|
|
|
1
1
|
import type {
|
|
2
2
|
Arrayable,
|
|
3
3
|
Context,
|
|
4
|
+
FlexibleSchema,
|
|
4
5
|
IdGenerator,
|
|
5
6
|
InferToolSetContext,
|
|
6
|
-
SensitiveContext,
|
|
7
|
-
ToolSet,
|
|
8
|
-
} from '@ai-sdk/provider-utils';
|
|
9
|
-
import {
|
|
10
|
-
FlexibleSchema,
|
|
11
7
|
MaybePromiseLike,
|
|
12
8
|
ProviderOptions,
|
|
9
|
+
SensitiveContext,
|
|
13
10
|
SystemModelMessage,
|
|
11
|
+
ToolSet,
|
|
14
12
|
} from '@ai-sdk/provider-utils';
|
|
15
13
|
import type {
|
|
16
14
|
GenerateTextOnFinishCallback,
|
|
@@ -19,23 +17,23 @@ import type {
|
|
|
19
17
|
GenerateTextOnStepStartCallback,
|
|
20
18
|
} from '../generate-text/generate-text-events';
|
|
21
19
|
import type { ActiveTools } from '../generate-text/active-tools';
|
|
22
|
-
import { Output } from '../generate-text/output';
|
|
23
|
-
import { PrepareStepFunction } from '../generate-text/prepare-step';
|
|
24
|
-
import { StopCondition } from '../generate-text/stop-condition';
|
|
25
|
-
import { ToolApprovalConfiguration } from '../generate-text/tool-approval-configuration';
|
|
26
|
-
import { ToolCallRepairFunction } from '../generate-text/tool-call-repair-function';
|
|
27
|
-
import {
|
|
20
|
+
import type { Output } from '../generate-text/output';
|
|
21
|
+
import type { PrepareStepFunction } from '../generate-text/prepare-step';
|
|
22
|
+
import type { StopCondition } from '../generate-text/stop-condition';
|
|
23
|
+
import type { ToolApprovalConfiguration } from '../generate-text/tool-approval-configuration';
|
|
24
|
+
import type { ToolCallRepairFunction } from '../generate-text/tool-call-repair-function';
|
|
25
|
+
import type {
|
|
28
26
|
OnToolExecutionEndCallback,
|
|
29
27
|
OnToolExecutionStartCallback,
|
|
30
28
|
} from '../generate-text/tool-execution-events';
|
|
31
|
-
import { ToolsContextParameter } from '../generate-text/tools-context-parameter';
|
|
32
|
-
import { LanguageModelCallOptions } from '../prompt/language-model-call-options';
|
|
33
|
-
import { Prompt } from '../prompt/prompt';
|
|
34
|
-
import { RequestOptions } from '../prompt/request-options';
|
|
35
|
-
import { TelemetryOptions } from '../telemetry/telemetry-options';
|
|
36
|
-
import { LanguageModel, ToolChoice } from '../types/language-model';
|
|
37
|
-
import { DownloadFunction } from '../util/download/download-function';
|
|
38
|
-
import { AgentCallParameters } from './agent';
|
|
29
|
+
import type { ToolsContextParameter } from '../generate-text/tools-context-parameter';
|
|
30
|
+
import type { LanguageModelCallOptions } from '../prompt/language-model-call-options';
|
|
31
|
+
import type { Prompt } from '../prompt/prompt';
|
|
32
|
+
import type { RequestOptions } from '../prompt/request-options';
|
|
33
|
+
import type { TelemetryOptions } from '../telemetry/telemetry-options';
|
|
34
|
+
import type { LanguageModel, ToolChoice } from '../types/language-model';
|
|
35
|
+
import type { DownloadFunction } from '../util/download/download-function';
|
|
36
|
+
import type { AgentCallParameters } from './agent';
|
|
39
37
|
|
|
40
38
|
/**
|
|
41
39
|
* Configuration options for an agent.
|
|
@@ -1,18 +1,26 @@
|
|
|
1
|
-
import type { Context, ModelMessage, ToolSet } from '@ai-sdk/provider-utils';
|
|
2
|
-
import { validateTypes } from '@ai-sdk/provider-utils';
|
|
3
|
-
import { generateText } from '../generate-text/generate-text';
|
|
4
1
|
import {
|
|
2
|
+
validateTypes,
|
|
3
|
+
type Context,
|
|
4
|
+
type ModelMessage,
|
|
5
|
+
type ToolSet,
|
|
6
|
+
} from '@ai-sdk/provider-utils';
|
|
7
|
+
import { generateText } from '../generate-text/generate-text';
|
|
8
|
+
import type {
|
|
5
9
|
GenerateTextOnStartCallback,
|
|
6
10
|
GenerateTextOnStepStartCallback,
|
|
7
11
|
} from '../generate-text/generate-text-events';
|
|
8
|
-
import { GenerateTextResult } from '../generate-text/generate-text-result';
|
|
9
|
-
import { Output } from '../generate-text/output';
|
|
12
|
+
import type { GenerateTextResult } from '../generate-text/generate-text-result';
|
|
13
|
+
import type { Output } from '../generate-text/output';
|
|
10
14
|
import { isStepCount } from '../generate-text/stop-condition';
|
|
11
15
|
import { streamText } from '../generate-text/stream-text';
|
|
12
|
-
import { StreamTextResult } from '../generate-text/stream-text-result';
|
|
13
|
-
import { Prompt } from '../prompt';
|
|
16
|
+
import type { StreamTextResult } from '../generate-text/stream-text-result';
|
|
17
|
+
import type { Prompt } from '../prompt';
|
|
14
18
|
import { mergeCallbacks } from '../util/merge-callbacks';
|
|
15
|
-
import {
|
|
19
|
+
import type {
|
|
20
|
+
Agent,
|
|
21
|
+
AgentCallParameters,
|
|
22
|
+
AgentStreamParameters,
|
|
23
|
+
} from './agent';
|
|
16
24
|
import type { ToolLoopAgentSettings } from './tool-loop-agent-settings';
|
|
17
25
|
|
|
18
26
|
/**
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { Embedding } from '../types';
|
|
2
|
-
import { EmbeddingModelUsage } from '../types/usage';
|
|
3
|
-
import {
|
|
4
|
-
import { Warning } from '../types/warning';
|
|
1
|
+
import type { Embedding, ProviderMetadata } from '../types';
|
|
2
|
+
import type { EmbeddingModelUsage } from '../types/usage';
|
|
3
|
+
import type { Warning } from '../types/warning';
|
|
5
4
|
|
|
6
5
|
/**
|
|
7
6
|
* The result of an `embedMany` call.
|
package/src/embed/embed-many.ts
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createIdGenerator,
|
|
3
|
-
ProviderOptions,
|
|
4
3
|
withUserAgentSuffix,
|
|
4
|
+
type ProviderOptions,
|
|
5
5
|
} from '@ai-sdk/provider-utils';
|
|
6
6
|
import { logWarnings } from '../logger/log-warnings';
|
|
7
7
|
import { resolveEmbeddingModel } from '../model/resolve-model';
|
|
8
8
|
import { createTelemetryDispatcher } from '../telemetry/create-telemetry-dispatcher';
|
|
9
|
-
import { TelemetryOptions } from '../telemetry/telemetry-options';
|
|
10
|
-
import { Embedding, EmbeddingModel, ProviderMetadata } from '../types';
|
|
11
|
-
import { Warning } from '../types/warning';
|
|
9
|
+
import type { TelemetryOptions } from '../telemetry/telemetry-options';
|
|
10
|
+
import type { Embedding, EmbeddingModel, ProviderMetadata } from '../types';
|
|
11
|
+
import type { Warning } from '../types/warning';
|
|
12
12
|
import type { Callback } from '../util/callback';
|
|
13
13
|
import { notify } from '../util/notify';
|
|
14
14
|
import { prepareRetries } from '../util/prepare-retries';
|
|
15
15
|
import { splitArray } from '../util/split-array';
|
|
16
16
|
import type { EmbedEndEvent, EmbedStartEvent } from './embed-events';
|
|
17
|
-
import { EmbedManyResult } from './embed-many-result';
|
|
17
|
+
import type { EmbedManyResult } from './embed-many-result';
|
|
18
18
|
import { VERSION } from '../version';
|
|
19
19
|
|
|
20
20
|
const originalGenerateCallId = createIdGenerator({
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { Embedding } from '../types';
|
|
2
|
-
import { EmbeddingModelUsage } from '../types/usage';
|
|
3
|
-
import {
|
|
4
|
-
import { Warning } from '../types/warning';
|
|
1
|
+
import type { Embedding, ProviderMetadata } from '../types';
|
|
2
|
+
import type { EmbeddingModelUsage } from '../types/usage';
|
|
3
|
+
import type { Warning } from '../types/warning';
|
|
5
4
|
|
|
6
5
|
/**
|
|
7
6
|
* The result of an `embed` call.
|