@ai-sdk/vercel 3.0.0-beta.3 → 3.0.0-beta.31

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 CHANGED
@@ -1,5 +1,248 @@
1
1
  # @ai-sdk/vercel
2
2
 
3
+ ## 3.0.0-beta.31
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [2e98477]
8
+ - Updated dependencies [bfb756d]
9
+ - @ai-sdk/provider-utils@5.0.0-beta.26
10
+ - @ai-sdk/openai-compatible@3.0.0-beta.31
11
+
12
+ ## 3.0.0-beta.30
13
+
14
+ ### Patch Changes
15
+
16
+ - Updated dependencies [eea8d98]
17
+ - @ai-sdk/provider-utils@5.0.0-beta.25
18
+ - @ai-sdk/openai-compatible@3.0.0-beta.30
19
+
20
+ ## 3.0.0-beta.29
21
+
22
+ ### Patch Changes
23
+
24
+ - Updated dependencies [f807e45]
25
+ - @ai-sdk/provider-utils@5.0.0-beta.24
26
+ - @ai-sdk/openai-compatible@3.0.0-beta.29
27
+
28
+ ## 3.0.0-beta.28
29
+
30
+ ### Patch Changes
31
+
32
+ - Updated dependencies [350ea38]
33
+ - @ai-sdk/provider-utils@5.0.0-beta.23
34
+ - @ai-sdk/openai-compatible@3.0.0-beta.28
35
+
36
+ ## 3.0.0-beta.27
37
+
38
+ ### Patch Changes
39
+
40
+ - Updated dependencies [083947b]
41
+ - @ai-sdk/provider-utils@5.0.0-beta.22
42
+ - @ai-sdk/openai-compatible@3.0.0-beta.27
43
+
44
+ ## 3.0.0-beta.26
45
+
46
+ ### Patch Changes
47
+
48
+ - Updated dependencies [add1126]
49
+ - @ai-sdk/provider-utils@5.0.0-beta.21
50
+ - @ai-sdk/openai-compatible@3.0.0-beta.26
51
+
52
+ ## 3.0.0-beta.25
53
+
54
+ ### Patch Changes
55
+
56
+ - Updated dependencies [b3976a2]
57
+ - Updated dependencies [ff5eba1]
58
+ - @ai-sdk/provider-utils@5.0.0-beta.20
59
+ - @ai-sdk/openai-compatible@3.0.0-beta.25
60
+ - @ai-sdk/provider@4.0.0-beta.12
61
+
62
+ ## 3.0.0-beta.24
63
+
64
+ ### Major Changes
65
+
66
+ - ef992f8: Remove CommonJS exports from all packages. All packages are now ESM-only (`"type": "module"`). Consumers using `require()` must switch to ESM `import` syntax.
67
+
68
+ ### Patch Changes
69
+
70
+ - Updated dependencies [ef992f8]
71
+ - @ai-sdk/openai-compatible@3.0.0-beta.24
72
+ - @ai-sdk/provider@4.0.0-beta.11
73
+ - @ai-sdk/provider-utils@5.0.0-beta.19
74
+
75
+ ## 3.0.0-beta.23
76
+
77
+ ### Patch Changes
78
+
79
+ - 90e2d8a: chore: fix unused vars not being flagged by our lint tooling
80
+ - Updated dependencies [90e2d8a]
81
+ - @ai-sdk/openai-compatible@3.0.0-beta.23
82
+ - @ai-sdk/provider-utils@5.0.0-beta.18
83
+
84
+ ## 3.0.0-beta.22
85
+
86
+ ### Patch Changes
87
+
88
+ - Updated dependencies [3ae1786]
89
+ - @ai-sdk/provider-utils@5.0.0-beta.17
90
+ - @ai-sdk/openai-compatible@3.0.0-beta.22
91
+
92
+ ## 3.0.0-beta.21
93
+
94
+ ### Patch Changes
95
+
96
+ - Updated dependencies [176466a]
97
+ - @ai-sdk/provider@4.0.0-beta.10
98
+ - @ai-sdk/openai-compatible@3.0.0-beta.21
99
+ - @ai-sdk/provider-utils@5.0.0-beta.16
100
+
101
+ ## 3.0.0-beta.20
102
+
103
+ ### Patch Changes
104
+
105
+ - Updated dependencies [e311194]
106
+ - @ai-sdk/provider@4.0.0-beta.9
107
+ - @ai-sdk/openai-compatible@3.0.0-beta.20
108
+ - @ai-sdk/provider-utils@5.0.0-beta.15
109
+
110
+ ## 3.0.0-beta.19
111
+
112
+ ### Patch Changes
113
+
114
+ - Updated dependencies [34bd95d]
115
+ - Updated dependencies [008271d]
116
+ - @ai-sdk/provider@4.0.0-beta.8
117
+ - @ai-sdk/openai-compatible@3.0.0-beta.19
118
+ - @ai-sdk/provider-utils@5.0.0-beta.14
119
+
120
+ ## 3.0.0-beta.18
121
+
122
+ ### Patch Changes
123
+
124
+ - Updated dependencies [b0c2869]
125
+ - Updated dependencies [7e26e81]
126
+ - @ai-sdk/provider-utils@5.0.0-beta.13
127
+ - @ai-sdk/openai-compatible@3.0.0-beta.18
128
+
129
+ ## 3.0.0-beta.17
130
+
131
+ ### Patch Changes
132
+
133
+ - Updated dependencies [816ff67]
134
+ - @ai-sdk/openai-compatible@3.0.0-beta.17
135
+
136
+ ## 3.0.0-beta.16
137
+
138
+ ### Patch Changes
139
+
140
+ - Updated dependencies [46d1149]
141
+ - @ai-sdk/provider-utils@5.0.0-beta.12
142
+ - @ai-sdk/openai-compatible@3.0.0-beta.16
143
+
144
+ ## 3.0.0-beta.15
145
+
146
+ ### Patch Changes
147
+
148
+ - Updated dependencies [6fd51c0]
149
+ - @ai-sdk/provider-utils@5.0.0-beta.11
150
+ - @ai-sdk/provider@4.0.0-beta.7
151
+ - @ai-sdk/openai-compatible@3.0.0-beta.15
152
+
153
+ ## 3.0.0-beta.14
154
+
155
+ ### Patch Changes
156
+
157
+ - Updated dependencies [c29a26f]
158
+ - @ai-sdk/openai-compatible@3.0.0-beta.14
159
+ - @ai-sdk/provider-utils@5.0.0-beta.10
160
+ - @ai-sdk/provider@4.0.0-beta.6
161
+
162
+ ## 3.0.0-beta.13
163
+
164
+ ### Patch Changes
165
+
166
+ - Updated dependencies [38fc777]
167
+ - @ai-sdk/openai-compatible@3.0.0-beta.13
168
+
169
+ ## 3.0.0-beta.12
170
+
171
+ ### Patch Changes
172
+
173
+ - Updated dependencies [2e17091]
174
+ - @ai-sdk/provider-utils@5.0.0-beta.9
175
+ - @ai-sdk/openai-compatible@3.0.0-beta.12
176
+
177
+ ## 3.0.0-beta.11
178
+
179
+ ### Patch Changes
180
+
181
+ - Updated dependencies [986c6fd]
182
+ - Updated dependencies [493295c]
183
+ - @ai-sdk/provider-utils@5.0.0-beta.8
184
+ - @ai-sdk/openai-compatible@3.0.0-beta.11
185
+
186
+ ## 3.0.0-beta.10
187
+
188
+ ### Patch Changes
189
+
190
+ - Updated dependencies [1f509d4]
191
+ - @ai-sdk/provider-utils@5.0.0-beta.7
192
+ - @ai-sdk/provider@4.0.0-beta.5
193
+ - @ai-sdk/openai-compatible@3.0.0-beta.10
194
+
195
+ ## 3.0.0-beta.9
196
+
197
+ ### Patch Changes
198
+
199
+ - Updated dependencies [74d520f]
200
+ - @ai-sdk/openai-compatible@3.0.0-beta.9
201
+
202
+ ## 3.0.0-beta.8
203
+
204
+ ### Patch Changes
205
+
206
+ - Updated dependencies [3887c70]
207
+ - @ai-sdk/provider-utils@5.0.0-beta.6
208
+ - @ai-sdk/provider@4.0.0-beta.4
209
+ - @ai-sdk/openai-compatible@3.0.0-beta.8
210
+
211
+ ## 3.0.0-beta.7
212
+
213
+ ### Patch Changes
214
+
215
+ - Updated dependencies [776b617]
216
+ - @ai-sdk/provider-utils@5.0.0-beta.5
217
+ - @ai-sdk/provider@4.0.0-beta.3
218
+ - @ai-sdk/openai-compatible@3.0.0-beta.7
219
+
220
+ ## 3.0.0-beta.6
221
+
222
+ ### Patch Changes
223
+
224
+ - Updated dependencies [61753c3]
225
+ - @ai-sdk/provider-utils@5.0.0-beta.4
226
+ - @ai-sdk/openai-compatible@3.0.0-beta.6
227
+
228
+ ## 3.0.0-beta.5
229
+
230
+ ### Patch Changes
231
+
232
+ - Updated dependencies [f7d4f01]
233
+ - @ai-sdk/provider-utils@5.0.0-beta.3
234
+ - @ai-sdk/provider@4.0.0-beta.2
235
+ - @ai-sdk/openai-compatible@3.0.0-beta.5
236
+
237
+ ## 3.0.0-beta.4
238
+
239
+ ### Patch Changes
240
+
241
+ - Updated dependencies [5c2a5a2]
242
+ - @ai-sdk/provider@4.0.0-beta.1
243
+ - @ai-sdk/openai-compatible@3.0.0-beta.4
244
+ - @ai-sdk/provider-utils@5.0.0-beta.2
245
+
3
246
  ## 3.0.0-beta.3
