@ai-sdk/cerebras 3.0.0-beta.1 → 3.0.0-beta.11
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 +89 -4
- package/dist/index.d.mts +5 -5
- package/dist/index.d.ts +5 -5
- package/dist/index.js +5 -5
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +2 -2
- package/dist/index.mjs.map +1 -1
- package/package.json +4 -6
- package/src/cerebras-provider.ts +7 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,90 @@
|
|
|
1
1
|
# @ai-sdk/cerebras
|
|
2
2
|
|
|
3
|
+
## 3.0.0-beta.11
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [986c6fd]
|
|
8
|
+
- Updated dependencies [493295c]
|
|
9
|
+
- @ai-sdk/provider-utils@5.0.0-beta.8
|
|
10
|
+
- @ai-sdk/openai-compatible@3.0.0-beta.11
|
|
11
|
+
|
|
12
|
+
## 3.0.0-beta.10
|
|
13
|
+
|
|
14
|
+
### Patch Changes
|
|
15
|
+
|
|
16
|
+
- Updated dependencies [1f509d4]
|
|
17
|
+
- @ai-sdk/provider-utils@5.0.0-beta.7
|
|
18
|
+
- @ai-sdk/provider@4.0.0-beta.5
|
|
19
|
+
- @ai-sdk/openai-compatible@3.0.0-beta.10
|
|
20
|
+
|
|
21
|
+
## 3.0.0-beta.9
|
|
22
|
+
|
|
23
|
+
### Patch Changes
|
|
24
|
+
|
|
25
|
+
- Updated dependencies [74d520f]
|
|
26
|
+
- @ai-sdk/openai-compatible@3.0.0-beta.9
|
|
27
|
+
|
|
28
|
+
## 3.0.0-beta.8
|
|
29
|
+
|
|
30
|
+
### Patch Changes
|
|
31
|
+
|
|
32
|
+
- Updated dependencies [3887c70]
|
|
33
|
+
- @ai-sdk/provider-utils@5.0.0-beta.6
|
|
34
|
+
- @ai-sdk/provider@4.0.0-beta.4
|
|
35
|
+
- @ai-sdk/openai-compatible@3.0.0-beta.8
|
|
36
|
+
|
|
37
|
+
## 3.0.0-beta.7
|
|
38
|
+
|
|
39
|
+
### Patch Changes
|
|
40
|
+
|
|
41
|
+
- Updated dependencies [776b617]
|
|
42
|
+
- @ai-sdk/provider-utils@5.0.0-beta.5
|
|
43
|
+
- @ai-sdk/provider@4.0.0-beta.3
|
|
44
|
+
- @ai-sdk/openai-compatible@3.0.0-beta.7
|
|
45
|
+
|
|
46
|
+
## 3.0.0-beta.6
|
|
47
|
+
|
|
48
|
+
### Patch Changes
|
|
49
|
+
|
|
50
|
+
- Updated dependencies [61753c3]
|
|
51
|
+
- @ai-sdk/provider-utils@5.0.0-beta.4
|
|
52
|
+
- @ai-sdk/openai-compatible@3.0.0-beta.6
|
|
53
|
+
|
|
54
|
+
## 3.0.0-beta.5
|
|
55
|
+
|
|
56
|
+
### Patch Changes
|
|
57
|
+
|
|
58
|
+
- Updated dependencies [f7d4f01]
|
|
59
|
+
- @ai-sdk/provider-utils@5.0.0-beta.3
|
|
60
|
+
- @ai-sdk/provider@4.0.0-beta.2
|
|
61
|
+
- @ai-sdk/openai-compatible@3.0.0-beta.5
|
|
62
|
+
|
|
63
|
+
## 3.0.0-beta.4
|
|
64
|
+
|
|
65
|
+
### Patch Changes
|
|
66
|
+
|
|
67
|
+
- Updated dependencies [5c2a5a2]
|
|
68
|
+
- @ai-sdk/provider@4.0.0-beta.1
|
|
69
|
+
- @ai-sdk/openai-compatible@3.0.0-beta.4
|
|
70
|
+
- @ai-sdk/provider-utils@5.0.0-beta.2
|
|
71
|
+
|
|
72
|
+
## 3.0.0-beta.3
|
|
73
|
+
|
|
74
|
+
### Patch Changes
|
|
75
|
+
|
|
76
|
+
- 8f3e1da: chore(openai-compat): update v3 specs to v4
|
|
77
|
+
- Updated dependencies [8f3e1da]
|
|
78
|
+
- @ai-sdk/openai-compatible@3.0.0-beta.3
|
|
79
|
+
|
|
80
|
+
## 3.0.0-beta.2
|
|
81
|
+
|
|
82
|
+
### Patch Changes
|
|
83
|
+
|
|
84
|
+
- Updated dependencies [45b3d76]
|
|
85
|
+
- Updated dependencies [f7295cb]
|
|
86
|
+
- @ai-sdk/openai-compatible@3.0.0-beta.2
|
|
87
|
+
|
|
3
88
|
## 3.0.0-beta.1
|
|
4
89
|
|
|
5
90
|
### Patch Changes
|
|
@@ -339,13 +424,13 @@
|
|
|
339
424
|
Before
|
|
340
425
|
|
|
341
426
|
```ts
|
|
342
|
-
model.textEmbeddingModel(
|
|
427
|
+
model.textEmbeddingModel("my-model-id");
|
|
343
428
|
```
|
|
344
429
|
|
|
345
430
|
After
|
|
346
431
|
|
|
347
432
|
```ts
|
|
348
|
-
model.embeddingModel(
|
|
433
|
+
model.embeddingModel("my-model-id");
|
|
349
434
|
```
|
|
350
435
|
|
|
351
436
|
- 42e9f64: Add support for 5 new Cerebras models:
|
|
@@ -578,13 +663,13 @@
|
|
|
578
663
|
Before
|
|
579
664
|
|
|
580
665
|
```ts
|
|
581
|
-
model.textEmbeddingModel(
|
|
666
|
+
model.textEmbeddingModel("my-model-id");
|
|
582
667
|
```
|
|
583
668
|
|
|
584
669
|
After
|
|
585
670
|
|
|
586
671
|
```ts
|
|
587
|
-
model.embeddingModel(
|
|
672
|
+
model.embeddingModel("my-model-id");
|
|
588
673
|
```
|
|
589
674
|
|
|
590
675
|
- Updated dependencies [8d9e8ad]
|
package/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ProviderV4, LanguageModelV4 } from '@ai-sdk/provider';
|
|
2
2
|
import { FetchFunction } from '@ai-sdk/provider-utils';
|
|
3
3
|
import { z } from 'zod/v4';
|
|
4
4
|
|
|
@@ -30,19 +30,19 @@ interface CerebrasProviderSettings {
|
|
|
30
30
|
*/
|
|
31
31
|
fetch?: FetchFunction;
|
|
32
32
|
}
|
|
33
|
-
interface CerebrasProvider extends
|
|
33
|
+
interface CerebrasProvider extends ProviderV4 {
|
|
34
34
|
/**
|
|
35
35
|
* Creates a Cerebras model for text generation.
|
|
36
36
|
*/
|
|
37
|
-
(modelId: CerebrasChatModelId):
|
|
37
|
+
(modelId: CerebrasChatModelId): LanguageModelV4;
|
|
38
38
|
/**
|
|
39
39
|
* Creates a Cerebras model for text generation.
|
|
40
40
|
*/
|
|
41
|
-
languageModel(modelId: CerebrasChatModelId):
|
|
41
|
+
languageModel(modelId: CerebrasChatModelId): LanguageModelV4;
|
|
42
42
|
/**
|
|
43
43
|
* Creates a Cerebras chat model for text generation.
|
|
44
44
|
*/
|
|
45
|
-
chat(modelId: CerebrasChatModelId):
|
|
45
|
+
chat(modelId: CerebrasChatModelId): LanguageModelV4;
|
|
46
46
|
/**
|
|
47
47
|
* @deprecated Use `embeddingModel` instead.
|
|
48
48
|
*/
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ProviderV4, LanguageModelV4 } from '@ai-sdk/provider';
|
|
2
2
|
import { FetchFunction } from '@ai-sdk/provider-utils';
|
|
3
3
|
import { z } from 'zod/v4';
|
|
4
4
|
|
|
@@ -30,19 +30,19 @@ interface CerebrasProviderSettings {
|
|
|
30
30
|
*/
|
|
31
31
|
fetch?: FetchFunction;
|
|
32
32
|
}
|
|
33
|
-
interface CerebrasProvider extends
|
|
33
|
+
interface CerebrasProvider extends ProviderV4 {
|
|
34
34
|
/**
|
|
35
35
|
* Creates a Cerebras model for text generation.
|
|
36
36
|
*/
|
|
37
|
-
(modelId: CerebrasChatModelId):
|
|
37
|
+
(modelId: CerebrasChatModelId): LanguageModelV4;
|
|
38
38
|
/**
|
|
39
39
|
* Creates a Cerebras model for text generation.
|
|
40
40
|
*/
|
|
41
|
-
languageModel(modelId: CerebrasChatModelId):
|
|
41
|
+
languageModel(modelId: CerebrasChatModelId): LanguageModelV4;
|
|
42
42
|
/**
|
|
43
43
|
* Creates a Cerebras chat model for text generation.
|
|
44
44
|
*/
|
|
45
|
-
chat(modelId: CerebrasChatModelId):
|
|
45
|
+
chat(modelId: CerebrasChatModelId): LanguageModelV4;
|
|
46
46
|
/**
|
|
47
47
|
* @deprecated Use `embeddingModel` instead.
|
|
48
48
|
*/
|
package/dist/index.js
CHANGED
|
@@ -18,13 +18,13 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
19
|
|
|
20
20
|
// src/index.ts
|
|
21
|
-
var
|
|
22
|
-
__export(
|
|
21
|
+
var index_exports = {};
|
|
22
|
+
__export(index_exports, {
|
|
23
23
|
VERSION: () => VERSION,
|
|
24
24
|
cerebras: () => cerebras,
|
|
25
25
|
createCerebras: () => createCerebras
|
|
26
26
|
});
|
|
27
|
-
module.exports = __toCommonJS(
|
|
27
|
+
module.exports = __toCommonJS(index_exports);
|
|
28
28
|
|
|
29
29
|
// src/cerebras-provider.ts
|
|
30
30
|
var import_openai_compatible = require("@ai-sdk/openai-compatible");
|
|
@@ -33,7 +33,7 @@ var import_provider_utils = require("@ai-sdk/provider-utils");
|
|
|
33
33
|
var import_v4 = require("zod/v4");
|
|
34
34
|
|
|
35
35
|
// src/version.ts
|
|
36
|
-
var VERSION = true ? "3.0.0-beta.
|
|
36
|
+
var VERSION = true ? "3.0.0-beta.11" : "0.0.0-test";
|
|
37
37
|
|
|
38
38
|
// src/cerebras-provider.ts
|
|
39
39
|
var cerebrasErrorSchema = import_v4.z.object({
|
|
@@ -73,7 +73,7 @@ function createCerebras(options = {}) {
|
|
|
73
73
|
});
|
|
74
74
|
};
|
|
75
75
|
const provider = (modelId) => createLanguageModel(modelId);
|
|
76
|
-
provider.specificationVersion = "
|
|
76
|
+
provider.specificationVersion = "v4";
|
|
77
77
|
provider.languageModel = createLanguageModel;
|
|
78
78
|
provider.chat = createLanguageModel;
|
|
79
79
|
provider.embeddingModel = (modelId) => {
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts","../src/cerebras-provider.ts","../src/version.ts"],"sourcesContent":["export { createCerebras, cerebras } from './cerebras-provider';\nexport type {\n CerebrasProvider,\n CerebrasProviderSettings,\n} from './cerebras-provider';\nexport type { CerebrasErrorData } from './cerebras-provider';\nexport { VERSION } from './version';\n","import { OpenAICompatibleChatLanguageModel } from '@ai-sdk/openai-compatible';\nimport {\n
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/cerebras-provider.ts","../src/version.ts"],"sourcesContent":["export { createCerebras, cerebras } from './cerebras-provider';\nexport type {\n CerebrasProvider,\n CerebrasProviderSettings,\n} from './cerebras-provider';\nexport type { CerebrasErrorData } from './cerebras-provider';\nexport { VERSION } from './version';\n","import { OpenAICompatibleChatLanguageModel } from '@ai-sdk/openai-compatible';\nimport {\n LanguageModelV4,\n NoSuchModelError,\n ProviderV4,\n} from '@ai-sdk/provider';\nimport {\n FetchFunction,\n loadApiKey,\n withoutTrailingSlash,\n withUserAgentSuffix,\n} from '@ai-sdk/provider-utils';\nimport { CerebrasChatModelId } from './cerebras-chat-options';\nimport { z } from 'zod/v4';\nimport { ProviderErrorStructure } from '@ai-sdk/openai-compatible';\nimport { VERSION } from './version';\n\n// Add error schema and structure\nconst cerebrasErrorSchema = z.object({\n message: z.string(),\n type: z.string(),\n param: z.string(),\n code: z.string(),\n});\n\nexport type CerebrasErrorData = z.infer<typeof cerebrasErrorSchema>;\n\nconst cerebrasErrorStructure: ProviderErrorStructure<CerebrasErrorData> = {\n errorSchema: cerebrasErrorSchema,\n errorToMessage: data => data.message,\n};\n\nexport interface CerebrasProviderSettings {\n /**\n * Cerebras 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 CerebrasProvider extends ProviderV4 {\n /**\n * Creates a Cerebras model for text generation.\n */\n (modelId: CerebrasChatModelId): LanguageModelV4;\n\n /**\n * Creates a Cerebras model for text generation.\n */\n languageModel(modelId: CerebrasChatModelId): LanguageModelV4;\n\n /**\n * Creates a Cerebras chat model for text generation.\n */\n chat(modelId: CerebrasChatModelId): LanguageModelV4;\n\n /**\n * @deprecated Use `embeddingModel` instead.\n */\n textEmbeddingModel(modelId: string): never;\n}\n\nexport function createCerebras(\n options: CerebrasProviderSettings = {},\n): CerebrasProvider {\n const baseURL = withoutTrailingSlash(\n options.baseURL ?? 'https://api.cerebras.ai/v1',\n );\n const getHeaders = () =>\n withUserAgentSuffix(\n {\n Authorization: `Bearer ${loadApiKey({\n apiKey: options.apiKey,\n environmentVariableName: 'CEREBRAS_API_KEY',\n description: 'Cerebras API key',\n })}`,\n ...options.headers,\n },\n `ai-sdk/cerebras/${VERSION}`,\n );\n\n const createLanguageModel = (modelId: CerebrasChatModelId) => {\n return new OpenAICompatibleChatLanguageModel(modelId, {\n provider: `cerebras.chat`,\n url: ({ path }) => `${baseURL}${path}`,\n headers: getHeaders,\n fetch: options.fetch,\n errorStructure: cerebrasErrorStructure,\n supportsStructuredOutputs: true,\n });\n };\n\n const provider = (modelId: CerebrasChatModelId) =>\n createLanguageModel(modelId);\n\n provider.specificationVersion = 'v4' as const;\n provider.languageModel = createLanguageModel;\n provider.chat = createLanguageModel;\n\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 cerebras = createCerebras();\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,+BAAkD;AAClD,sBAIO;AACP,4BAKO;AAEP,gBAAkB;;;ACXX,IAAM,UACX,OACI,kBACA;;;ADaN,IAAM,sBAAsB,YAAE,OAAO;AAAA,EACnC,SAAS,YAAE,OAAO;AAAA,EAClB,MAAM,YAAE,OAAO;AAAA,EACf,OAAO,YAAE,OAAO;AAAA,EAChB,MAAM,YAAE,OAAO;AACjB,CAAC;AAID,IAAM,yBAAoE;AAAA,EACxE,aAAa;AAAA,EACb,gBAAgB,UAAQ,KAAK;AAC/B;AA4CO,SAAS,eACd,UAAoC,CAAC,GACnB;AA5EpB;AA6EE,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,mBAAmB,OAAO;AAAA,EAC5B;AAEF,QAAM,sBAAsB,CAAC,YAAiC;AAC5D,WAAO,IAAI,2DAAkC,SAAS;AAAA,MACpD,UAAU;AAAA,MACV,KAAK,CAAC,EAAE,KAAK,MAAM,GAAG,OAAO,GAAG,IAAI;AAAA,MACpC,SAAS;AAAA,MACT,OAAO,QAAQ;AAAA,MACf,gBAAgB;AAAA,MAChB,2BAA2B;AAAA,IAC7B,CAAC;AAAA,EACH;AAEA,QAAM,WAAW,CAAC,YAChB,oBAAoB,OAAO;AAE7B,WAAS,uBAAuB;AAChC,WAAS,gBAAgB;AACzB,WAAS,OAAO;AAEhB,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,WAAW,eAAe;","names":[]}
|
package/dist/index.mjs
CHANGED
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
import { z } from "zod/v4";
|
|
12
12
|
|
|
13
13
|
// src/version.ts
|
|
14
|
-
var VERSION = true ? "3.0.0-beta.
|
|
14
|
+
var VERSION = true ? "3.0.0-beta.11" : "0.0.0-test";
|
|
15
15
|
|
|
16
16
|
// src/cerebras-provider.ts
|
|
17
17
|
var cerebrasErrorSchema = z.object({
|
|
@@ -51,7 +51,7 @@ function createCerebras(options = {}) {
|
|
|
51
51
|
});
|
|
52
52
|
};
|
|
53
53
|
const provider = (modelId) => createLanguageModel(modelId);
|
|
54
|
-
provider.specificationVersion = "
|
|
54
|
+
provider.specificationVersion = "v4";
|
|
55
55
|
provider.languageModel = createLanguageModel;
|
|
56
56
|
provider.chat = createLanguageModel;
|
|
57
57
|
provider.embeddingModel = (modelId) => {
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/cerebras-provider.ts","../src/version.ts"],"sourcesContent":["import { OpenAICompatibleChatLanguageModel } from '@ai-sdk/openai-compatible';\nimport {\n
|
|
1
|
+
{"version":3,"sources":["../src/cerebras-provider.ts","../src/version.ts"],"sourcesContent":["import { OpenAICompatibleChatLanguageModel } from '@ai-sdk/openai-compatible';\nimport {\n LanguageModelV4,\n NoSuchModelError,\n ProviderV4,\n} from '@ai-sdk/provider';\nimport {\n FetchFunction,\n loadApiKey,\n withoutTrailingSlash,\n withUserAgentSuffix,\n} from '@ai-sdk/provider-utils';\nimport { CerebrasChatModelId } from './cerebras-chat-options';\nimport { z } from 'zod/v4';\nimport { ProviderErrorStructure } from '@ai-sdk/openai-compatible';\nimport { VERSION } from './version';\n\n// Add error schema and structure\nconst cerebrasErrorSchema = z.object({\n message: z.string(),\n type: z.string(),\n param: z.string(),\n code: z.string(),\n});\n\nexport type CerebrasErrorData = z.infer<typeof cerebrasErrorSchema>;\n\nconst cerebrasErrorStructure: ProviderErrorStructure<CerebrasErrorData> = {\n errorSchema: cerebrasErrorSchema,\n errorToMessage: data => data.message,\n};\n\nexport interface CerebrasProviderSettings {\n /**\n * Cerebras 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 CerebrasProvider extends ProviderV4 {\n /**\n * Creates a Cerebras model for text generation.\n */\n (modelId: CerebrasChatModelId): LanguageModelV4;\n\n /**\n * Creates a Cerebras model for text generation.\n */\n languageModel(modelId: CerebrasChatModelId): LanguageModelV4;\n\n /**\n * Creates a Cerebras chat model for text generation.\n */\n chat(modelId: CerebrasChatModelId): LanguageModelV4;\n\n /**\n * @deprecated Use `embeddingModel` instead.\n */\n textEmbeddingModel(modelId: string): never;\n}\n\nexport function createCerebras(\n options: CerebrasProviderSettings = {},\n): CerebrasProvider {\n const baseURL = withoutTrailingSlash(\n options.baseURL ?? 'https://api.cerebras.ai/v1',\n );\n const getHeaders = () =>\n withUserAgentSuffix(\n {\n Authorization: `Bearer ${loadApiKey({\n apiKey: options.apiKey,\n environmentVariableName: 'CEREBRAS_API_KEY',\n description: 'Cerebras API key',\n })}`,\n ...options.headers,\n },\n `ai-sdk/cerebras/${VERSION}`,\n );\n\n const createLanguageModel = (modelId: CerebrasChatModelId) => {\n return new OpenAICompatibleChatLanguageModel(modelId, {\n provider: `cerebras.chat`,\n url: ({ path }) => `${baseURL}${path}`,\n headers: getHeaders,\n fetch: options.fetch,\n errorStructure: cerebrasErrorStructure,\n supportsStructuredOutputs: true,\n });\n };\n\n const provider = (modelId: CerebrasChatModelId) =>\n createLanguageModel(modelId);\n\n provider.specificationVersion = 'v4' as const;\n provider.languageModel = createLanguageModel;\n provider.chat = createLanguageModel;\n\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 cerebras = createCerebras();\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,SAAS,yCAAyC;AAClD;AAAA,EAEE;AAAA,OAEK;AACP;AAAA,EAEE;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAEP,SAAS,SAAS;;;ACXX,IAAM,UACX,OACI,kBACA;;;ADaN,IAAM,sBAAsB,EAAE,OAAO;AAAA,EACnC,SAAS,EAAE,OAAO;AAAA,EAClB,MAAM,EAAE,OAAO;AAAA,EACf,OAAO,EAAE,OAAO;AAAA,EAChB,MAAM,EAAE,OAAO;AACjB,CAAC;AAID,IAAM,yBAAoE;AAAA,EACxE,aAAa;AAAA,EACb,gBAAgB,UAAQ,KAAK;AAC/B;AA4CO,SAAS,eACd,UAAoC,CAAC,GACnB;AA5EpB;AA6EE,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,mBAAmB,OAAO;AAAA,EAC5B;AAEF,QAAM,sBAAsB,CAAC,YAAiC;AAC5D,WAAO,IAAI,kCAAkC,SAAS;AAAA,MACpD,UAAU;AAAA,MACV,KAAK,CAAC,EAAE,KAAK,MAAM,GAAG,OAAO,GAAG,IAAI;AAAA,MACpC,SAAS;AAAA,MACT,OAAO,QAAQ;AAAA,MACf,gBAAgB;AAAA,MAChB,2BAA2B;AAAA,IAC7B,CAAC;AAAA,EACH;AAEA,QAAM,WAAW,CAAC,YAChB,oBAAoB,OAAO;AAE7B,WAAS,uBAAuB;AAChC,WAAS,gBAAgB;AACzB,WAAS,OAAO;AAEhB,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,WAAW,eAAe;","names":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ai-sdk/cerebras",
|
|
3
|
-
"version": "3.0.0-beta.
|
|
3
|
+
"version": "3.0.0-beta.11",
|
|
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": "3.0.0-beta.
|
|
33
|
-
"@ai-sdk/provider": "4.0.0-beta.
|
|
34
|
-
"@ai-sdk/provider-utils": "5.0.0-beta.
|
|
32
|
+
"@ai-sdk/openai-compatible": "3.0.0-beta.11",
|
|
33
|
+
"@ai-sdk/provider": "4.0.0-beta.5",
|
|
34
|
+
"@ai-sdk/provider-utils": "5.0.0-beta.8"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
37
|
"@types/node": "20.17.24",
|
|
@@ -67,9 +67,7 @@
|
|
|
67
67
|
"build": "pnpm clean && tsup --tsconfig tsconfig.build.json",
|
|
68
68
|
"build:watch": "pnpm clean && tsup --watch",
|
|
69
69
|
"clean": "del-cli dist docs *.tsbuildinfo",
|
|
70
|
-
"lint": "eslint \"./**/*.ts*\"",
|
|
71
70
|
"type-check": "tsc --build",
|
|
72
|
-
"prettier-check": "prettier --check \"./**/*.ts*\"",
|
|
73
71
|
"test": "pnpm test:node && pnpm test:edge",
|
|
74
72
|
"test:update": "pnpm test:node -u",
|
|
75
73
|
"test:watch": "vitest --config vitest.node.config.js",
|
package/src/cerebras-provider.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { OpenAICompatibleChatLanguageModel } from '@ai-sdk/openai-compatible';
|
|
2
2
|
import {
|
|
3
|
-
|
|
3
|
+
LanguageModelV4,
|
|
4
4
|
NoSuchModelError,
|
|
5
|
-
|
|
5
|
+
ProviderV4,
|
|
6
6
|
} from '@ai-sdk/provider';
|
|
7
7
|
import {
|
|
8
8
|
FetchFunction,
|
|
@@ -50,21 +50,21 @@ export interface CerebrasProviderSettings {
|
|
|
50
50
|
fetch?: FetchFunction;
|
|
51
51
|
}
|
|
52
52
|
|
|
53
|
-
export interface CerebrasProvider extends
|
|
53
|
+
export interface CerebrasProvider extends ProviderV4 {
|
|
54
54
|
/**
|
|
55
55
|
* Creates a Cerebras model for text generation.
|
|
56
56
|
*/
|
|
57
|
-
(modelId: CerebrasChatModelId):
|
|
57
|
+
(modelId: CerebrasChatModelId): LanguageModelV4;
|
|
58
58
|
|
|
59
59
|
/**
|
|
60
60
|
* Creates a Cerebras model for text generation.
|
|
61
61
|
*/
|
|
62
|
-
languageModel(modelId: CerebrasChatModelId):
|
|
62
|
+
languageModel(modelId: CerebrasChatModelId): LanguageModelV4;
|
|
63
63
|
|
|
64
64
|
/**
|
|
65
65
|
* Creates a Cerebras chat model for text generation.
|
|
66
66
|
*/
|
|
67
|
-
chat(modelId: CerebrasChatModelId):
|
|
67
|
+
chat(modelId: CerebrasChatModelId): LanguageModelV4;
|
|
68
68
|
|
|
69
69
|
/**
|
|
70
70
|
* @deprecated Use `embeddingModel` instead.
|
|
@@ -105,7 +105,7 @@ export function createCerebras(
|
|
|
105
105
|
const provider = (modelId: CerebrasChatModelId) =>
|
|
106
106
|
createLanguageModel(modelId);
|
|
107
107
|
|
|
108
|
-
provider.specificationVersion = '
|
|
108
|
+
provider.specificationVersion = 'v4' as const;
|
|
109
109
|
provider.languageModel = createLanguageModel;
|
|
110
110
|
provider.chat = createLanguageModel;
|
|
111
111
|
|