@ai-sdk/vercel 0.0.1
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 +7 -0
- package/LICENSE +13 -0
- package/README.md +43 -0
- package/dist/index.d.mts +46 -0
- package/dist/index.d.ts +46 -0
- package/dist/index.js +71 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +48 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +64 -0
package/CHANGELOG.md
ADDED
package/LICENSE
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
Copyright 2023 Vercel, Inc.
|
|
2
|
+
|
|
3
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
you may not use this file except in compliance with the License.
|
|
5
|
+
You may obtain a copy of the License at
|
|
6
|
+
|
|
7
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
|
|
9
|
+
Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
See the License for the specific language governing permissions and
|
|
13
|
+
limitations under the License.
|
package/README.md
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# AI SDK - Vercel Provider
|
|
2
|
+
|
|
3
|
+
The **[Vercel provider](https://ai-sdk.dev/providers/ai-sdk-providers/vercel)** for the [AI SDK](https://ai-sdk.dev/docs)
|
|
4
|
+
gives you access to the v0 API, designed for building modern web applications. The `v0-1.0-md` model supports text and image inputs, provides fast streaming responses, and is compatible with the OpenAI Chat Completions API format.
|
|
5
|
+
|
|
6
|
+
Key features include:
|
|
7
|
+
|
|
8
|
+
- Framework aware completions: Optimized for modern stacks like Next.js and Vercel
|
|
9
|
+
- Auto-fix: Identifies and corrects common coding issues during generation
|
|
10
|
+
- Quick edit: Streams inline edits as they're available
|
|
11
|
+
- Multimodal: Supports both text and image inputs
|
|
12
|
+
|
|
13
|
+
## Setup
|
|
14
|
+
|
|
15
|
+
The Vercel provider is available in the `@ai-sdk/vercel` module. You can install it with
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
npm i @ai-sdk/vercel
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Provider Instance
|
|
22
|
+
|
|
23
|
+
You can import the default provider instance `vercel` from `@ai-sdk/vercel`:
|
|
24
|
+
|
|
25
|
+
```ts
|
|
26
|
+
import { vercel } from '@ai-sdk/vercel';
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## Example
|
|
30
|
+
|
|
31
|
+
```ts
|
|
32
|
+
import { vercel } from '@ai-sdk/vercel';
|
|
33
|
+
import { generateText } from 'ai';
|
|
34
|
+
|
|
35
|
+
const { text } = await generateText({
|
|
36
|
+
model: vercel('v0-1.0-md'),
|
|
37
|
+
prompt: 'Create a Next.js app',
|
|
38
|
+
});
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## Documentation
|
|
42
|
+
|
|
43
|
+
Please check out the **[Vercel provider documentation](https://ai-sdk.dev/providers/ai-sdk-providers/vercel)** for more information.
|
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { ProviderV1, LanguageModelV1 } from '@ai-sdk/provider';
|
|
2
|
+
import { FetchFunction } from '@ai-sdk/provider-utils';
|
|
3
|
+
import { OpenAICompatibleChatSettings } from '@ai-sdk/openai-compatible';
|
|
4
|
+
export { OpenAICompatibleErrorData as VercelErrorData } from '@ai-sdk/openai-compatible';
|
|
5
|
+
|
|
6
|
+
type VercelChatModelId = 'v0-1.0-md' | (string & {});
|
|
7
|
+
interface VercelChatSettings extends OpenAICompatibleChatSettings {
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
interface VercelProviderSettings {
|
|
11
|
+
/**
|
|
12
|
+
Vercel API key.
|
|
13
|
+
*/
|
|
14
|
+
apiKey?: string;
|
|
15
|
+
/**
|
|
16
|
+
Base URL for the API calls.
|
|
17
|
+
*/
|
|
18
|
+
baseURL?: string;
|
|
19
|
+
/**
|
|
20
|
+
Custom headers to include in the requests.
|
|
21
|
+
*/
|
|
22
|
+
headers?: Record<string, string>;
|
|
23
|
+
/**
|
|
24
|
+
Custom fetch implementation. You can use it as a middleware to intercept requests,
|
|
25
|
+
or to provide a custom fetch implementation for e.g. testing.
|
|
26
|
+
*/
|
|
27
|
+
fetch?: FetchFunction;
|
|
28
|
+
}
|
|
29
|
+
interface VercelProvider extends ProviderV1 {
|
|
30
|
+
/**
|
|
31
|
+
Creates a model for text generation.
|
|
32
|
+
*/
|
|
33
|
+
(modelId: VercelChatModelId, settings?: VercelChatSettings): LanguageModelV1;
|
|
34
|
+
/**
|
|
35
|
+
Creates a chat model for text generation.
|
|
36
|
+
*/
|
|
37
|
+
chatModel(modelId: VercelChatModelId, settings?: VercelChatSettings): LanguageModelV1;
|
|
38
|
+
/**
|
|
39
|
+
Creates a language model for text generation.
|
|
40
|
+
*/
|
|
41
|
+
languageModel(modelId: VercelChatModelId, settings?: VercelChatSettings): LanguageModelV1;
|
|
42
|
+
}
|
|
43
|
+
declare function createVercel(options?: VercelProviderSettings): VercelProvider;
|
|
44
|
+
declare const vercel: VercelProvider;
|
|
45
|
+
|
|
46
|
+
export { type VercelProvider, type VercelProviderSettings, createVercel, vercel };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { ProviderV1, LanguageModelV1 } from '@ai-sdk/provider';
|
|
2
|
+
import { FetchFunction } from '@ai-sdk/provider-utils';
|
|
3
|
+
import { OpenAICompatibleChatSettings } from '@ai-sdk/openai-compatible';
|
|
4
|
+
export { OpenAICompatibleErrorData as VercelErrorData } from '@ai-sdk/openai-compatible';
|
|
5
|
+
|
|
6
|
+
type VercelChatModelId = 'v0-1.0-md' | (string & {});
|
|
7
|
+
interface VercelChatSettings extends OpenAICompatibleChatSettings {
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
interface VercelProviderSettings {
|
|
11
|
+
/**
|
|
12
|
+
Vercel API key.
|
|
13
|
+
*/
|
|
14
|
+
apiKey?: string;
|
|
15
|
+
/**
|
|
16
|
+
Base URL for the API calls.
|
|
17
|
+
*/
|
|
18
|
+
baseURL?: string;
|
|
19
|
+
/**
|
|
20
|
+
Custom headers to include in the requests.
|
|
21
|
+
*/
|
|
22
|
+
headers?: Record<string, string>;
|
|
23
|
+
/**
|
|
24
|
+
Custom fetch implementation. You can use it as a middleware to intercept requests,
|
|
25
|
+
or to provide a custom fetch implementation for e.g. testing.
|
|
26
|
+
*/
|
|
27
|
+
fetch?: FetchFunction;
|
|
28
|
+
}
|
|
29
|
+
interface VercelProvider extends ProviderV1 {
|
|
30
|
+
/**
|
|
31
|
+
Creates a model for text generation.
|
|
32
|
+
*/
|
|
33
|
+
(modelId: VercelChatModelId, settings?: VercelChatSettings): LanguageModelV1;
|
|
34
|
+
/**
|
|
35
|
+
Creates a chat model for text generation.
|
|
36
|
+
*/
|
|
37
|
+
chatModel(modelId: VercelChatModelId, settings?: VercelChatSettings): LanguageModelV1;
|
|
38
|
+
/**
|
|
39
|
+
Creates a language model for text generation.
|
|
40
|
+
*/
|
|
41
|
+
languageModel(modelId: VercelChatModelId, settings?: VercelChatSettings): LanguageModelV1;
|
|
42
|
+
}
|
|
43
|
+
declare function createVercel(options?: VercelProviderSettings): VercelProvider;
|
|
44
|
+
declare const vercel: VercelProvider;
|
|
45
|
+
|
|
46
|
+
export { type VercelProvider, type VercelProviderSettings, createVercel, vercel };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
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 src_exports = {};
|
|
22
|
+
__export(src_exports, {
|
|
23
|
+
createVercel: () => createVercel,
|
|
24
|
+
vercel: () => vercel
|
|
25
|
+
});
|
|
26
|
+
module.exports = __toCommonJS(src_exports);
|
|
27
|
+
|
|
28
|
+
// src/vercel-provider.ts
|
|
29
|
+
var import_provider = require("@ai-sdk/provider");
|
|
30
|
+
var import_openai_compatible = require("@ai-sdk/openai-compatible");
|
|
31
|
+
var import_provider_utils = require("@ai-sdk/provider-utils");
|
|
32
|
+
function createVercel(options = {}) {
|
|
33
|
+
var _a;
|
|
34
|
+
const baseURL = (0, import_provider_utils.withoutTrailingSlash)(
|
|
35
|
+
(_a = options.baseURL) != null ? _a : "https://api.v0.dev/v1"
|
|
36
|
+
);
|
|
37
|
+
const getHeaders = () => ({
|
|
38
|
+
Authorization: `Bearer ${(0, import_provider_utils.loadApiKey)({
|
|
39
|
+
apiKey: options.apiKey,
|
|
40
|
+
environmentVariableName: "VERCEL_API_KEY",
|
|
41
|
+
description: "Vercel"
|
|
42
|
+
})}`,
|
|
43
|
+
...options.headers
|
|
44
|
+
});
|
|
45
|
+
const getCommonModelConfig = (modelType) => ({
|
|
46
|
+
provider: `vercel.${modelType}`,
|
|
47
|
+
url: ({ path }) => `${baseURL}${path}`,
|
|
48
|
+
headers: getHeaders,
|
|
49
|
+
fetch: options.fetch
|
|
50
|
+
});
|
|
51
|
+
const createChatModel = (modelId, settings = {}) => {
|
|
52
|
+
return new import_openai_compatible.OpenAICompatibleChatLanguageModel(modelId, settings, {
|
|
53
|
+
...getCommonModelConfig("chat"),
|
|
54
|
+
defaultObjectGenerationMode: "json"
|
|
55
|
+
});
|
|
56
|
+
};
|
|
57
|
+
const provider = (modelId, settings) => createChatModel(modelId, settings);
|
|
58
|
+
provider.chatModel = createChatModel;
|
|
59
|
+
provider.languageModel = createChatModel;
|
|
60
|
+
provider.textEmbeddingModel = (modelId) => {
|
|
61
|
+
throw new import_provider.NoSuchModelError({ modelId, modelType: "textEmbeddingModel" });
|
|
62
|
+
};
|
|
63
|
+
return provider;
|
|
64
|
+
}
|
|
65
|
+
var vercel = createVercel();
|
|
66
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
67
|
+
0 && (module.exports = {
|
|
68
|
+
createVercel,
|
|
69
|
+
vercel
|
|
70
|
+
});
|
|
71
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/vercel-provider.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';\n","import {\n LanguageModelV1,\n NoSuchModelError,\n ProviderV1,\n} from '@ai-sdk/provider';\nimport { OpenAICompatibleChatLanguageModel } from '@ai-sdk/openai-compatible';\nimport {\n FetchFunction,\n loadApiKey,\n withoutTrailingSlash,\n} from '@ai-sdk/provider-utils';\nimport { VercelChatModelId, VercelChatSettings } from './vercel-chat-settings';\n\nexport interface VercelProviderSettings {\n /**\nVercel API key.\n*/\n apiKey?: string;\n /**\nBase URL for the API calls.\n*/\n baseURL?: string;\n /**\nCustom headers to include in the requests.\n*/\n headers?: Record<string, string>;\n /**\nCustom fetch implementation. You can use it as a middleware to intercept requests,\nor to provide a custom fetch implementation for e.g. testing.\n*/\n fetch?: FetchFunction;\n}\n\nexport interface VercelProvider extends ProviderV1 {\n /**\nCreates a model for text generation.\n*/\n (modelId: VercelChatModelId, settings?: VercelChatSettings): LanguageModelV1;\n\n /**\nCreates a chat model for text generation.\n*/\n chatModel(\n modelId: VercelChatModelId,\n settings?: VercelChatSettings,\n ): LanguageModelV1;\n\n /**\nCreates a language model for text generation.\n*/\n languageModel(\n modelId: VercelChatModelId,\n settings?: VercelChatSettings,\n ): LanguageModelV1;\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 Authorization: `Bearer ${loadApiKey({\n apiKey: options.apiKey,\n environmentVariableName: 'VERCEL_API_KEY',\n description: 'Vercel',\n })}`,\n ...options.headers,\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 = (\n modelId: VercelChatModelId,\n settings: VercelChatSettings = {},\n ) => {\n return new OpenAICompatibleChatLanguageModel(modelId, settings, {\n ...getCommonModelConfig('chat'),\n defaultObjectGenerationMode: 'json',\n });\n };\n\n const provider = (\n modelId: VercelChatModelId,\n settings?: VercelChatSettings,\n ) => createChatModel(modelId, settings);\n\n provider.chatModel = createChatModel;\n provider.languageModel = createChatModel;\n provider.textEmbeddingModel = (modelId: string) => {\n throw new NoSuchModelError({ modelId, modelType: 'textEmbeddingModel' });\n };\n\n return provider;\n}\n\nexport const vercel = createVercel();\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,sBAIO;AACP,+BAAkD;AAClD,4BAIO;AA8CA,SAAS,aACd,UAAkC,CAAC,GACnB;AA1DlB;AA2DE,QAAM,cAAU;AAAA,KACd,aAAQ,YAAR,YAAmB;AAAA,EACrB;AACA,QAAM,aAAa,OAAO;AAAA,IACxB,eAAe,cAAU,kCAAW;AAAA,MAClC,QAAQ,QAAQ;AAAA,MAChB,yBAAyB;AAAA,MACzB,aAAa;AAAA,IACf,CAAC,CAAC;AAAA,IACF,GAAG,QAAQ;AAAA,EACb;AASA,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,CACtB,SACA,WAA+B,CAAC,MAC7B;AACH,WAAO,IAAI,2DAAkC,SAAS,UAAU;AAAA,MAC9D,GAAG,qBAAqB,MAAM;AAAA,MAC9B,6BAA6B;AAAA,IAC/B,CAAC;AAAA,EACH;AAEA,QAAM,WAAW,CACf,SACA,aACG,gBAAgB,SAAS,QAAQ;AAEtC,WAAS,YAAY;AACrB,WAAS,gBAAgB;AACzB,WAAS,qBAAqB,CAAC,YAAoB;AACjD,UAAM,IAAI,iCAAiB,EAAE,SAAS,WAAW,qBAAqB,CAAC;AAAA,EACzE;AAEA,SAAO;AACT;AAEO,IAAM,SAAS,aAAa;","names":[]}
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
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
|
+
} from "@ai-sdk/provider-utils";
|
|
10
|
+
function createVercel(options = {}) {
|
|
11
|
+
var _a;
|
|
12
|
+
const baseURL = withoutTrailingSlash(
|
|
13
|
+
(_a = options.baseURL) != null ? _a : "https://api.v0.dev/v1"
|
|
14
|
+
);
|
|
15
|
+
const getHeaders = () => ({
|
|
16
|
+
Authorization: `Bearer ${loadApiKey({
|
|
17
|
+
apiKey: options.apiKey,
|
|
18
|
+
environmentVariableName: "VERCEL_API_KEY",
|
|
19
|
+
description: "Vercel"
|
|
20
|
+
})}`,
|
|
21
|
+
...options.headers
|
|
22
|
+
});
|
|
23
|
+
const getCommonModelConfig = (modelType) => ({
|
|
24
|
+
provider: `vercel.${modelType}`,
|
|
25
|
+
url: ({ path }) => `${baseURL}${path}`,
|
|
26
|
+
headers: getHeaders,
|
|
27
|
+
fetch: options.fetch
|
|
28
|
+
});
|
|
29
|
+
const createChatModel = (modelId, settings = {}) => {
|
|
30
|
+
return new OpenAICompatibleChatLanguageModel(modelId, settings, {
|
|
31
|
+
...getCommonModelConfig("chat"),
|
|
32
|
+
defaultObjectGenerationMode: "json"
|
|
33
|
+
});
|
|
34
|
+
};
|
|
35
|
+
const provider = (modelId, settings) => createChatModel(modelId, settings);
|
|
36
|
+
provider.chatModel = createChatModel;
|
|
37
|
+
provider.languageModel = createChatModel;
|
|
38
|
+
provider.textEmbeddingModel = (modelId) => {
|
|
39
|
+
throw new NoSuchModelError({ modelId, modelType: "textEmbeddingModel" });
|
|
40
|
+
};
|
|
41
|
+
return provider;
|
|
42
|
+
}
|
|
43
|
+
var vercel = createVercel();
|
|
44
|
+
export {
|
|
45
|
+
createVercel,
|
|
46
|
+
vercel
|
|
47
|
+
};
|
|
48
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/vercel-provider.ts"],"sourcesContent":["import {\n LanguageModelV1,\n NoSuchModelError,\n ProviderV1,\n} from '@ai-sdk/provider';\nimport { OpenAICompatibleChatLanguageModel } from '@ai-sdk/openai-compatible';\nimport {\n FetchFunction,\n loadApiKey,\n withoutTrailingSlash,\n} from '@ai-sdk/provider-utils';\nimport { VercelChatModelId, VercelChatSettings } from './vercel-chat-settings';\n\nexport interface VercelProviderSettings {\n /**\nVercel API key.\n*/\n apiKey?: string;\n /**\nBase URL for the API calls.\n*/\n baseURL?: string;\n /**\nCustom headers to include in the requests.\n*/\n headers?: Record<string, string>;\n /**\nCustom fetch implementation. You can use it as a middleware to intercept requests,\nor to provide a custom fetch implementation for e.g. testing.\n*/\n fetch?: FetchFunction;\n}\n\nexport interface VercelProvider extends ProviderV1 {\n /**\nCreates a model for text generation.\n*/\n (modelId: VercelChatModelId, settings?: VercelChatSettings): LanguageModelV1;\n\n /**\nCreates a chat model for text generation.\n*/\n chatModel(\n modelId: VercelChatModelId,\n settings?: VercelChatSettings,\n ): LanguageModelV1;\n\n /**\nCreates a language model for text generation.\n*/\n languageModel(\n modelId: VercelChatModelId,\n settings?: VercelChatSettings,\n ): LanguageModelV1;\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 Authorization: `Bearer ${loadApiKey({\n apiKey: options.apiKey,\n environmentVariableName: 'VERCEL_API_KEY',\n description: 'Vercel',\n })}`,\n ...options.headers,\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 = (\n modelId: VercelChatModelId,\n settings: VercelChatSettings = {},\n ) => {\n return new OpenAICompatibleChatLanguageModel(modelId, settings, {\n ...getCommonModelConfig('chat'),\n defaultObjectGenerationMode: 'json',\n });\n };\n\n const provider = (\n modelId: VercelChatModelId,\n settings?: VercelChatSettings,\n ) => createChatModel(modelId, settings);\n\n provider.chatModel = createChatModel;\n provider.languageModel = createChatModel;\n provider.textEmbeddingModel = (modelId: string) => {\n throw new NoSuchModelError({ modelId, modelType: 'textEmbeddingModel' });\n };\n\n return provider;\n}\n\nexport const vercel = createVercel();\n"],"mappings":";AAAA;AAAA,EAEE;AAAA,OAEK;AACP,SAAS,yCAAyC;AAClD;AAAA,EAEE;AAAA,EACA;AAAA,OACK;AA8CA,SAAS,aACd,UAAkC,CAAC,GACnB;AA1DlB;AA2DE,QAAM,UAAU;AAAA,KACd,aAAQ,YAAR,YAAmB;AAAA,EACrB;AACA,QAAM,aAAa,OAAO;AAAA,IACxB,eAAe,UAAU,WAAW;AAAA,MAClC,QAAQ,QAAQ;AAAA,MAChB,yBAAyB;AAAA,MACzB,aAAa;AAAA,IACf,CAAC,CAAC;AAAA,IACF,GAAG,QAAQ;AAAA,EACb;AASA,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,CACtB,SACA,WAA+B,CAAC,MAC7B;AACH,WAAO,IAAI,kCAAkC,SAAS,UAAU;AAAA,MAC9D,GAAG,qBAAqB,MAAM;AAAA,MAC9B,6BAA6B;AAAA,IAC/B,CAAC;AAAA,EACH;AAEA,QAAM,WAAW,CACf,SACA,aACG,gBAAgB,SAAS,QAAQ;AAEtC,WAAS,YAAY;AACrB,WAAS,gBAAgB;AACzB,WAAS,qBAAqB,CAAC,YAAoB;AACjD,UAAM,IAAI,iBAAiB,EAAE,SAAS,WAAW,qBAAqB,CAAC;AAAA,EACzE;AAEA,SAAO;AACT;AAEO,IAAM,SAAS,aAAa;","names":[]}
|
package/package.json
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@ai-sdk/vercel",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"license": "Apache-2.0",
|
|
5
|
+
"sideEffects": false,
|
|
6
|
+
"main": "./dist/index.js",
|
|
7
|
+
"module": "./dist/index.mjs",
|
|
8
|
+
"types": "./dist/index.d.ts",
|
|
9
|
+
"files": [
|
|
10
|
+
"dist/**/*",
|
|
11
|
+
"CHANGELOG.md"
|
|
12
|
+
],
|
|
13
|
+
"exports": {
|
|
14
|
+
"./package.json": "./package.json",
|
|
15
|
+
".": {
|
|
16
|
+
"types": "./dist/index.d.ts",
|
|
17
|
+
"import": "./dist/index.mjs",
|
|
18
|
+
"require": "./dist/index.js"
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
"dependencies": {
|
|
22
|
+
"@ai-sdk/openai-compatible": "0.2.14",
|
|
23
|
+
"@ai-sdk/provider": "1.1.3",
|
|
24
|
+
"@ai-sdk/provider-utils": "2.2.8"
|
|
25
|
+
},
|
|
26
|
+
"devDependencies": {
|
|
27
|
+
"@types/node": "20.17.24",
|
|
28
|
+
"tsup": "^8",
|
|
29
|
+
"typescript": "5.6.3",
|
|
30
|
+
"zod": "3.23.8",
|
|
31
|
+
"@vercel/ai-tsconfig": "0.0.0"
|
|
32
|
+
},
|
|
33
|
+
"peerDependencies": {
|
|
34
|
+
"zod": "^3.0.0"
|
|
35
|
+
},
|
|
36
|
+
"engines": {
|
|
37
|
+
"node": ">=18"
|
|
38
|
+
},
|
|
39
|
+
"publishConfig": {
|
|
40
|
+
"access": "public"
|
|
41
|
+
},
|
|
42
|
+
"homepage": "https://ai-sdk.dev/docs",
|
|
43
|
+
"repository": {
|
|
44
|
+
"type": "git",
|
|
45
|
+
"url": "git+https://github.com/vercel/ai.git"
|
|
46
|
+
},
|
|
47
|
+
"bugs": {
|
|
48
|
+
"url": "https://github.com/vercel/ai/issues"
|
|
49
|
+
},
|
|
50
|
+
"keywords": [
|
|
51
|
+
"ai"
|
|
52
|
+
],
|
|
53
|
+
"scripts": {
|
|
54
|
+
"build": "tsup",
|
|
55
|
+
"build:watch": "tsup --watch",
|
|
56
|
+
"clean": "rm -rf dist",
|
|
57
|
+
"lint": "eslint \"./**/*.ts*\"",
|
|
58
|
+
"type-check": "tsc --noEmit",
|
|
59
|
+
"prettier-check": "prettier --check \"./**/*.ts*\"",
|
|
60
|
+
"test": "pnpm test:node && pnpm test:edge",
|
|
61
|
+
"test:edge": "vitest --config vitest.edge.config.js --run",
|
|
62
|
+
"test:node": "vitest --config vitest.node.config.js --run"
|
|
63
|
+
}
|
|
64
|
+
}
|