4
247
 
5
248
  ### Patch Changes
@@ -343,13 +586,13 @@
343
586
  Before
344
587
 
345
588
  ```ts
346
- model.textEmbeddingModel('my-model-id');
589
+ model.textEmbeddingModel("my-model-id");
347
590
  ```
348
591
 
349
592
  After
350
593
 
351
594
  ```ts
352
- model.embeddingModel('my-model-id');
595
+ model.embeddingModel("my-model-id");
353
596
  ```
354
597
 
355
598
  - ed329cb: feat: `Provider-V3`
@@ -569,13 +812,13 @@
569
812
  Before
570
813
 
571
814
  ```ts
572
- model.textEmbeddingModel('my-model-id');
815
+ model.textEmbeddingModel("my-model-id");
573
816
  ```
574
817
 
575
818
  After
576
819
 
577
820
  ```ts
578
- model.embeddingModel('my-model-id');
821
+ model.embeddingModel("my-model-id");
579
822
  ```
580
823
 
581
824
  - Updated dependencies [8d9e8ad]
package/dist/index.js CHANGED
@@ -1,48 +1,26 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
-
20
- // src/index.ts
21
- var index_exports = {};
22
- __export(index_exports, {
23
- VERSION: () => VERSION,
24
- createVercel: () => createVercel,
25
- vercel: () => vercel
26
- });
27
- module.exports = __toCommonJS(index_exports);
28
-
29
1
  // src/vercel-provider.ts
