@ai-sdk/cerebras 3.0.0-beta.5 → 3.0.0-beta.58
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 +474 -4
- package/README.md +2 -0
- package/dist/index.js +123 -45
- package/dist/index.js.map +1 -1
- package/docs/40-cerebras.mdx +1 -1
- package/package.json +14 -16
- package/src/cerebras-chat-language-model-options.ts +3 -0
- package/src/cerebras-chat-language-model.ts +136 -0
- package/src/cerebras-provider.ts +41 -7
- package/src/fixtures/cerebras-structured-output-tools.1.json +47 -0
- package/src/fixtures/cerebras-structured-output-tools.2.json +48 -0
- package/src/fixtures/cererebras-structured-output-tools.1.chunks.txt +97 -0
- package/dist/index.d.mts +0 -56
- package/dist/index.mjs +0 -72
- package/dist/index.mjs.map +0 -1
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
{"id":"chatcmpl-9e97f9ca-9626-4ef8-8543-6e3ee7cef659","choices":[{"delta":{"role":"assistant"},"index":0}],"created":1779147581,"model":"zai-glm-4.7","system_fingerprint":"fp_a33c042689e969567008","object":"chat.completion.chunk"}
|
|
2
|
+
{"id":"chatcmpl-9e97f9ca-9626-4ef8-8543-6e3ee7cef659","choices":[{"delta":{"reasoning":"The"},"index":0}],"created":1779147581,"model":"zai-glm-4.7","system_fingerprint":"fp_a33c042689e969567008","object":"chat.completion.chunk"}
|
|
3
|
+
{"id":"chatcmpl-9e97f9ca-9626-4ef8-8543-6e3ee7cef659","choices":[{"delta":{"reasoning":" user is asking about a \""},"index":0}],"created":1779147581,"model":"zai-glm-4.7","system_fingerprint":"fp_a33c042689e969567008","object":"chat.completion.chunk"}
|
|
4
|
+
{"id":"chatcmpl-9e97f9ca-9626-4ef8-8543-6e3ee7cef659","choices":[{"delta":{"reasoning":"magic number\". I"},"index":0}],"created":1779147581,"model":"zai-glm-4.7","system_fingerprint":"fp_a33c042689e969567008","object":"chat.completion.chunk"}
|
|
5
|
+
{"id":"chatcmpl-9e97f9ca-9626-4ef8-8543-6e3ee7cef659","choices":[{"delta":{"reasoning":" have"},"index":0}],"created":1779147581,"model":"zai-glm-4.7","system_fingerprint":"fp_a33c042689e969567008","object":"chat.completion.chunk"}
|
|
6
|
+
{"id":"chatcmpl-9e97f9ca-9626-4ef8-8543-6e3ee7cef659","choices":[{"delta":{"reasoning":" access"},"index":0}],"created":1779147581,"model":"zai-glm-4.7","system_fingerprint":"fp_a33c042689e969567008","object":"chat.completion.chunk"}
|
|
7
|
+
{"id":"chatcmpl-9e97f9ca-9626-4ef8-8543-6e3ee7cef659","choices":[{"delta":{"reasoning":" to"},"index":0}],"created":1779147581,"model":"zai-glm-4.7","system_fingerprint":"fp_a33c042689e969567008","object":"chat.completion.chunk"}
|
|
8
|
+
{"id":"chatcmpl-9e97f9ca-9626-4ef8-8543-6e3ee7cef659","choices":[{"delta":{"reasoning":" a function called"},"index":0}],"created":1779147581,"model":"zai-glm-4.7","system_fingerprint":"fp_a33c042689e969567008","object":"chat.completion.chunk"}
|
|
9
|
+
{"id":"chatcmpl-9e97f9ca-9626-4ef8-8543-6e3ee7cef659","choices":[{"delta":{"reasoning":" \"non"},"index":0}],"created":1779147581,"model":"zai-glm-4.7","system_fingerprint":"fp_a33c042689e969567008","object":"chat.completion.chunk"}
|
|
10
|
+
{"id":"chatcmpl-9e97f9ca-9626-4ef8-8543-6e3ee7cef659","choices":[{"delta":{"reasoning":"UsefulTool\" that \""},"index":0}],"created":1779147581,"model":"zai-glm-4.7","system_fingerprint":"fp_a33c042689e969567008","object":"chat.completion.chunk"}
|
|
11
|
+
{"id":"chatcmpl-9e97f9ca-9626-4ef8-8543-6e3ee7cef659","choices":[{"delta":{"reasoning":"returns a"},"index":0}],"created":1779147581,"model":"zai-glm-4.7","system_fingerprint":"fp_a33c042689e969567008","object":"chat.completion.chunk"}
|
|
12
|
+
{"id":"chatcmpl-9e97f9ca-9626-4ef8-8543-6e3ee7cef659","choices":[{"delta":{"reasoning":" magic number\". Let me"},"index":0}],"created":1779147581,"model":"zai-glm-4.7","system_fingerprint":"fp_a33c042689e969567008","object":"chat.completion.chunk"}
|
|
13
|
+
{"id":"chatcmpl-9e97f9ca-9626-4ef8-8543-6e3ee7cef659","choices":[{"delta":{"reasoning":" call this"},"index":0}],"created":1779147581,"model":"zai-glm-4.7","system_fingerprint":"fp_a33c042689e969567008","object":"chat.completion.chunk"}
|
|
14
|
+
{"id":"chatcmpl-9e97f9ca-9626-4ef8-8543-6e3ee7cef659","choices":[{"delta":{"reasoning":" function to get"},"index":0}],"created":1779147581,"model":"zai-glm-4.7","system_fingerprint":"fp_a33c042689e969567008","object":"chat.completion.chunk"}
|
|
15
|
+
{"id":"chatcmpl-9e97f9ca-9626-4ef8-8543-6e3ee7cef659","choices":[{"delta":{"reasoning":" the"},"index":0}],"created":1779147581,"model":"zai-glm-4.7","system_fingerprint":"fp_a33c042689e969567008","object":"chat.completion.chunk"}
|
|
16
|
+
{"id":"chatcmpl-9e97f9ca-9626-4ef8-8543-6e3ee7cef659","choices":[{"delta":{"reasoning":" magic number for the"},"index":0}],"created":1779147581,"model":"zai-glm-4.7","system_fingerprint":"fp_a33c042689e969567008","object":"chat.completion.chunk"}
|
|
17
|
+
{"id":"chatcmpl-9e97f9ca-9626-4ef8-8543-6e3ee7cef659","choices":[{"delta":{"reasoning":" user.\n\n"},"index":0}],"created":1779147581,"model":"zai-glm-4.7","system_fingerprint":"fp_a33c042689e969567008","object":"chat.completion.chunk"}
|
|
18
|
+
{"id":"chatcmpl-9e97f9ca-9626-4ef8-8543-6e3ee7cef659","choices":[{"delta":{"reasoning":"Looking at"},"index":0}],"created":1779147581,"model":"zai-glm-4.7","system_fingerprint":"fp_a33c042689e969567008","object":"chat.completion.chunk"}
|
|
19
|
+
{"id":"chatcmpl-9e97f9ca-9626-4ef8-8543-6e3ee7cef659","choices":[{"delta":{"reasoning":" the function schema:\n"},"index":0}],"created":1779147581,"model":"zai-glm-4.7","system_fingerprint":"fp_a33c042689e969567008","object":"chat.completion.chunk"}
|
|
20
|
+
{"id":"chatcmpl-9e97f9ca-9626-4ef8-8543-6e3ee7cef659","choices":[{"delta":{"reasoning":"-"},"index":0}],"created":1779147581,"model":"zai-glm-4.7","system_fingerprint":"fp_a33c042689e969567008","object":"chat.completion.chunk"}
|
|
21
|
+
{"id":"chatcmpl-9e97f9ca-9626-4ef8-8543-6e3ee7cef659","choices":[{"delta":{"reasoning":" Function name"},"index":0}],"created":1779147581,"model":"zai-glm-4.7","system_fingerprint":"fp_a33c042689e969567008","object":"chat.completion.chunk"}
|
|
22
|
+
{"id":"chatcmpl-9e97f9ca-9626-4ef8-8543-6e3ee7cef659","choices":[{"delta":{"reasoning":": \""},"index":0}],"created":1779147581,"model":"zai-glm-4.7","system_fingerprint":"fp_a33c042689e969567008","object":"chat.completion.chunk"}
|
|
23
|
+
{"id":"chatcmpl-9e97f9ca-9626-4ef8-8543-6e3ee7cef659","choices":[{"delta":{"reasoning":"non"},"index":0}],"created":1779147581,"model":"zai-glm-4.7","system_fingerprint":"fp_a33c042689e969567008","object":"chat.completion.chunk"}
|
|
24
|
+
{"id":"chatcmpl-9e97f9ca-9626-4ef8-8543-6e3ee7cef659","choices":[{"delta":{"reasoning":"UsefulTool\"\n- Parameters: empty object"},"index":0}],"created":1779147581,"model":"zai-glm-4.7","system_fingerprint":"fp_a33c042689e969567008","object":"chat.completion.chunk"}
|
|
25
|
+
{"id":"chatcmpl-9e97f9ca-9626-4ef8-8543-6e3ee7cef659","choices":[{"delta":{"reasoning":" ("},"index":0}],"created":1779147581,"model":"zai-glm-4.7","system_fingerprint":"fp_a33c042689e969567008","object":"chat.completion.chunk"}
|
|
26
|
+
{"id":"chatcmpl-9e97f9ca-9626-4ef8-8543-6e3ee7cef659","choices":[{"delta":{"reasoning":"no parameters"},"index":0}],"created":1779147581,"model":"zai-glm-4.7","system_fingerprint":"fp_a33c042689e969567008","object":"chat.completion.chunk"}
|
|
27
|
+
{"id":"chatcmpl-9e97f9ca-9626-4ef8-8543-6e3ee7cef659","choices":[{"delta":{"reasoning":" required)\n"},"index":0}],"created":1779147581,"model":"zai-glm-4.7","system_fingerprint":"fp_a33c042689e969567008","object":"chat.completion.chunk"}
|
|
28
|
+
{"id":"chatcmpl-9e97f9ca-9626-4ef8-8543-6e3ee7cef659","choices":[{"delta":{"reasoning":"- Description:"},"index":0}],"created":1779147581,"model":"zai-glm-4.7","system_fingerprint":"fp_a33c042689e969567008","object":"chat.completion.chunk"}
|
|
29
|
+
{"id":"chatcmpl-9e97f9ca-9626-4ef8-8543-6e3ee7cef659","choices":[{"delta":{"reasoning":" \"A non-useful tool that returns a magic number\"\n\nI"},"index":0}],"created":1779147581,"model":"zai-glm-4.7","system_fingerprint":"fp_a33c042689e969567008","object":"chat.completion.chunk"}
|
|
30
|
+
{"id":"chatcmpl-9e97f9ca-9626-4ef8-8543-6e3ee7cef659","choices":[{"delta":{"reasoning":" should"},"index":0}],"created":1779147581,"model":"zai-glm-4.7","system_fingerprint":"fp_a33c042689e969567008","object":"chat.completion.chunk"}
|
|
31
|
+
{"id":"chatcmpl-9e97f9ca-9626-4ef8-8543-6e3ee7cef659","choices":[{"delta":{"reasoning":" call"},"index":0}],"created":1779147581,"model":"zai-glm-4.7","system_fingerprint":"fp_a33c042689e969567008","object":"chat.completion.chunk"}
|
|
32
|
+
{"id":"chatcmpl-9e97f9ca-9626-4ef8-8543-6e3ee7cef659","choices":[{"delta":{"reasoning":" this function to get the magic number"},"index":0}],"created":1779147581,"model":"zai-glm-4.7","system_fingerprint":"fp_a33c042689e969567008","object":"chat.completion.chunk"}
|
|
33
|
+
{"id":"chatcmpl-9e97f9ca-9626-4ef8-8543-6e3ee7cef659","choices":[{"delta":{"reasoning":"."},"index":0}],"created":1779147581,"model":"zai-glm-4.7","system_fingerprint":"fp_a33c042689e969567008","object":"chat.completion.chunk"}
|
|
34
|
+
{"id":"chatcmpl-9e97f9ca-9626-4ef8-8543-6e3ee7cef659","choices":[{"delta":{"tool_calls":[{"function":{"name":"nonUsefulTool","arguments":"{}"},"type":"function","id":"bbd2b9d98","index":0}]},"index":0}],"created":1779147581,"model":"zai-glm-4.7","system_fingerprint":"fp_a33c042689e969567008","object":"chat.completion.chunk"}
|
|
35
|
+
{"id":"chatcmpl-9e97f9ca-9626-4ef8-8543-6e3ee7cef659","choices":[{"delta":{},"finish_reason":"tool_calls","index":0}],"created":1779147581,"model":"zai-glm-4.7","system_fingerprint":"fp_a33c042689e969567008","object":"chat.completion.chunk","usage":{"total_tokens":426,"completion_tokens":104,"completion_tokens_details":{"accepted_prediction_tokens":0,"rejected_prediction_tokens":0,"reasoning_tokens":97},"prompt_tokens":322,"prompt_tokens_details":{"cached_tokens":256}},"time_info":{"created":1779147581.1957242,"queue_time":0.00306479,"prompt_time":0.01150595,"completion_time":0.16727912,"total_time":0.1844015121459961}}
|
|
36
|
+
{"id":"chatcmpl-f4bd7eab-cdbc-418d-896a-ea0b8d5e44ce","choices":[{"delta":{"role":"assistant"},"index":0}],"created":1779147581,"model":"zai-glm-4.7","system_fingerprint":"fp_a33c042689e969567008","object":"chat.completion.chunk"}
|
|
37
|
+
{"id":"chatcmpl-f4bd7eab-cdbc-418d-896a-ea0b8d5e44ce","choices":[{"delta":{"reasoning":"The"},"index":0}],"created":1779147581,"model":"zai-glm-4.7","system_fingerprint":"fp_a33c042689e969567008","object":"chat.completion.chunk"}
|
|
38
|
+
{"id":"chatcmpl-f4bd7eab-cdbc-418d-896a-ea0b8d5e44ce","choices":[{"delta":{"reasoning":" nonUsefulTool returned the"},"index":0}],"created":1779147581,"model":"zai-glm-4.7","system_fingerprint":"fp_a33c042689e969567008","object":"chat.completion.chunk"}
|
|
39
|
+
{"id":"chatcmpl-f4bd7eab-cdbc-418d-896a-ea0b8d5e44ce","choices":[{"delta":{"reasoning":" number"},"index":0}],"created":1779147581,"model":"zai-glm-4.7","system_fingerprint":"fp_a33c042689e969567008","object":"chat.completion.chunk"}
|
|
40
|
+
{"id":"chatcmpl-f4bd7eab-cdbc-418d-896a-ea0b8d5e44ce","choices":[{"delta":{"reasoning":" "},"index":0}],"created":1779147581,"model":"zai-glm-4.7","system_fingerprint":"fp_a33c042689e969567008","object":"chat.completion.chunk"}
|
|
41
|
+
{"id":"chatcmpl-f4bd7eab-cdbc-418d-896a-ea0b8d5e44ce","choices":[{"delta":{"reasoning":"2026"},"index":0}],"created":1779147581,"model":"zai-glm-4.7","system_fingerprint":"fp_a33c042689e969567008","object":"chat.completion.chunk"}
|
|
42
|
+
{"id":"chatcmpl-f4bd7eab-cdbc-418d-896a-ea0b8d5e44ce","choices":[{"delta":{"reasoning":" as the"},"index":0}],"created":1779147581,"model":"zai-glm-4.7","system_fingerprint":"fp_a33c042689e969567008","object":"chat.completion.chunk"}
|
|
43
|
+
{"id":"chatcmpl-f4bd7eab-cdbc-418d-896a-ea0b8d5e44ce","choices":[{"delta":{"reasoning":" \""},"index":0}],"created":1779147581,"model":"zai-glm-4.7","system_fingerprint":"fp_a33c042689e969567008","object":"chat.completion.chunk"}
|
|
44
|
+
{"id":"chatcmpl-f4bd7eab-cdbc-418d-896a-ea0b8d5e44ce","choices":[{"delta":{"reasoning":"magic number\"."},"index":0}],"created":1779147581,"model":"zai-glm-4.7","system_fingerprint":"fp_a33c042689e969567008","object":"chat.completion.chunk"}
|
|
45
|
+
{"id":"chatcmpl-f4bd7eab-cdbc-418d-896a-ea0b8d5e44ce","choices":[{"delta":{"reasoning":" Now I need"},"index":0}],"created":1779147581,"model":"zai-glm-4.7","system_fingerprint":"fp_a33c042689e969567008","object":"chat.completion.chunk"}
|
|
46
|
+
{"id":"chatcmpl-f4bd7eab-cdbc-418d-896a-ea0b8d5e44ce","choices":[{"delta":{"reasoning":" to provide this"},"index":0}],"created":1779147581,"model":"zai-glm-4.7","system_fingerprint":"fp_a33c042689e969567008","object":"chat.completion.chunk"}
|
|
47
|
+
{"id":"chatcmpl-f4bd7eab-cdbc-418d-896a-ea0b8d5e44ce","choices":[{"delta":{"reasoning":" result in"},"index":0}],"created":1779147581,"model":"zai-glm-4.7","system_fingerprint":"fp_a33c042689e969567008","object":"chat.completion.chunk"}
|
|
48
|
+
{"id":"chatcmpl-f4bd7eab-cdbc-418d-896a-ea0b8d5e44ce","choices":[{"delta":{"reasoning":" the specified JSON"},"index":0}],"created":1779147581,"model":"zai-glm-4.7","system_fingerprint":"fp_a33c042689e969567008","object":"chat.completion.chunk"}
|
|
49
|
+
{"id":"chatcmpl-f4bd7eab-cdbc-418d-896a-ea0b8d5e44ce","choices":[{"delta":{"reasoning":" format according"},"index":0}],"created":1779147581,"model":"zai-glm-4.7","system_fingerprint":"fp_a33c042689e969567008","object":"chat.completion.chunk"}
|
|
50
|
+
{"id":"chatcmpl-f4bd7eab-cdbc-418d-896a-ea0b8d5e44ce","choices":[{"delta":{"reasoning":" to the"},"index":0}],"created":1779147581,"model":"zai-glm-4.7","system_fingerprint":"fp_a33c042689e969567008","object":"chat.completion.chunk"}
|
|
51
|
+
{"id":"chatcmpl-f4bd7eab-cdbc-418d-896a-ea0b8d5e44ce","choices":[{"delta":{"reasoning":" schema provided.\n\n"},"index":0}],"created":1779147581,"model":"zai-glm-4.7","system_fingerprint":"fp_a33c042689e969567008","object":"chat.completion.chunk"}
|
|
52
|
+
{"id":"chatcmpl-f4bd7eab-cdbc-418d-896a-ea0b8d5e44ce","choices":[{"delta":{"reasoning":"The schema"},"index":0}],"created":1779147581,"model":"zai-glm-4.7","system_fingerprint":"fp_a33c042689e969567008","object":"chat.completion.chunk"}
|
|
53
|
+
{"id":"chatcmpl-f4bd7eab-cdbc-418d-896a-ea0b8d5e44ce","choices":[{"delta":{"reasoning":" requires:\n-"},"index":0}],"created":1779147581,"model":"zai-glm-4.7","system_fingerprint":"fp_a33c042689e969567008","object":"chat.completion.chunk"}
|
|
54
|
+
{"id":"chatcmpl-f4bd7eab-cdbc-418d-896a-ea0b8d5e44ce","choices":[{"delta":{"reasoning":" A"},"index":0}],"created":1779147581,"model":"zai-glm-4.7","system_fingerprint":"fp_a33c042689e969567008","object":"chat.completion.chunk"}
|
|
55
|
+
{"id":"chatcmpl-f4bd7eab-cdbc-418d-896a-ea0b8d5e44ce","choices":[{"delta":{"reasoning":" JSON object"},"index":0}],"created":1779147581,"model":"zai-glm-4.7","system_fingerprint":"fp_a33c042689e969567008","object":"chat.completion.chunk"}
|
|
56
|
+
{"id":"chatcmpl-f4bd7eab-cdbc-418d-896a-ea0b8d5e44ce","choices":[{"delta":{"reasoning":" with a \"result\" property of type"},"index":0}],"created":1779147581,"model":"zai-glm-4.7","system_fingerprint":"fp_a33c042689e969567008","object":"chat.completion.chunk"}
|
|
57
|
+
{"id":"chatcmpl-f4bd7eab-cdbc-418d-896a-ea0b8d5e44ce","choices":[{"delta":{"reasoning":" string\n"},"index":0}],"created":1779147581,"model":"zai-glm-4.7","system_fingerprint":"fp_a33c042689e969567008","object":"chat.completion.chunk"}
|
|
58
|
+
{"id":"chatcmpl-f4bd7eab-cdbc-418d-896a-ea0b8d5e44ce","choices":[{"delta":{"reasoning":"- The \"result"},"index":0}],"created":1779147581,"model":"zai-glm-4.7","system_fingerprint":"fp_a33c042689e969567008","object":"chat.completion.chunk"}
|
|
59
|
+
{"id":"chatcmpl-f4bd7eab-cdbc-418d-896a-ea0b8d5e44ce","choices":[{"delta":{"reasoning":"\" property is required"},"index":0}],"created":1779147581,"model":"zai-glm-4.7","system_fingerprint":"fp_a33c042689e969567008","object":"chat.completion.chunk"}
|
|
60
|
+
{"id":"chatcmpl-f4bd7eab-cdbc-418d-896a-ea0b8d5e44ce","choices":[{"delta":{"reasoning":"\n"},"index":0}],"created":1779147581,"model":"zai-glm-4.7","system_fingerprint":"fp_a33c042689e969567008","object":"chat.completion.chunk"}
|
|
61
|
+
{"id":"chatcmpl-f4bd7eab-cdbc-418d-896a-ea0b8d5e44ce","choices":[{"delta":{"reasoning":"- No"},"index":0}],"created":1779147581,"model":"zai-glm-4.7","system_fingerprint":"fp_a33c042689e969567008","object":"chat.completion.chunk"}
|
|
62
|
+
{"id":"chatcmpl-f4bd7eab-cdbc-418d-896a-ea0b8d5e44ce","choices":[{"delta":{"reasoning":" additional"},"index":0}],"created":1779147581,"model":"zai-glm-4.7","system_fingerprint":"fp_a33c042689e969567008","object":"chat.completion.chunk"}
|
|
63
|
+
{"id":"chatcmpl-f4bd7eab-cdbc-418d-896a-ea0b8d5e44ce","choices":[{"delta":{"reasoning":" properties are allowed"},"index":0}],"created":1779147581,"model":"zai-glm-4.7","system_fingerprint":"fp_a33c042689e969567008","object":"chat.completion.chunk"}
|
|
64
|
+
{"id":"chatcmpl-f4bd7eab-cdbc-418d-896a-ea0b8d5e44ce","choices":[{"delta":{"reasoning":"\n\nSo I need"},"index":0}],"created":1779147581,"model":"zai-glm-4.7","system_fingerprint":"fp_a33c042689e969567008","object":"chat.completion.chunk"}
|
|
65
|
+
{"id":"chatcmpl-f4bd7eab-cdbc-418d-896a-ea0b8d5e44ce","choices":[{"delta":{"reasoning":" to"},"index":0}],"created":1779147581,"model":"zai-glm-4.7","system_fingerprint":"fp_a33c042689e969567008","object":"chat.completion.chunk"}
|
|
66
|
+
{"id":"chatcmpl-f4bd7eab-cdbc-418d-896a-ea0b8d5e44ce","choices":[{"delta":{"reasoning":" return"},"index":0}],"created":1779147581,"model":"zai-glm-4.7","system_fingerprint":"fp_a33c042689e969567008","object":"chat.completion.chunk"}
|
|
67
|
+
{"id":"chatcmpl-f4bd7eab-cdbc-418d-896a-ea0b8d5e44ce","choices":[{"delta":{"reasoning":":\n```"},"index":0}],"created":1779147581,"model":"zai-glm-4.7","system_fingerprint":"fp_a33c042689e969567008","object":"chat.completion.chunk"}
|
|
68
|
+
{"id":"chatcmpl-f4bd7eab-cdbc-418d-896a-ea0b8d5e44ce","choices":[{"delta":{"reasoning":"json\n{\"result\":"},"index":0}],"created":1779147581,"model":"zai-glm-4.7","system_fingerprint":"fp_a33c042689e969567008","object":"chat.completion.chunk"}
|
|
69
|
+
{"id":"chatcmpl-f4bd7eab-cdbc-418d-896a-ea0b8d5e44ce","choices":[{"delta":{"reasoning":" \"2026"},"index":0}],"created":1779147581,"model":"zai-glm-4.7","system_fingerprint":"fp_a33c042689e969567008","object":"chat.completion.chunk"}
|
|
70
|
+
{"id":"chatcmpl-f4bd7eab-cdbc-418d-896a-ea0b8d5e44ce","choices":[{"delta":{"reasoning":"\"}\n```\n\nNote"},"index":0}],"created":1779147581,"model":"zai-glm-4.7","system_fingerprint":"fp_a33c042689e969567008","object":"chat.completion.chunk"}
|
|
71
|
+
{"id":"chatcmpl-f4bd7eab-cdbc-418d-896a-ea0b8d5e44ce","choices":[{"delta":{"reasoning":" that the"},"index":0}],"created":1779147581,"model":"zai-glm-4.7","system_fingerprint":"fp_a33c042689e969567008","object":"chat.completion.chunk"}
|
|
72
|
+
{"id":"chatcmpl-f4bd7eab-cdbc-418d-896a-ea0b8d5e44ce","choices":[{"delta":{"reasoning":" result should"},"index":0}],"created":1779147581,"model":"zai-glm-4.7","system_fingerprint":"fp_a33c042689e969567008","object":"chat.completion.chunk"}
|
|
73
|
+
{"id":"chatcmpl-f4bd7eab-cdbc-418d-896a-ea0b8d5e44ce","choices":[{"delta":{"reasoning":" be"},"index":0}],"created":1779147581,"model":"zai-glm-4.7","system_fingerprint":"fp_a33c042689e969567008","object":"chat.completion.chunk"}
|
|
74
|
+
{"id":"chatcmpl-f4bd7eab-cdbc-418d-896a-ea0b8d5e44ce","choices":[{"delta":{"reasoning":" a"},"index":0}],"created":1779147581,"model":"zai-glm-4.7","system_fingerprint":"fp_a33c042689e969567008","object":"chat.completion.chunk"}
|
|
75
|
+
{"id":"chatcmpl-f4bd7eab-cdbc-418d-896a-ea0b8d5e44ce","choices":[{"delta":{"reasoning":" string"},"index":0}],"created":1779147581,"model":"zai-glm-4.7","system_fingerprint":"fp_a33c042689e969567008","object":"chat.completion.chunk"}
|
|
76
|
+
{"id":"chatcmpl-f4bd7eab-cdbc-418d-896a-ea0b8d5e44ce","choices":[{"delta":{"reasoning":" according"},"index":0}],"created":1779147581,"model":"zai-glm-4.7","system_fingerprint":"fp_a33c042689e969567008","object":"chat.completion.chunk"}
|
|
77
|
+
{"id":"chatcmpl-f4bd7eab-cdbc-418d-896a-ea0b8d5e44ce","choices":[{"delta":{"reasoning":" to"},"index":0}],"created":1779147581,"model":"zai-glm-4.7","system_fingerprint":"fp_a33c042689e969567008","object":"chat.completion.chunk"}
|
|
78
|
+
{"id":"chatcmpl-f4bd7eab-cdbc-418d-896a-ea0b8d5e44ce","choices":[{"delta":{"reasoning":" the"},"index":0}],"created":1779147581,"model":"zai-glm-4.7","system_fingerprint":"fp_a33c042689e969567008","object":"chat.completion.chunk"}
|
|
79
|
+
{"id":"chatcmpl-f4bd7eab-cdbc-418d-896a-ea0b8d5e44ce","choices":[{"delta":{"reasoning":" schema"},"index":0}],"created":1779147581,"model":"zai-glm-4.7","system_fingerprint":"fp_a33c042689e969567008","object":"chat.completion.chunk"}
|
|
80
|
+
{"id":"chatcmpl-f4bd7eab-cdbc-418d-896a-ea0b8d5e44ce","choices":[{"delta":{"reasoning":","},"index":0}],"created":1779147581,"model":"zai-glm-4.7","system_fingerprint":"fp_a33c042689e969567008","object":"chat.completion.chunk"}
|
|
81
|
+
{"id":"chatcmpl-f4bd7eab-cdbc-418d-896a-ea0b8d5e44ce","choices":[{"delta":{"reasoning":" even"},"index":0}],"created":1779147581,"model":"zai-glm-4.7","system_fingerprint":"fp_a33c042689e969567008","object":"chat.completion.chunk"}
|
|
82
|
+
{"id":"chatcmpl-f4bd7eab-cdbc-418d-896a-ea0b8d5e44ce","choices":[{"delta":{"reasoning":" though"},"index":0}],"created":1779147581,"model":"zai-glm-4.7","system_fingerprint":"fp_a33c042689e969567008","object":"chat.completion.chunk"}
|
|
83
|
+
{"id":"chatcmpl-f4bd7eab-cdbc-418d-896a-ea0b8d5e44ce","choices":[{"delta":{"reasoning":" it"},"index":0}],"created":1779147581,"model":"zai-glm-4.7","system_fingerprint":"fp_a33c042689e969567008","object":"chat.completion.chunk"}
|
|
84
|
+
{"id":"chatcmpl-f4bd7eab-cdbc-418d-896a-ea0b8d5e44ce","choices":[{"delta":{"reasoning":"'s"},"index":0}],"created":1779147581,"model":"zai-glm-4.7","system_fingerprint":"fp_a33c042689e969567008","object":"chat.completion.chunk"}
|
|
85
|
+
{"id":"chatcmpl-f4bd7eab-cdbc-418d-896a-ea0b8d5e44ce","choices":[{"delta":{"reasoning":" a"},"index":0}],"created":1779147581,"model":"zai-glm-4.7","system_fingerprint":"fp_a33c042689e969567008","object":"chat.completion.chunk"}
|
|
86
|
+
{"id":"chatcmpl-f4bd7eab-cdbc-418d-896a-ea0b8d5e44ce","choices":[{"delta":{"reasoning":" number"},"index":0}],"created":1779147581,"model":"zai-glm-4.7","system_fingerprint":"fp_a33c042689e969567008","object":"chat.completion.chunk"}
|
|
87
|
+
{"id":"chatcmpl-f4bd7eab-cdbc-418d-896a-ea0b8d5e44ce","choices":[{"delta":{"reasoning":"."},"index":0}],"created":1779147581,"model":"zai-glm-4.7","system_fingerprint":"fp_a33c042689e969567008","object":"chat.completion.chunk"}
|
|
88
|
+
{"id":"chatcmpl-f4bd7eab-cdbc-418d-896a-ea0b8d5e44ce","choices":[{"delta":{},"index":0}],"created":1779147581,"model":"zai-glm-4.7","system_fingerprint":"fp_a33c042689e969567008","object":"chat.completion.chunk"}
|
|
89
|
+
{"id":"chatcmpl-f4bd7eab-cdbc-418d-896a-ea0b8d5e44ce","choices":[{"delta":{"content":"{\""},"index":0}],"created":1779147581,"model":"zai-glm-4.7","system_fingerprint":"fp_a33c042689e969567008","object":"chat.completion.chunk"}
|
|
90
|
+
{"id":"chatcmpl-f4bd7eab-cdbc-418d-896a-ea0b8d5e44ce","choices":[{"delta":{"content":"result"},"index":0}],"created":1779147581,"model":"zai-glm-4.7","system_fingerprint":"fp_a33c042689e969567008","object":"chat.completion.chunk"}
|
|
91
|
+
{"id":"chatcmpl-f4bd7eab-cdbc-418d-896a-ea0b8d5e44ce","choices":[{"delta":{"content":"\":"},"index":0}],"created":1779147581,"model":"zai-glm-4.7","system_fingerprint":"fp_a33c042689e969567008","object":"chat.completion.chunk"}
|
|
92
|
+
{"id":"chatcmpl-f4bd7eab-cdbc-418d-896a-ea0b8d5e44ce","choices":[{"delta":{"content":" \""},"index":0}],"created":1779147581,"model":"zai-glm-4.7","system_fingerprint":"fp_a33c042689e969567008","object":"chat.completion.chunk"}
|
|
93
|
+
{"id":"chatcmpl-f4bd7eab-cdbc-418d-896a-ea0b8d5e44ce","choices":[{"delta":{"content":"202"},"index":0}],"created":1779147581,"model":"zai-glm-4.7","system_fingerprint":"fp_a33c042689e969567008","object":"chat.completion.chunk"}
|
|
94
|
+
{"id":"chatcmpl-f4bd7eab-cdbc-418d-896a-ea0b8d5e44ce","choices":[{"delta":{"content":"6"},"index":0}],"created":1779147581,"model":"zai-glm-4.7","system_fingerprint":"fp_a33c042689e969567008","object":"chat.completion.chunk"}
|
|
95
|
+
{"id":"chatcmpl-f4bd7eab-cdbc-418d-896a-ea0b8d5e44ce","choices":[{"delta":{"content":"\"}"},"index":0}],"created":1779147581,"model":"zai-glm-4.7","system_fingerprint":"fp_a33c042689e969567008","object":"chat.completion.chunk"}
|
|
96
|
+
{"id":"chatcmpl-f4bd7eab-cdbc-418d-896a-ea0b8d5e44ce","choices":[{"delta":{"tool_calls":[{"function":{"name":"nonUsefulTool","arguments":"{}"},"type":"function","id":"e0ecf32e0","index":0}]},"index":0}],"created":1779147581,"model":"zai-glm-4.7","system_fingerprint":"fp_a33c042689e969567008","object":"chat.completion.chunk"}
|
|
97
|
+
{"id":"chatcmpl-f4bd7eab-cdbc-418d-896a-ea0b8d5e44ce","choices":[{"delta":{},"finish_reason":"tool_calls","index":0}],"created":1779147581,"model":"zai-glm-4.7","system_fingerprint":"fp_a33c042689e969567008","object":"chat.completion.chunk","usage":{"total_tokens":555,"completion_tokens":122,"completion_tokens_details":{"accepted_prediction_tokens":0,"rejected_prediction_tokens":0,"reasoning_tokens":108},"prompt_tokens":433,"prompt_tokens_details":{"cached_tokens":256}},"time_info":{"created":1779147581.570175,"queue_time":0.003384742,"prompt_time":0.012728517,"completion_time":0.220198588,"total_time":0.34409451484680176}}
|
package/dist/index.d.mts
DELETED
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
import { ProviderV4, LanguageModelV4 } from '@ai-sdk/provider';
|
|
2
|
-
import { FetchFunction } from '@ai-sdk/provider-utils';
|
|
3
|
-
import { z } from 'zod/v4';
|
|
4
|
-
|
|
5
|
-
type CerebrasChatModelId = 'llama3.1-8b' | 'gpt-oss-120b' | 'qwen-3-235b-a22b-instruct-2507' | 'qwen-3-235b-a22b-thinking-2507' | 'zai-glm-4.6' | 'zai-glm-4.7' | (string & {});
|
|
6
|
-
|
|
7
|
-
declare const cerebrasErrorSchema: z.ZodObject<{
|
|
8
|
-
message: z.ZodString;
|
|
9
|
-
type: z.ZodString;
|
|
10
|
-
param: z.ZodString;
|
|
11
|
-
code: z.ZodString;
|
|
12
|
-
}, z.core.$strip>;
|
|
13
|
-
type CerebrasErrorData = z.infer<typeof cerebrasErrorSchema>;
|
|
14
|
-
interface CerebrasProviderSettings {
|
|
15
|
-
/**
|
|
16
|
-
* Cerebras API key.
|
|
17
|
-
*/
|
|
18
|
-
apiKey?: string;
|
|
19
|
-
/**
|
|
20
|
-
* Base URL for the API calls.
|
|
21
|
-
*/
|
|
22
|
-
baseURL?: string;
|
|
23
|
-
/**
|
|
24
|
-
* Custom headers to include in the requests.
|
|
25
|
-
*/
|
|
26
|
-
headers?: Record<string, string>;
|
|
27
|
-
/**
|
|
28
|
-
* Custom fetch implementation. You can use it as a middleware to intercept requests,
|
|
29
|
-
* or to provide a custom fetch implementation for e.g. testing.
|
|
30
|
-
*/
|
|
31
|
-
fetch?: FetchFunction;
|
|
32
|
-
}
|
|
33
|
-
interface CerebrasProvider extends ProviderV4 {
|
|
34
|
-
/**
|
|
35
|
-
* Creates a Cerebras model for text generation.
|
|
36
|
-
*/
|
|
37
|
-
(modelId: CerebrasChatModelId): LanguageModelV4;
|
|
38
|
-
/**
|
|
39
|
-
* Creates a Cerebras model for text generation.
|
|
40
|
-
*/
|
|
41
|
-
languageModel(modelId: CerebrasChatModelId): LanguageModelV4;
|
|
42
|
-
/**
|
|
43
|
-
* Creates a Cerebras chat model for text generation.
|
|
44
|
-
*/
|
|
45
|
-
chat(modelId: CerebrasChatModelId): LanguageModelV4;
|
|
46
|
-
/**
|
|
47
|
-
* @deprecated Use `embeddingModel` instead.
|
|
48
|
-
*/
|
|
49
|
-
textEmbeddingModel(modelId: string): never;
|
|
50
|
-
}
|
|
51
|
-
declare function createCerebras(options?: CerebrasProviderSettings): CerebrasProvider;
|
|
52
|
-
declare const cerebras: CerebrasProvider;
|
|
53
|
-
|
|
54
|
-
declare const VERSION: string;
|
|
55
|
-
|
|
56
|
-
export { type CerebrasErrorData, type CerebrasProvider, type CerebrasProviderSettings, VERSION, cerebras, createCerebras };
|
package/dist/index.mjs
DELETED
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
// src/cerebras-provider.ts
|
|
2
|
-
import { OpenAICompatibleChatLanguageModel } from "@ai-sdk/openai-compatible";
|
|
3
|
-
import {
|
|
4
|
-
NoSuchModelError
|
|
5
|
-
} from "@ai-sdk/provider";
|
|
6
|
-
import {
|
|
7
|
-
loadApiKey,
|
|
8
|
-
withoutTrailingSlash,
|
|
9
|
-
withUserAgentSuffix
|
|
10
|
-
} from "@ai-sdk/provider-utils";
|
|
11
|
-
import { z } from "zod/v4";
|
|
12
|
-
|
|
13
|
-
// src/version.ts
|
|
14
|
-
var VERSION = true ? "3.0.0-beta.5" : "0.0.0-test";
|
|
15
|
-
|
|
16
|
-
// src/cerebras-provider.ts
|
|
17
|
-
var cerebrasErrorSchema = z.object({
|
|
18
|
-
message: z.string(),
|
|
19
|
-
type: z.string(),
|
|
20
|
-
param: z.string(),
|
|
21
|
-
code: z.string()
|
|
22
|
-
});
|
|
23
|
-
var cerebrasErrorStructure = {
|
|
24
|
-
errorSchema: cerebrasErrorSchema,
|
|
25
|
-
errorToMessage: (data) => data.message
|
|
26
|
-
};
|
|
27
|
-
function createCerebras(options = {}) {
|
|
28
|
-
var _a;
|
|
29
|
-
const baseURL = withoutTrailingSlash(
|
|
30
|
-
(_a = options.baseURL) != null ? _a : "https://api.cerebras.ai/v1"
|
|
31
|
-
);
|
|
32
|
-
const getHeaders = () => withUserAgentSuffix(
|
|
33
|
-
{
|
|
34
|
-
Authorization: `Bearer ${loadApiKey({
|
|
35
|
-
apiKey: options.apiKey,
|
|
36
|
-
environmentVariableName: "CEREBRAS_API_KEY",
|
|
37
|
-
description: "Cerebras API key"
|
|
38
|
-
})}`,
|
|
39
|
-
...options.headers
|
|
40
|
-
},
|
|
41
|
-
`ai-sdk/cerebras/${VERSION}`
|
|
42
|
-
);
|
|
43
|
-
const createLanguageModel = (modelId) => {
|
|
44
|
-
return new OpenAICompatibleChatLanguageModel(modelId, {
|
|
45
|
-
provider: `cerebras.chat`,
|
|
46
|
-
url: ({ path }) => `${baseURL}${path}`,
|
|
47
|
-
headers: getHeaders,
|
|
48
|
-
fetch: options.fetch,
|
|
49
|
-
errorStructure: cerebrasErrorStructure,
|
|
50
|
-
supportsStructuredOutputs: true
|
|
51
|
-
});
|
|
52
|
-
};
|
|
53
|
-
const provider = (modelId) => createLanguageModel(modelId);
|
|
54
|
-
provider.specificationVersion = "v4";
|
|
55
|
-
provider.languageModel = createLanguageModel;
|
|
56
|
-
provider.chat = createLanguageModel;
|
|
57
|
-
provider.embeddingModel = (modelId) => {
|
|
58
|
-
throw new NoSuchModelError({ modelId, modelType: "embeddingModel" });
|
|
59
|
-
};
|
|
60
|
-
provider.textEmbeddingModel = provider.embeddingModel;
|
|
61
|
-
provider.imageModel = (modelId) => {
|
|
62
|
-
throw new NoSuchModelError({ modelId, modelType: "imageModel" });
|
|
63
|
-
};
|
|
64
|
-
return provider;
|
|
65
|
-
}
|
|
66
|
-
var cerebras = createCerebras();
|
|
67
|
-
export {
|
|
68
|
-
VERSION,
|
|
69
|
-
cerebras,
|
|
70
|
-
createCerebras
|
|
71
|
-
};
|
|
72
|
-
//# sourceMappingURL=index.mjs.map
|
package/dist/index.mjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
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,iBACA;;;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":[]}
|