@friendliai/ai-provider 1.0.0-beta.0 → 1.0.0-beta.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 +27 -0
- package/dist/index.d.mts +61 -28
- package/dist/index.d.ts +61 -28
- package/dist/index.js +144 -66
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +139 -61
- package/dist/index.mjs.map +1 -1
- package/package.json +8 -8
package/CHANGELOG.md
CHANGED
|
@@ -1,11 +1,38 @@
|
|
|
1
1
|
# @friendliai/ai-provider
|
|
2
2
|
|
|
3
|
+
## 1.0.0-beta.1
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 2ffbb78: ### Provider Tools Improvements
|
|
8
|
+
- **Renamed tool functions** for cleaner API:
|
|
9
|
+
- `webSearchBetaTool()` → `webSearch()`
|
|
10
|
+
- `webUrlBetaTool()` → `webUrl()`
|
|
11
|
+
- `mathCalendarBetaTool()` → `mathCalendar()`
|
|
12
|
+
- `mathStatisticsBetaTool()` → `mathStatistics()`
|
|
13
|
+
- `mathCalculatorBetaTool()` → `mathCalculator()`
|
|
14
|
+
- `codePythonInterpreterBetaTool()` → `codePythonInterpreter()`
|
|
15
|
+
- **Added streaming support for provider-executed tools**: Tool calls and results from Friendli's built-in tools (web search, calculator, etc.) are now properly streamed, allowing users to see tool execution progress in real-time.
|
|
16
|
+
- **Fixed tool type compatibility**: Provider tools now correctly implement the AI SDK `Tool` type with `inputSchema`, resolving type errors when using `friendli.tools.*` with `generateText` or `streamText`.
|
|
17
|
+
|
|
3
18
|
## 1.0.0-beta.0
|
|
4
19
|
|
|
5
20
|
### Major Changes
|
|
6
21
|
|
|
7
22
|
- 3044ef8: Entering the AI SDK v6 compatible migration
|
|
8
23
|
|
|
24
|
+
## 0.3.4
|
|
25
|
+
|
|
26
|
+
### Patch Changes
|
|
27
|
+
|
|
28
|
+
- 795d5bf: add minimax-m2 in FSE
|
|
29
|
+
|
|
30
|
+
## 0.3.3
|
|
31
|
+
|
|
32
|
+
### Patch Changes
|
|
33
|
+
|
|
34
|
+
- a6180ef: add deepseek v3.1 in FSE
|
|
35
|
+
|
|
9
36
|
## 0.3.2
|
|
10
37
|
|
|
11
38
|
### Patch Changes
|
package/dist/index.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { z } from 'zod/v4';
|
|
2
|
-
import {
|
|
3
|
-
import { FetchFunction } from '@ai-sdk/provider-utils';
|
|
2
|
+
import { ProviderV3, LanguageModelV3, EmbeddingModelV3, ImageModelV3, TranscriptionModelV3, SpeechModelV3 } from '@ai-sdk/provider';
|
|
3
|
+
import { Tool, FetchFunction } from '@ai-sdk/provider-utils';
|
|
4
4
|
|
|
5
5
|
declare const friendliaiErrorSchema: z.ZodObject<{
|
|
6
6
|
message: z.ZodString;
|
|
@@ -8,23 +8,56 @@ declare const friendliaiErrorSchema: z.ZodObject<{
|
|
|
8
8
|
}, z.core.$strip>;
|
|
9
9
|
type FriendliAIErrorData = z.infer<typeof friendliaiErrorSchema>;
|
|
10
10
|
|
|
11
|
-
declare const FriendliAIServerlessModelIds: readonly ["LGAI-EXAONE/EXAONE-4.0.1-32B", "skt/A.X-4.0", "skt/A.X-3.1", "naver-hyperclovax/HyperCLOVAX-SEED-Think-14B", "deepseek-ai/DeepSeek-R1-0528", "meta-llama/Llama-4-Maverick-17B-128E-Instruct", "meta-llama/Llama-4-Scout-17B-16E-Instruct", "meta-llama/Llama-3.3-70B-Instruct", "meta-llama-3.3-70b-instruct", "meta-llama/Llama-3.1-8B-Instruct", "meta-llama-3.1-8b-instruct", "Qwen/Qwen3-235B-A22B-Thinking-2507", "Qwen/Qwen3-235B-A22B-Instruct-2507", "Qwen/Qwen3-30B-A3B", "Qwen/Qwen3-32B", "google/gemma-3-27b-it", "mistralai/Mistral-Small-3.1-24B-Instruct-2503", "mistralai/Devstral-Small-2505", "mistralai/Magistral-Small-2506"];
|
|
11
|
+
declare const FriendliAIServerlessModelIds: readonly ["MiniMaxAI/MiniMax-M2", "zai-org/GLM-4.6", "LGAI-EXAONE/EXAONE-4.0.1-32B", "skt/A.X-4.0", "skt/A.X-3.1", "naver-hyperclovax/HyperCLOVAX-SEED-Think-14B", "deepseek-ai/DeepSeek-V3.1", "deepseek-ai/DeepSeek-R1-0528", "meta-llama/Llama-4-Maverick-17B-128E-Instruct", "meta-llama/Llama-4-Scout-17B-16E-Instruct", "meta-llama/Llama-3.3-70B-Instruct", "meta-llama-3.3-70b-instruct", "meta-llama/Llama-3.1-8B-Instruct", "meta-llama-3.1-8b-instruct", "Qwen/Qwen3-235B-A22B-Thinking-2507", "Qwen/Qwen3-235B-A22B-Instruct-2507", "Qwen/Qwen3-30B-A3B", "Qwen/Qwen3-32B", "google/gemma-3-27b-it", "mistralai/Mistral-Small-3.1-24B-Instruct-2503", "mistralai/Devstral-Small-2505", "mistralai/Magistral-Small-2506"];
|
|
12
12
|
type FriendliAIServerlessModelId = (typeof FriendliAIServerlessModelIds)[number];
|
|
13
13
|
type FriendliAILanguageModelId = FriendliAIServerlessModelId | (string & {});
|
|
14
14
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
15
|
+
/**
|
|
16
|
+
* Friendli built-in tools for serverless tool-assisted API.
|
|
17
|
+
*
|
|
18
|
+
* @remarks
|
|
19
|
+
* These tools are currently in **Beta**. While we strive to provide a stable
|
|
20
|
+
* and reliable experience, this feature is still under active development.
|
|
21
|
+
*
|
|
22
|
+
* @see https://friendli.ai/docs/guides/serverless_endpoints/tool-assisted-api
|
|
23
|
+
*/
|
|
24
|
+
/**
|
|
25
|
+
* Web search tool - searches the web for information.
|
|
26
|
+
* @beta
|
|
27
|
+
*/
|
|
28
|
+
declare function webSearch(): Tool;
|
|
29
|
+
/**
|
|
30
|
+
* Web URL tool - fetches content from a specific URL.
|
|
31
|
+
* @beta
|
|
32
|
+
*/
|
|
33
|
+
declare function webUrl(): Tool;
|
|
34
|
+
/**
|
|
35
|
+
* Math calendar tool - performs calendar-related calculations.
|
|
36
|
+
* @beta
|
|
37
|
+
*/
|
|
38
|
+
declare function mathCalendar(): Tool;
|
|
39
|
+
/**
|
|
40
|
+
* Math statistics tool - performs statistical calculations.
|
|
41
|
+
* @beta
|
|
42
|
+
*/
|
|
43
|
+
declare function mathStatistics(): Tool;
|
|
44
|
+
/**
|
|
45
|
+
* Math calculator tool - performs arithmetic calculations.
|
|
46
|
+
* @beta
|
|
47
|
+
*/
|
|
48
|
+
declare function mathCalculator(): Tool;
|
|
49
|
+
/**
|
|
50
|
+
* Python interpreter tool - executes Python code.
|
|
51
|
+
* @beta
|
|
52
|
+
*/
|
|
53
|
+
declare function codePythonInterpreter(): Tool;
|
|
21
54
|
declare const friendliTools: {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
55
|
+
webSearch: typeof webSearch;
|
|
56
|
+
webUrl: typeof webUrl;
|
|
57
|
+
mathCalendar: typeof mathCalendar;
|
|
58
|
+
mathStatistics: typeof mathStatistics;
|
|
59
|
+
mathCalculator: typeof mathCalculator;
|
|
60
|
+
codePythonInterpreter: typeof codePythonInterpreter;
|
|
28
61
|
};
|
|
29
62
|
|
|
30
63
|
type Pricing = {
|
|
@@ -71,52 +104,52 @@ interface FriendliAIProviderSettings {
|
|
|
71
104
|
*/
|
|
72
105
|
fetch?: FetchFunction;
|
|
73
106
|
}
|
|
74
|
-
interface FriendliAIProvider extends
|
|
107
|
+
interface FriendliAIProvider extends ProviderV3 {
|
|
75
108
|
/**
|
|
76
109
|
* Creates a model for text generation.
|
|
77
110
|
*/
|
|
78
|
-
(modelId: FriendliAILanguageModelId):
|
|
111
|
+
(modelId: FriendliAILanguageModelId): LanguageModelV3;
|
|
79
112
|
/**
|
|
80
113
|
* Creates a chat model for text generation.
|
|
81
114
|
*/
|
|
82
|
-
languageModel(modelId: FriendliAILanguageModelId):
|
|
115
|
+
languageModel(modelId: FriendliAILanguageModelId): LanguageModelV3;
|
|
83
116
|
/**
|
|
84
117
|
* Creates a chat model for text generation.
|
|
85
118
|
*/
|
|
86
|
-
chat(modelId: FriendliAILanguageModelId):
|
|
119
|
+
chat(modelId: FriendliAILanguageModelId): LanguageModelV3;
|
|
87
120
|
/**
|
|
88
121
|
* Creates a completion model for text generation.
|
|
89
122
|
*/
|
|
90
|
-
completion(modelId: FriendliAILanguageModelId):
|
|
123
|
+
completion(modelId: FriendliAILanguageModelId): LanguageModelV3;
|
|
91
124
|
/**
|
|
92
|
-
* Creates
|
|
125
|
+
* Creates an embedding model for text generation.
|
|
93
126
|
* TODO: Implement for Dedicated users
|
|
94
127
|
*/
|
|
95
|
-
embedding(modelId: string & {}):
|
|
96
|
-
|
|
128
|
+
embedding(modelId: string & {}): LanguageModelV3;
|
|
129
|
+
embeddingModel(modelId: string & {}): LanguageModelV3;
|
|
97
130
|
/**
|
|
98
131
|
* Returns the available models and their metadata.
|
|
99
132
|
*/
|
|
100
133
|
getAvailableModels(options?: {
|
|
101
134
|
graphqlURL?: string;
|
|
102
135
|
}): Promise<FriendliAvailableModelsResponse>;
|
|
103
|
-
embedding(modelId: string & {}):
|
|
104
|
-
|
|
136
|
+
embedding(modelId: string & {}): EmbeddingModelV3;
|
|
137
|
+
embeddingModel(modelId: string & {}): EmbeddingModelV3;
|
|
105
138
|
/**
|
|
106
139
|
* Creates a model for image generation.
|
|
107
140
|
* TODO: Implement for Dedicated users
|
|
108
141
|
*/
|
|
109
|
-
imageModel(modelId: string & {}):
|
|
142
|
+
imageModel(modelId: string & {}): ImageModelV3;
|
|
110
143
|
/**
|
|
111
144
|
* Creates a model for transcription.
|
|
112
145
|
* TODO: Implement for Dedicated users
|
|
113
146
|
*/
|
|
114
|
-
transcription(modelId: string & {}):
|
|
147
|
+
transcription(modelId: string & {}): TranscriptionModelV3;
|
|
115
148
|
/**
|
|
116
149
|
* Creates a model for speech generation.
|
|
117
150
|
* TODO: Implement for Dedicated users
|
|
118
151
|
*/
|
|
119
|
-
speech(modelId: string & {}):
|
|
152
|
+
speech(modelId: string & {}): SpeechModelV3;
|
|
120
153
|
/**
|
|
121
154
|
* Friendli-specific tools.
|
|
122
155
|
*/
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { z } from 'zod/v4';
|
|
2
|
-
import {
|
|
3
|
-
import { FetchFunction } from '@ai-sdk/provider-utils';
|
|
2
|
+
import { ProviderV3, LanguageModelV3, EmbeddingModelV3, ImageModelV3, TranscriptionModelV3, SpeechModelV3 } from '@ai-sdk/provider';
|
|
3
|
+
import { Tool, FetchFunction } from '@ai-sdk/provider-utils';
|
|
4
4
|
|
|
5
5
|
declare const friendliaiErrorSchema: z.ZodObject<{
|
|
6
6
|
message: z.ZodString;
|
|
@@ -8,23 +8,56 @@ declare const friendliaiErrorSchema: z.ZodObject<{
|
|
|
8
8
|
}, z.core.$strip>;
|
|
9
9
|
type FriendliAIErrorData = z.infer<typeof friendliaiErrorSchema>;
|
|
10
10
|
|
|
11
|
-
declare const FriendliAIServerlessModelIds: readonly ["LGAI-EXAONE/EXAONE-4.0.1-32B", "skt/A.X-4.0", "skt/A.X-3.1", "naver-hyperclovax/HyperCLOVAX-SEED-Think-14B", "deepseek-ai/DeepSeek-R1-0528", "meta-llama/Llama-4-Maverick-17B-128E-Instruct", "meta-llama/Llama-4-Scout-17B-16E-Instruct", "meta-llama/Llama-3.3-70B-Instruct", "meta-llama-3.3-70b-instruct", "meta-llama/Llama-3.1-8B-Instruct", "meta-llama-3.1-8b-instruct", "Qwen/Qwen3-235B-A22B-Thinking-2507", "Qwen/Qwen3-235B-A22B-Instruct-2507", "Qwen/Qwen3-30B-A3B", "Qwen/Qwen3-32B", "google/gemma-3-27b-it", "mistralai/Mistral-Small-3.1-24B-Instruct-2503", "mistralai/Devstral-Small-2505", "mistralai/Magistral-Small-2506"];
|
|
11
|
+
declare const FriendliAIServerlessModelIds: readonly ["MiniMaxAI/MiniMax-M2", "zai-org/GLM-4.6", "LGAI-EXAONE/EXAONE-4.0.1-32B", "skt/A.X-4.0", "skt/A.X-3.1", "naver-hyperclovax/HyperCLOVAX-SEED-Think-14B", "deepseek-ai/DeepSeek-V3.1", "deepseek-ai/DeepSeek-R1-0528", "meta-llama/Llama-4-Maverick-17B-128E-Instruct", "meta-llama/Llama-4-Scout-17B-16E-Instruct", "meta-llama/Llama-3.3-70B-Instruct", "meta-llama-3.3-70b-instruct", "meta-llama/Llama-3.1-8B-Instruct", "meta-llama-3.1-8b-instruct", "Qwen/Qwen3-235B-A22B-Thinking-2507", "Qwen/Qwen3-235B-A22B-Instruct-2507", "Qwen/Qwen3-30B-A3B", "Qwen/Qwen3-32B", "google/gemma-3-27b-it", "mistralai/Mistral-Small-3.1-24B-Instruct-2503", "mistralai/Devstral-Small-2505", "mistralai/Magistral-Small-2506"];
|
|
12
12
|
type FriendliAIServerlessModelId = (typeof FriendliAIServerlessModelIds)[number];
|
|
13
13
|
type FriendliAILanguageModelId = FriendliAIServerlessModelId | (string & {});
|
|
14
14
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
15
|
+
/**
|
|
16
|
+
* Friendli built-in tools for serverless tool-assisted API.
|
|
17
|
+
*
|
|
18
|
+
* @remarks
|
|
19
|
+
* These tools are currently in **Beta**. While we strive to provide a stable
|
|
20
|
+
* and reliable experience, this feature is still under active development.
|
|
21
|
+
*
|
|
22
|
+
* @see https://friendli.ai/docs/guides/serverless_endpoints/tool-assisted-api
|
|
23
|
+
*/
|
|
24
|
+
/**
|
|
25
|
+
* Web search tool - searches the web for information.
|
|
26
|
+
* @beta
|
|
27
|
+
*/
|
|
28
|
+
declare function webSearch(): Tool;
|
|
29
|
+
/**
|
|
30
|
+
* Web URL tool - fetches content from a specific URL.
|
|
31
|
+
* @beta
|
|
32
|
+
*/
|
|
33
|
+
declare function webUrl(): Tool;
|
|
34
|
+
/**
|
|
35
|
+
* Math calendar tool - performs calendar-related calculations.
|
|
36
|
+
* @beta
|
|
37
|
+
*/
|
|
38
|
+
declare function mathCalendar(): Tool;
|
|
39
|
+
/**
|
|
40
|
+
* Math statistics tool - performs statistical calculations.
|
|
41
|
+
* @beta
|
|
42
|
+
*/
|
|
43
|
+
declare function mathStatistics(): Tool;
|
|
44
|
+
/**
|
|
45
|
+
* Math calculator tool - performs arithmetic calculations.
|
|
46
|
+
* @beta
|
|
47
|
+
*/
|
|
48
|
+
declare function mathCalculator(): Tool;
|
|
49
|
+
/**
|
|
50
|
+
* Python interpreter tool - executes Python code.
|
|
51
|
+
* @beta
|
|
52
|
+
*/
|
|
53
|
+
declare function codePythonInterpreter(): Tool;
|
|
21
54
|
declare const friendliTools: {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
55
|
+
webSearch: typeof webSearch;
|
|
56
|
+
webUrl: typeof webUrl;
|
|
57
|
+
mathCalendar: typeof mathCalendar;
|
|
58
|
+
mathStatistics: typeof mathStatistics;
|
|
59
|
+
mathCalculator: typeof mathCalculator;
|
|
60
|
+
codePythonInterpreter: typeof codePythonInterpreter;
|
|
28
61
|
};
|
|
29
62
|
|
|
30
63
|
type Pricing = {
|
|
@@ -71,52 +104,52 @@ interface FriendliAIProviderSettings {
|
|
|
71
104
|
*/
|
|
72
105
|
fetch?: FetchFunction;
|
|
73
106
|
}
|
|
74
|
-
interface FriendliAIProvider extends
|
|
107
|
+
interface FriendliAIProvider extends ProviderV3 {
|
|
75
108
|
/**
|
|
76
109
|
* Creates a model for text generation.
|
|
77
110
|
*/
|
|
78
|
-
(modelId: FriendliAILanguageModelId):
|
|
111
|
+
(modelId: FriendliAILanguageModelId): LanguageModelV3;
|
|
79
112
|
/**
|
|
80
113
|
* Creates a chat model for text generation.
|
|
81
114
|
*/
|
|
82
|
-
languageModel(modelId: FriendliAILanguageModelId):
|
|
115
|
+
languageModel(modelId: FriendliAILanguageModelId): LanguageModelV3;
|
|
83
116
|
/**
|
|
84
117
|
* Creates a chat model for text generation.
|
|
85
118
|
*/
|
|
86
|
-
chat(modelId: FriendliAILanguageModelId):
|
|
119
|
+
chat(modelId: FriendliAILanguageModelId): LanguageModelV3;
|
|
87
120
|
/**
|
|
88
121
|
* Creates a completion model for text generation.
|
|
89
122
|
*/
|
|
90
|
-
completion(modelId: FriendliAILanguageModelId):
|
|
123
|
+
completion(modelId: FriendliAILanguageModelId): LanguageModelV3;
|
|
91
124
|
/**
|
|
92
|
-
* Creates
|
|
125
|
+
* Creates an embedding model for text generation.
|
|
93
126
|
* TODO: Implement for Dedicated users
|
|
94
127
|
*/
|
|
95
|
-
embedding(modelId: string & {}):
|
|
96
|
-
|
|
128
|
+
embedding(modelId: string & {}): LanguageModelV3;
|
|
129
|
+
embeddingModel(modelId: string & {}): LanguageModelV3;
|
|
97
130
|
/**
|
|
98
131
|
* Returns the available models and their metadata.
|
|
99
132
|
*/
|
|
100
133
|
getAvailableModels(options?: {
|
|
101
134
|
graphqlURL?: string;
|
|
102
135
|
}): Promise<FriendliAvailableModelsResponse>;
|
|
103
|
-
embedding(modelId: string & {}):
|
|
104
|
-
|
|
136
|
+
embedding(modelId: string & {}): EmbeddingModelV3;
|
|
137
|
+
embeddingModel(modelId: string & {}): EmbeddingModelV3;
|
|
105
138
|
/**
|
|
106
139
|
* Creates a model for image generation.
|
|
107
140
|
* TODO: Implement for Dedicated users
|
|
108
141
|
*/
|
|
109
|
-
imageModel(modelId: string & {}):
|
|
142
|
+
imageModel(modelId: string & {}): ImageModelV3;
|
|
110
143
|
/**
|
|
111
144
|
* Creates a model for transcription.
|
|
112
145
|
* TODO: Implement for Dedicated users
|
|
113
146
|
*/
|
|
114
|
-
transcription(modelId: string & {}):
|
|
147
|
+
transcription(modelId: string & {}): TranscriptionModelV3;
|
|
115
148
|
/**
|
|
116
149
|
* Creates a model for speech generation.
|
|
117
150
|
* TODO: Implement for Dedicated users
|
|
118
151
|
*/
|
|
119
|
-
speech(modelId: string & {}):
|
|
152
|
+
speech(modelId: string & {}): SpeechModelV3;
|
|
120
153
|
/**
|
|
121
154
|
* Friendli-specific tools.
|
|
122
155
|
*/
|