@ai-sdk/vercel 2.0.21 → 2.0.23
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 +15 -0
- package/dist/index.d.mts +13 -13
- package/dist/index.d.ts +13 -13
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
- package/src/vercel-provider.ts +13 -13
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
# @ai-sdk/vercel
|
|
2
2
|
|
|
3
|
+
## 2.0.23
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [9d056e6]
|
|
8
|
+
- @ai-sdk/openai-compatible@2.0.22
|
|
9
|
+
|
|
10
|
+
## 2.0.22
|
|
11
|
+
|
|
12
|
+
### Patch Changes
|
|
13
|
+
|
|
14
|
+
- Updated dependencies [462ad00]
|
|
15
|
+
- @ai-sdk/provider-utils@4.0.10
|
|
16
|
+
- @ai-sdk/openai-compatible@2.0.21
|
|
17
|
+
|
|
3
18
|
## 2.0.21
|
|
4
19
|
|
|
5
20
|
### Patch Changes
|
package/dist/index.d.mts
CHANGED
|
@@ -6,31 +6,31 @@ type VercelChatModelId = 'v0-1.0-md' | 'v0-1.5-md' | 'v0-1.5-lg' | (string & {})
|
|
|
6
6
|
|
|
7
7
|
interface VercelProviderSettings {
|
|
8
8
|
/**
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
* Vercel API key.
|
|
10
|
+
*/
|
|
11
11
|
apiKey?: string;
|
|
12
12
|
/**
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
* Base URL for the API calls.
|
|
14
|
+
*/
|
|
15
15
|
baseURL?: string;
|
|
16
16
|
/**
|
|
17
|
-
|
|
18
|
-
|
|
17
|
+
* Custom headers to include in the requests.
|
|
18
|
+
*/
|
|
19
19
|
headers?: Record<string, string>;
|
|
20
20
|
/**
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
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
24
|
fetch?: FetchFunction;
|
|
25
25
|
}
|
|
26
26
|
interface VercelProvider extends ProviderV3 {
|
|
27
27
|
/**
|
|
28
|
-
|
|
29
|
-
|
|
28
|
+
* Creates a model for text generation.
|
|
29
|
+
*/
|
|
30
30
|
(modelId: VercelChatModelId): LanguageModelV3;
|
|
31
31
|
/**
|
|
32
|
-
|
|
33
|
-
|
|
32
|
+
* Creates a language model for text generation.
|
|
33
|
+
*/
|
|
34
34
|
languageModel(modelId: VercelChatModelId): LanguageModelV3;
|
|
35
35
|
/**
|
|
36
36
|
* @deprecated Use `embeddingModel` instead.
|
package/dist/index.d.ts
CHANGED
|
@@ -6,31 +6,31 @@ type VercelChatModelId = 'v0-1.0-md' | 'v0-1.5-md' | 'v0-1.5-lg' | (string & {})
|
|
|
6
6
|
|
|
7
7
|
interface VercelProviderSettings {
|
|
8
8
|
/**
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
* Vercel API key.
|
|
10
|
+
*/
|
|
11
11
|
apiKey?: string;
|
|
12
12
|
/**
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
* Base URL for the API calls.
|
|
14
|
+
*/
|
|
15
15
|
baseURL?: string;
|
|
16
16
|
/**
|
|
17
|
-
|
|
18
|
-
|
|
17
|
+
* Custom headers to include in the requests.
|
|
18
|
+
*/
|
|
19
19
|
headers?: Record<string, string>;
|
|
20
20
|
/**
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
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
24
|
fetch?: FetchFunction;
|
|
25
25
|
}
|
|
26
26
|
interface VercelProvider extends ProviderV3 {
|
|
27
27
|
/**
|
|
28
|
-
|
|
29
|
-
|
|
28
|
+
* Creates a model for text generation.
|
|
29
|
+
*/
|
|
30
30
|
(modelId: VercelChatModelId): LanguageModelV3;
|
|
31
31
|
/**
|
|
32
|
-
|
|
33
|
-
|
|
32
|
+
* Creates a language model for text generation.
|
|
33
|
+
*/
|
|
34
34
|
languageModel(modelId: VercelChatModelId): LanguageModelV3;
|
|
35
35
|
/**
|
|
36
36
|
* @deprecated Use `embeddingModel` instead.
|
package/dist/index.js
CHANGED
|
@@ -32,7 +32,7 @@ var import_openai_compatible = require("@ai-sdk/openai-compatible");
|
|
|
32
32
|
var import_provider_utils = require("@ai-sdk/provider-utils");
|
|
33
33
|
|
|
34
34
|
// src/version.ts
|
|
35
|
-
var VERSION = true ? "2.0.
|
|
35
|
+
var VERSION = true ? "2.0.23" : "0.0.0-test";
|
|
36
36
|
|
|
37
37
|
// src/vercel-provider.ts
|
|
38
38
|
function createVercel(options = {}) {
|
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 LanguageModelV3,\n NoSuchModelError,\n ProviderV3,\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 /**\
|
|
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 LanguageModelV3,\n NoSuchModelError,\n ProviderV3,\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 ProviderV3 {\n /**\n * Creates a model for text generation.\n */\n (modelId: VercelChatModelId): LanguageModelV3;\n\n /**\n * Creates a language model for text generation.\n */\n languageModel(modelId: VercelChatModelId): LanguageModelV3;\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 = 'v3' 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,WACA;;;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":[]}
|
package/dist/index.mjs
CHANGED
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/vercel-provider.ts","../src/version.ts"],"sourcesContent":["import {\n LanguageModelV3,\n NoSuchModelError,\n ProviderV3,\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 /**\
|
|
1
|
+
{"version":3,"sources":["../src/vercel-provider.ts","../src/version.ts"],"sourcesContent":["import {\n LanguageModelV3,\n NoSuchModelError,\n ProviderV3,\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 ProviderV3 {\n /**\n * Creates a model for text generation.\n */\n (modelId: VercelChatModelId): LanguageModelV3;\n\n /**\n * Creates a language model for text generation.\n */\n languageModel(modelId: VercelChatModelId): LanguageModelV3;\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 = 'v3' 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,WACA;;;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,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ai-sdk/vercel",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.23",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -29,9 +29,9 @@
|
|
|
29
29
|
}
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@ai-sdk/openai-compatible": "2.0.
|
|
32
|
+
"@ai-sdk/openai-compatible": "2.0.22",
|
|
33
33
|
"@ai-sdk/provider": "3.0.5",
|
|
34
|
-
"@ai-sdk/provider-utils": "4.0.
|
|
34
|
+
"@ai-sdk/provider-utils": "4.0.10"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
37
|
"@types/node": "20.17.24",
|
package/src/vercel-provider.ts
CHANGED
|
@@ -15,33 +15,33 @@ import { VERSION } from './version';
|
|
|
15
15
|
|
|
16
16
|
export interface VercelProviderSettings {
|
|
17
17
|
/**
|
|
18
|
-
Vercel API key.
|
|
19
|
-
*/
|
|
18
|
+
* Vercel API key.
|
|
19
|
+
*/
|
|
20
20
|
apiKey?: string;
|
|
21
21
|
/**
|
|
22
|
-
Base URL for the API calls.
|
|
23
|
-
*/
|
|
22
|
+
* Base URL for the API calls.
|
|
23
|
+
*/
|
|
24
24
|
baseURL?: string;
|
|
25
25
|
/**
|
|
26
|
-
Custom headers to include in the requests.
|
|
27
|
-
*/
|
|
26
|
+
* Custom headers to include in the requests.
|
|
27
|
+
*/
|
|
28
28
|
headers?: Record<string, string>;
|
|
29
29
|
/**
|
|
30
|
-
Custom fetch implementation. You can use it as a middleware to intercept requests,
|
|
31
|
-
or to provide a custom fetch implementation for e.g. testing.
|
|
32
|
-
*/
|
|
30
|
+
* Custom fetch implementation. You can use it as a middleware to intercept requests,
|
|
31
|
+
* or to provide a custom fetch implementation for e.g. testing.
|
|
32
|
+
*/
|
|
33
33
|
fetch?: FetchFunction;
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
export interface VercelProvider extends ProviderV3 {
|
|
37
37
|
/**
|
|
38
|
-
Creates a model for text generation.
|
|
39
|
-
*/
|
|
38
|
+
* Creates a model for text generation.
|
|
39
|
+
*/
|
|
40
40
|
(modelId: VercelChatModelId): LanguageModelV3;
|
|
41
41
|
|
|
42
42
|
/**
|
|
43
|
-
Creates a language model for text generation.
|
|
44
|
-
*/
|
|
43
|
+
* Creates a language model for text generation.
|
|
44
|
+
*/
|
|
45
45
|
languageModel(modelId: VercelChatModelId): LanguageModelV3;
|
|
46
46
|
|
|
47
47
|
/**
|