30
- var import_provider = require("@ai-sdk/provider");
31
- var import_openai_compatible = require("@ai-sdk/openai-compatible");
32
- var import_provider_utils = require("@ai-sdk/provider-utils");
2
+ import {
3
+ NoSuchModelError
4
+ } from "@ai-sdk/provider";
5
+ import { OpenAICompatibleChatLanguageModel } from "@ai-sdk/openai-compatible";
6
+ import {
7
+ loadApiKey,
8
+ withoutTrailingSlash,
9
+ withUserAgentSuffix
10
+ } from "@ai-sdk/provider-utils";
33
11
 
34
12
  // src/version.ts
35
- var VERSION = true ? "3.0.0-beta.3" : "0.0.0-test";
13
+ var VERSION = true ? "3.0.0-beta.31" : "0.0.0-test";
36
14
 
37
15
  // src/vercel-provider.ts
38
16
  function createVercel(options = {}) {
39
17
  var _a;
40
- const baseURL = (0, import_provider_utils.withoutTrailingSlash)(
18
+ const baseURL = withoutTrailingSlash(
41
19
  (_a = options.baseURL) != null ? _a : "https://api.v0.dev/v1"
42
20
  );
43
- const getHeaders = () => (0, import_provider_utils.withUserAgentSuffix)(
21
+ const getHeaders = () => withUserAgentSuffix(
44
22
  {
45
- Authorization: `Bearer ${(0, import_provider_utils.loadApiKey)({
23
+ Authorization: `Bearer ${loadApiKey({
46
24
  apiKey: options.apiKey,
47
25
  environmentVariableName: "VERCEL_API_KEY",
48
26
  description: "Vercel"
@@ -58,7 +36,7 @@ function createVercel(options = {}) {
58
36
  fetch: options.fetch
59
37
  });
60
38
  const createChatModel = (modelId) => {
61
- return new import_openai_compatible.OpenAICompatibleChatLanguageModel(modelId, {
39
+ return new OpenAICompatibleChatLanguageModel(modelId, {
62
40
  ...getCommonModelConfig("chat")
63
41
  });
64
42
  };
@@ -66,19 +44,18 @@ function createVercel(options = {}) {
66
44
  provider.specificationVersion = "v4";
67
45
  provider.languageModel = createChatModel;
68
46
  provider.embeddingModel = (modelId) => {
69
- throw new import_provider.NoSuchModelError({ modelId, modelType: "embeddingModel" });
47
+ throw new NoSuchModelError({ modelId, modelType: "embeddingModel" });
70
48
  };
71
49
  provider.textEmbeddingModel = provider.embeddingModel;
72
50
  provider.imageModel = (modelId) => {
73
- throw new import_provider.NoSuchModelError({ modelId, modelType: "imageModel" });
51
+ throw new NoSuchModelError({ modelId, modelType: "imageModel" });
74
52
  };
75
53
  return provider;
76
54
  }
77
55
  var vercel = createVercel();
78
- // Annotate the CommonJS export names for ESM import in node:
79
- 0 && (module.exports = {
56
+ export {
80
57
  VERSION,
81
58
  createVercel,
82
59
  vercel
83
- });
60
+ };
84
61
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts","../src/vercel-provider.ts","../src/version.ts"],"sourcesContent":["export { createVercel, vercel } from './vercel-provider';\nexport type { VercelProvider, VercelProviderSettings } from './vercel-provider';\nexport type { OpenAICompatibleErrorData as VercelErrorData } from '@ai-sdk/openai-compatible';\nexport { VERSION } from './version';\n","import {\n LanguageModelV4,\n NoSuchModelError,\n ProviderV4,\n} from '@ai-sdk/provider';\nimport { OpenAICompatibleChatLanguageModel } from '@ai-sdk/openai-compatible';\nimport {\n FetchFunction,\n loadApiKey,\n withoutTrailingSlash,\n withUserAgentSuffix,\n} from '@ai-sdk/provider-utils';\nimport { VercelChatModelId } from './vercel-chat-options';\nimport { VERSION } from './version';\n\nexport interface VercelProviderSettings {\n /**\n * Vercel API key.\n */\n apiKey?: string;\n /**\n * Base URL for the API calls.\n */\n baseURL?: string;\n /**\n * Custom headers to include in the requests.\n */\n headers?: Record<string, string>;\n /**\n * Custom fetch implementation. You can use it as a middleware to intercept requests,\n * or to provide a custom fetch implementation for e.g. testing.\n */\n fetch?: FetchFunction;\n}\n\nexport interface VercelProvider extends ProviderV4 {\n /**\n * Creates a model for text generation.\n */\n (modelId: VercelChatModelId): LanguageModelV4;\n\n /**\n * Creates a language model for text generation.\n */\n languageModel(modelId: VercelChatModelId): LanguageModelV4;\n\n /**\n * @deprecated Use `embeddingModel` instead.\n */\n textEmbeddingModel(modelId: string): never;\n}\n\nexport function createVercel(\n options: VercelProviderSettings = {},\n): VercelProvider {\n const baseURL = withoutTrailingSlash(\n options.baseURL ?? 'https://api.v0.dev/v1',\n );\n const getHeaders = () =>\n withUserAgentSuffix(\n {\n Authorization: `Bearer ${loadApiKey({\n apiKey: options.apiKey,\n environmentVariableName: 'VERCEL_API_KEY',\n description: 'Vercel',\n })}`,\n ...options.headers,\n },\n `ai-sdk/vercel/${VERSION}`,\n );\n\n interface CommonModelConfig {\n provider: string;\n url: ({ path }: { path: string }) => string;\n headers: () => Record<string, string>;\n fetch?: FetchFunction;\n }\n\n const getCommonModelConfig = (modelType: string): CommonModelConfig => ({\n provider: `vercel.${modelType}`,\n url: ({ path }) => `${baseURL}${path}`,\n headers: getHeaders,\n fetch: options.fetch,\n });\n\n const createChatModel = (modelId: VercelChatModelId) => {\n return new OpenAICompatibleChatLanguageModel(modelId, {\n ...getCommonModelConfig('chat'),\n });\n };\n\n const provider = (modelId: VercelChatModelId) => createChatModel(modelId);\n\n provider.specificationVersion = 'v4' as const;\n provider.languageModel = createChatModel;\n provider.embeddingModel = (modelId: string) => {\n throw new NoSuchModelError({ modelId, modelType: 'embeddingModel' });\n };\n provider.textEmbeddingModel = provider.embeddingModel;\n provider.imageModel = (modelId: string) => {\n throw new NoSuchModelError({ modelId, modelType: 'imageModel' });\n };\n\n return provider;\n}\n\nexport const vercel = createVercel();\n","// Version string of this package injected at build time.\ndeclare const __PACKAGE_VERSION__: string | undefined;\nexport const VERSION: string =\n typeof __PACKAGE_VERSION__ !== 'undefined'\n ? __PACKAGE_VERSION__\n : '0.0.0-test';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,sBAIO;AACP,+BAAkD;AAClD,4BAKO;;;ACTA,IAAM,UACX,OACI,iBACA;;;AD+CC,SAAS,aACd,UAAkC,CAAC,GACnB;AAtDlB;AAuDE,QAAM,cAAU;AAAA,KACd,aAAQ,YAAR,YAAmB;AAAA,EACrB;AACA,QAAM,aAAa,UACjB;AAAA,IACE;AAAA,MACE,eAAe,cAAU,kCAAW;AAAA,QAClC,QAAQ,QAAQ;AAAA,QAChB,yBAAyB;AAAA,QACzB,aAAa;AAAA,MACf,CAAC,CAAC;AAAA,MACF,GAAG,QAAQ;AAAA,IACb;AAAA,IACA,iBAAiB,OAAO;AAAA,EAC1B;AASF,QAAM,uBAAuB,CAAC,eAA0C;AAAA,IACtE,UAAU,UAAU,SAAS;AAAA,IAC7B,KAAK,CAAC,EAAE,KAAK,MAAM,GAAG,OAAO,GAAG,IAAI;AAAA,IACpC,SAAS;AAAA,IACT,OAAO,QAAQ;AAAA,EACjB;AAEA,QAAM,kBAAkB,CAAC,YAA+B;AACtD,WAAO,IAAI,2DAAkC,SAAS;AAAA,MACpD,GAAG,qBAAqB,MAAM;AAAA,IAChC,CAAC;AAAA,EACH;AAEA,QAAM,WAAW,CAAC,YAA+B,gBAAgB,OAAO;AAExE,WAAS,uBAAuB;AAChC,WAAS,gBAAgB;AACzB,WAAS,iBAAiB,CAAC,YAAoB;AAC7C,UAAM,IAAI,iCAAiB,EAAE,SAAS,WAAW,iBAAiB,CAAC;AAAA,EACrE;AACA,WAAS,qBAAqB,SAAS;AACvC,WAAS,aAAa,CAAC,YAAoB;AACzC,UAAM,IAAI,iCAAiB,EAAE,SAAS,WAAW,aAAa,CAAC;AAAA,EACjE;AAEA,SAAO;AACT;AAEO,IAAM,SAAS,aAAa;","names":[]}
1
+ {"version":3,"sources":["../src/vercel-provider.ts","../src/version.ts"],"sourcesContent":["import {\n LanguageModelV4,\n NoSuchModelError,\n ProviderV4,\n} from '@ai-sdk/provider';\nimport { OpenAICompatibleChatLanguageModel } from '@ai-sdk/openai-compatible';\nimport {\n FetchFunction,\n loadApiKey,\n withoutTrailingSlash,\n withUserAgentSuffix,\n} from '@ai-sdk/provider-utils';\nimport { VercelChatModelId } from './vercel-chat-options';\nimport { VERSION } from './version';\n\nexport interface VercelProviderSettings {\n /**\n * Vercel API key.\n */\n apiKey?: string;\n /**\n * Base URL for the API calls.\n */\n baseURL?: string;\n /**\n * Custom headers to include in the requests.\n */\n headers?: Record<string, string>;\n /**\n * Custom fetch implementation. You can use it as a middleware to intercept requests,\n * or to provide a custom fetch implementation for e.g. testing.\n */\n fetch?: FetchFunction;\n}\n\nexport interface VercelProvider extends ProviderV4 {\n /**\n * Creates a model for text generation.\n */\n (modelId: VercelChatModelId): LanguageModelV4;\n\n /**\n * Creates a language model for text generation.\n */\n languageModel(modelId: VercelChatModelId): LanguageModelV4;\n\n /**\n * @deprecated Use `embeddingModel` instead.\n */\n textEmbeddingModel(modelId: string): never;\n}\n\nexport function createVercel(\n options: VercelProviderSettings = {},\n): VercelProvider {\n const baseURL = withoutTrailingSlash(\n options.baseURL ?? 'https://api.v0.dev/v1',\n );\n const getHeaders = () =>\n withUserAgentSuffix(\n {\n Authorization: `Bearer ${loadApiKey({\n apiKey: options.apiKey,\n environmentVariableName: 'VERCEL_API_KEY',\n description: 'Vercel',\n })}`,\n ...options.headers,\n },\n `ai-sdk/vercel/${VERSION}`,\n );\n\n interface CommonModelConfig {\n provider: string;\n url: ({ path }: { path: string }) => string;\n headers: () => Record<string, string>;\n fetch?: FetchFunction;\n }\n\n const getCommonModelConfig = (modelType: string): CommonModelConfig => ({\n provider: `vercel.${modelType}`,\n url: ({ path }) => `${baseURL}${path}`,\n headers: getHeaders,\n fetch: options.fetch,\n });\n\n const createChatModel = (modelId: VercelChatModelId) => {\n return new OpenAICompatibleChatLanguageModel(modelId, {\n ...getCommonModelConfig('chat'),\n });\n };\n\n const provider = (modelId: VercelChatModelId) => createChatModel(modelId);\n\n provider.specificationVersion = 'v4' as const;\n provider.languageModel = createChatModel;\n provider.embeddingModel = (modelId: string) => {\n throw new NoSuchModelError({ modelId, modelType: 'embeddingModel' });\n };\n provider.textEmbeddingModel = provider.embeddingModel;\n provider.imageModel = (modelId: string) => {\n throw new NoSuchModelError({ modelId, modelType: 'imageModel' });\n };\n\n return provider;\n}\n\nexport const vercel = createVercel();\n","// Version string of this package injected at build time.\ndeclare const __PACKAGE_VERSION__: string | undefined;\nexport const VERSION: string =\n typeof __PACKAGE_VERSION__ !== 'undefined'\n ? __PACKAGE_VERSION__\n : '0.0.0-test';\n"],"mappings":";AAAA;AAAA,EAEE;AAAA,OAEK;AACP,SAAS,yCAAyC;AAClD;AAAA,EAEE;AAAA,EACA;AAAA,EACA;AAAA,OACK;;;ACTA,IAAM,UACX,OACI,kBACA;;;AD+CC,SAAS,aACd,UAAkC,CAAC,GACnB;AAtDlB;AAuDE,QAAM,UAAU;AAAA,KACd,aAAQ,YAAR,YAAmB;AAAA,EACrB;AACA,QAAM,aAAa,MACjB;AAAA,IACE;AAAA,MACE,eAAe,UAAU,WAAW;AAAA,QAClC,QAAQ,QAAQ;AAAA,QAChB,yBAAyB;AAAA,QACzB,aAAa;AAAA,MACf,CAAC,CAAC;AAAA,MACF,GAAG,QAAQ;AAAA,IACb;AAAA,IACA,iBAAiB,OAAO;AAAA,EAC1B;AASF,QAAM,uBAAuB,CAAC,eAA0C;AAAA,IACtE,UAAU,UAAU,SAAS;AAAA,IAC7B,KAAK,CAAC,EAAE,KAAK,MAAM,GAAG,OAAO,GAAG,IAAI;AAAA,IACpC,SAAS;AAAA,IACT,OAAO,QAAQ;AAAA,EACjB;AAEA,QAAM,kBAAkB,CAAC,YAA+B;AACtD,WAAO,IAAI,kCAAkC,SAAS;AAAA,MACpD,GAAG,qBAAqB,MAAM;AAAA,IAChC,CAAC;AAAA,EACH;AAEA,QAAM,WAAW,CAAC,YAA+B,gBAAgB,OAAO;AAExE,WAAS,uBAAuB;AAChC,WAAS,gBAAgB;AACzB,WAAS,iBAAiB,CAAC,YAAoB;AAC7C,UAAM,IAAI,iBAAiB,EAAE,SAAS,WAAW,iBAAiB,CAAC;AAAA,EACrE;AACA,WAAS,qBAAqB,SAAS;AACvC,WAAS,aAAa,CAAC,YAAoB;AACzC,UAAM,IAAI,iBAAiB,EAAE,SAAS,WAAW,aAAa,CAAC;AAAA,EACjE;AAEA,SAAO;AACT;AAEO,IAAM,SAAS,aAAa;","names":[]}
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "@ai-sdk/vercel",
3
- "version": "3.0.0-beta.3",
3
+ "version": "3.0.0-beta.31",
4
+ "type": "module",
4
5
  "license": "Apache-2.0",
5
6
  "sideEffects": false,
6
7
  "main": "./dist/index.js",
7
- "module": "./dist/index.mjs",
8
8
  "types": "./dist/index.d.ts",
9
9
  "files": [
10
10
  "dist/**/*",
@@ -24,14 +24,14 @@
24
24
  "./package.json": "./package.json",
25
25
  ".": {
26
26
  "types": "./dist/index.d.ts",
27
- "import": "./dist/index.mjs",
28
- "require": "./dist/index.js"
27
+ "import": "./dist/index.js",
28
+ "default": "./dist/index.js"
29
29
  }
30
30
  },
31
31
  "dependencies": {
32
- "@ai-sdk/provider": "4.0.0-beta.0",
33
- "@ai-sdk/provider-utils": "5.0.0-beta.1",
34
- "@ai-sdk/openai-compatible": "3.0.0-beta.3"
32
+ "@ai-sdk/openai-compatible": "3.0.0-beta.31",
33
+ "@ai-sdk/provider": "4.0.0-beta.12",
34
+ "@ai-sdk/provider-utils": "5.0.0-beta.26"
35
35
  },
36
36
  "devDependencies": {
37
37
  "@types/node": "20.17.24",
@@ -64,9 +64,7 @@
64
64
  "build": "pnpm clean && tsup --tsconfig tsconfig.build.json",
65
65
  "build:watch": "pnpm clean && tsup --watch",
66
66
  "clean": "del-cli dist docs *.tsbuildinfo",
67
- "lint": "eslint \"./**/*.ts*\"",
68
67
  "type-check": "tsc --build",
69
- "prettier-check": "prettier --check \"./**/*.ts*\"",
70
68
  "test": "pnpm test:node && pnpm test:edge",
71
69
  "test:update": "pnpm test:node -u",
72
70
  "test:watch": "vitest --config vitest.node.config.js",
package/dist/index.d.mts DELETED
@@ -1,45 +0,0 @@
1
- import { ProviderV4, LanguageModelV4 } from '@ai-sdk/provider';
2
- import { FetchFunction } from '@ai-sdk/provider-utils';
3
- export { OpenAICompatibleErrorData as VercelErrorData } from '@ai-sdk/openai-compatible';
4
-
5
- type VercelChatModelId = 'v0-1.0-md' | 'v0-1.5-md' | 'v0-1.5-lg' | (string & {});
6
-
7
- interface VercelProviderSettings {
8
- /**
9
- * Vercel API key.
10
- */
11
- apiKey?: string;
12
- /**
13
- * Base URL for the API calls.
14
- */
15
- baseURL?: string;
16
- /**
17
- * Custom headers to include in the requests.
18
- */
19
- headers?: Record<string, string>;
20
- /**
21
- * Custom fetch implementation. You can use it as a middleware to intercept requests,
22
- * or to provide a custom fetch implementation for e.g. testing.
23
- */
24
- fetch?: FetchFunction;
25
- }
26
- interface VercelProvider extends ProviderV4 {
27
- /**
28
- * Creates a model for text generation.
29
- */
30
- (modelId: VercelChatModelId): LanguageModelV4;
31
- /**
32
- * Creates a language model for text generation.
33
- */
34
- languageModel(modelId: VercelChatModelId): LanguageModelV4;
35
- /**
36
- * @deprecated Use `embeddingModel` instead.
37
- */
38
- textEmbeddingModel(modelId: string): never;
39
- }
40
- declare function createVercel(options?: VercelProviderSettings): VercelProvider;
41
- declare const vercel: VercelProvider;
42
-
43
- declare const VERSION: string;
44
-
45
- export { VERSION, type VercelProvider, type VercelProviderSettings, createVercel, vercel };
package/dist/index.mjs DELETED
@@ -1,61 +0,0 @@
1
- // src/vercel-provider.ts
2
- import {
3
- NoSuchModelError
4
- } from "@ai-sdk/provider";
5
- import { OpenAICompatibleChatLanguageModel } from "@ai-sdk/openai-compatible";
6
- import {
7
- loadApiKey,
8
- withoutTrailingSlash,
9
- withUserAgentSuffix
10
- } from "@ai-sdk/provider-utils";
11
-
12
- // src/version.ts
13
- var VERSION = true ? "3.0.0-beta.3" : "0.0.0-test";
14
-
15
- // src/vercel-provider.ts
16
- function createVercel(options = {}) {
17
- var _a;
18
- const baseURL = withoutTrailingSlash(
19
- (_a = options.baseURL) != null ? _a : "https://api.v0.dev/v1"
20
- );
21
- const getHeaders = () => withUserAgentSuffix(
22
- {
23
- Authorization: `Bearer ${loadApiKey({
24
- apiKey: options.apiKey,
25
- environmentVariableName: "VERCEL_API_KEY",
26
- description: "Vercel"
27
- })}`,
28
- ...options.headers
29
- },
30
- `ai-sdk/vercel/${VERSION}`
31
- );
32
- const getCommonModelConfig = (modelType) => ({
33
- provider: `vercel.${modelType}`,
34
- url: ({ path }) => `${baseURL}${path}`,
35
- headers: getHeaders,
36
- fetch: options.fetch
37
- });
38
- const createChatModel = (modelId) => {
39
- return new OpenAICompatibleChatLanguageModel(modelId, {
40
- ...getCommonModelConfig("chat")
41
- });
42
- };
43
- const provider = (modelId) => createChatModel(modelId);
44
- provider.specificationVersion = "v4";
45
- provider.languageModel = createChatModel;
46
- provider.embeddingModel = (modelId) => {
47
- throw new NoSuchModelError({ modelId, modelType: "embeddingModel" });
48
- };
49
- provider.textEmbeddingModel = provider.embeddingModel;
50
- provider.imageModel = (modelId) => {
51
- throw new NoSuchModelError({ modelId, modelType: "imageModel" });
52
- };
53
- return provider;
54
- }
55
- var vercel = createVercel();
56
- export {
57
- VERSION,
58
- createVercel,
59
- vercel
60
- };
61
- //# sourceMappingURL=index.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/vercel-provider.ts","../src/version.ts"],"sourcesContent":["import {\n LanguageModelV4,\n NoSuchModelError,\n ProviderV4,\n} from '@ai-sdk/provider';\nimport { OpenAICompatibleChatLanguageModel } from '@ai-sdk/openai-compatible';\nimport {\n FetchFunction,\n loadApiKey,\n withoutTrailingSlash,\n withUserAgentSuffix,\n} from '@ai-sdk/provider-utils';\nimport { VercelChatModelId } from './vercel-chat-options';\nimport { VERSION } from './version';\n\nexport interface VercelProviderSettings {\n /**\n * Vercel API key.\n */\n apiKey?: string;\n /**\n * Base URL for the API calls.\n */\n baseURL?: string;\n /**\n * Custom headers to include in the requests.\n */\n headers?: Record<string, string>;\n /**\n * Custom fetch implementation. You can use it as a middleware to intercept requests,\n * or to provide a custom fetch implementation for e.g. testing.\n */\n fetch?: FetchFunction;\n}\n\nexport interface VercelProvider extends ProviderV4 {\n /**\n * Creates a model for text generation.\n */\n (modelId: VercelChatModelId): LanguageModelV4;\n\n /**\n * Creates a language model for text generation.\n */\n languageModel(modelId: VercelChatModelId): LanguageModelV4;\n\n /**\n * @deprecated Use `embeddingModel` instead.\n */\n textEmbeddingModel(modelId: string): never;\n}\n\nexport function createVercel(\n options: VercelProviderSettings = {},\n): VercelProvider {\n const baseURL = withoutTrailingSlash(\n options.baseURL ?? 'https://api.v0.dev/v1',\n );\n const getHeaders = () =>\n withUserAgentSuffix(\n {\n Authorization: `Bearer ${loadApiKey({\n apiKey: options.apiKey,\n environmentVariableName: 'VERCEL_API_KEY',\n description: 'Vercel',\n })}`,\n ...options.headers,\n },\n `ai-sdk/vercel/${VERSION}`,\n );\n\n interface CommonModelConfig {\n provider: string;\n url: ({ path }: { path: string }) => string;\n headers: () => Record<string, string>;\n fetch?: FetchFunction;\n }\n\n const getCommonModelConfig = (modelType: string): CommonModelConfig => ({\n provider: `vercel.${modelType}`,\n url: ({ path }) => `${baseURL}${path}`,\n headers: getHeaders,\n fetch: options.fetch,\n });\n\n const createChatModel = (modelId: VercelChatModelId) => {\n return new OpenAICompatibleChatLanguageModel(modelId, {\n ...getCommonModelConfig('chat'),\n });\n };\n\n const provider = (modelId: VercelChatModelId) => createChatModel(modelId);\n\n provider.specificationVersion = 'v4' as const;\n provider.languageModel = createChatModel;\n provider.embeddingModel = (modelId: string) => {\n throw new NoSuchModelError({ modelId, modelType: 'embeddingModel' });\n };\n provider.textEmbeddingModel = provider.embeddingModel;\n provider.imageModel = (modelId: string) => {\n throw new NoSuchModelError({ modelId, modelType: 'imageModel' });\n };\n\n return provider;\n}\n\nexport const vercel = createVercel();\n","// Version string of this package injected at build time.\ndeclare const __PACKAGE_VERSION__: string | undefined;\nexport const VERSION: string =\n typeof __PACKAGE_VERSION__ !== 'undefined'\n ? __PACKAGE_VERSION__\n : '0.0.0-test';\n"],"mappings":";AAAA;AAAA,EAEE;AAAA,OAEK;AACP,SAAS,yCAAyC;AAClD;AAAA,EAEE;AAAA,EACA;AAAA,EACA;AAAA,OACK;;;ACTA,IAAM,UACX,OACI,iBACA;;;AD+CC,SAAS,aACd,UAAkC,CAAC,GACnB;AAtDlB;AAuDE,QAAM,UAAU;AAAA,KACd,aAAQ,YAAR,YAAmB;AAAA,EACrB;AACA,QAAM,aAAa,MACjB;AAAA,IACE;AAAA,MACE,eAAe,UAAU,WAAW;AAAA,QAClC,QAAQ,QAAQ;AAAA,QAChB,yBAAyB;AAAA,QACzB,aAAa;AAAA,MACf,CAAC,CAAC;AAAA,MACF,GAAG,QAAQ;AAAA,IACb;AAAA,IACA,iBAAiB,OAAO;AAAA,EAC1B;AASF,QAAM,uBAAuB,CAAC,eAA0C;AAAA,IACtE,UAAU,UAAU,SAAS;AAAA,IAC7B,KAAK,CAAC,EAAE,KAAK,MAAM,GAAG,OAAO,GAAG,IAAI;AAAA,IACpC,SAAS;AAAA,IACT,OAAO,QAAQ;AAAA,EACjB;AAEA,QAAM,kBAAkB,CAAC,YAA+B;AACtD,WAAO,IAAI,kCAAkC,SAAS;AAAA,MACpD,GAAG,qBAAqB,MAAM;AAAA,IAChC,CAAC;AAAA,EACH;AAEA,QAAM,WAAW,CAAC,YAA+B,gBAAgB,OAAO;AAExE,WAAS,uBAAuB;AAChC,WAAS,gBAAgB;AACzB,WAAS,iBAAiB,CAAC,YAAoB;AAC7C,UAAM,IAAI,iBAAiB,EAAE,SAAS,WAAW,iBAAiB,CAAC;AAAA,EACrE;AACA,WAAS,qBAAqB,SAAS;AACvC,WAAS,aAAa,CAAC,YAAoB;AACzC,UAAM,IAAI,iBAAiB,EAAE,SAAS,WAAW,aAAa,CAAC;AAAA,EACjE;AAEA,SAAO;AACT;AAEO,IAAM,SAAS,aAAa;","names":[]}