@friendliai/ai-provider 1.0.0-beta.1 → 1.0.0-beta.2
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 +10 -0
- package/README.md +20 -0
- package/dist/index.d.mts +17 -12
- package/dist/index.d.ts +17 -12
- package/dist/index.js +231 -159
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +222 -151
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
# @friendliai/ai-provider
|
|
2
2
|
|
|
3
|
+
## 1.0.0-beta.2
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 049179d: Add Linkup integrated tool helper (`friendli.tools.linkupSearch`) for Tool Assisted API.
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- 049179d: Support Friendli serverless chat options (`topK` -> `top_k`, sampling providerOptions) and improve error propagation for HTTP and streaming tool-assisted responses.
|
|
12
|
+
|
|
3
13
|
## 1.0.0-beta.1
|
|
4
14
|
|
|
5
15
|
### Minor Changes
|
package/README.md
CHANGED
|
@@ -27,8 +27,28 @@ const { text } = await generateText({
|
|
|
27
27
|
model: friendli('meta-llama-3.3-70b-instruct'),
|
|
28
28
|
prompt: 'What is the meaning of life?',
|
|
29
29
|
maxTokens: 20,
|
|
30
|
+
topK: 10,
|
|
31
|
+
providerOptions: {
|
|
32
|
+
friendliai: {
|
|
33
|
+
minP: 0.2,
|
|
34
|
+
},
|
|
35
|
+
},
|
|
30
36
|
});
|
|
31
37
|
console.log(text);
|
|
32
38
|
```
|
|
33
39
|
|
|
40
|
+
### Provider Options
|
|
41
|
+
|
|
42
|
+
You can pass Friendli-specific parameters using `providerOptions.friendliai`. For backward compatibility, the `friendli` key is also supported.
|
|
43
|
+
|
|
44
|
+
Supported options (camelCase):
|
|
45
|
+
|
|
46
|
+
- `minP`
|
|
47
|
+
- `repetitionPenalty`
|
|
48
|
+
- `xtcThreshold`
|
|
49
|
+
- `xtcProbability`
|
|
50
|
+
- `parallelToolCalls`
|
|
51
|
+
- `regex` (BETA: Force output to satisfy a regular expression)
|
|
52
|
+
- `chat_template_kwargs`
|
|
53
|
+
|
|
34
54
|
For more details, see the [official documentation](https://friendli.ai/docs/).
|
package/dist/index.d.mts
CHANGED
|
@@ -2,25 +2,20 @@ import { z } from 'zod/v4';
|
|
|
2
2
|
import { ProviderV3, LanguageModelV3, EmbeddingModelV3, ImageModelV3, TranscriptionModelV3, SpeechModelV3 } from '@ai-sdk/provider';
|
|
3
3
|
import { Tool, FetchFunction } from '@ai-sdk/provider-utils';
|
|
4
4
|
|
|
5
|
-
declare const friendliaiErrorSchema: z.ZodObject<{
|
|
5
|
+
declare const friendliaiErrorSchema: z.ZodUnion<readonly [z.ZodObject<{
|
|
6
|
+
error: z.ZodObject<{
|
|
7
|
+
message: z.ZodString;
|
|
8
|
+
}, z.core.$loose>;
|
|
9
|
+
}, z.core.$loose>, z.ZodObject<{
|
|
6
10
|
message: z.ZodString;
|
|
7
|
-
error: z.ZodRecord<z.ZodString, z.ZodAny
|
|
8
|
-
}, z.core.$strip>;
|
|
11
|
+
error: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
12
|
+
}, z.core.$strip>]>;
|
|
9
13
|
type FriendliAIErrorData = z.infer<typeof friendliaiErrorSchema>;
|
|
10
14
|
|
|
11
15
|
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
16
|
type FriendliAIServerlessModelId = (typeof FriendliAIServerlessModelIds)[number];
|
|
13
17
|
type FriendliAILanguageModelId = FriendliAIServerlessModelId | (string & {});
|
|
14
18
|
|
|
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
19
|
/**
|
|
25
20
|
* Web search tool - searches the web for information.
|
|
26
21
|
* @beta
|
|
@@ -51,6 +46,11 @@ declare function mathCalculator(): Tool;
|
|
|
51
46
|
* @beta
|
|
52
47
|
*/
|
|
53
48
|
declare function codePythonInterpreter(): Tool;
|
|
49
|
+
/**
|
|
50
|
+
* Linkup search tool - searches the web for real-time information with citations.
|
|
51
|
+
* @see https://www.linkup.so
|
|
52
|
+
*/
|
|
53
|
+
declare function linkupSearch(): Tool;
|
|
54
54
|
declare const friendliTools: {
|
|
55
55
|
webSearch: typeof webSearch;
|
|
56
56
|
webUrl: typeof webUrl;
|
|
@@ -58,6 +58,7 @@ declare const friendliTools: {
|
|
|
58
58
|
mathStatistics: typeof mathStatistics;
|
|
59
59
|
mathCalculator: typeof mathCalculator;
|
|
60
60
|
codePythonInterpreter: typeof codePythonInterpreter;
|
|
61
|
+
linkupSearch: typeof linkupSearch;
|
|
61
62
|
};
|
|
62
63
|
|
|
63
64
|
type Pricing = {
|
|
@@ -103,6 +104,10 @@ interface FriendliAIProviderSettings {
|
|
|
103
104
|
* or to provide a custom fetch implementation for e.g. testing.
|
|
104
105
|
*/
|
|
105
106
|
fetch?: FetchFunction;
|
|
107
|
+
/**
|
|
108
|
+
* Whether to include usage information in the response.
|
|
109
|
+
*/
|
|
110
|
+
includeUsage?: boolean;
|
|
106
111
|
}
|
|
107
112
|
interface FriendliAIProvider extends ProviderV3 {
|
|
108
113
|
/**
|
package/dist/index.d.ts
CHANGED
|
@@ -2,25 +2,20 @@ import { z } from 'zod/v4';
|
|
|
2
2
|
import { ProviderV3, LanguageModelV3, EmbeddingModelV3, ImageModelV3, TranscriptionModelV3, SpeechModelV3 } from '@ai-sdk/provider';
|
|
3
3
|
import { Tool, FetchFunction } from '@ai-sdk/provider-utils';
|
|
4
4
|
|
|
5
|
-
declare const friendliaiErrorSchema: z.ZodObject<{
|
|
5
|
+
declare const friendliaiErrorSchema: z.ZodUnion<readonly [z.ZodObject<{
|
|
6
|
+
error: z.ZodObject<{
|
|
7
|
+
message: z.ZodString;
|
|
8
|
+
}, z.core.$loose>;
|
|
9
|
+
}, z.core.$loose>, z.ZodObject<{
|
|
6
10
|
message: z.ZodString;
|
|
7
|
-
error: z.ZodRecord<z.ZodString, z.ZodAny
|
|
8
|
-
}, z.core.$strip>;
|
|
11
|
+
error: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
12
|
+
}, z.core.$strip>]>;
|
|
9
13
|
type FriendliAIErrorData = z.infer<typeof friendliaiErrorSchema>;
|
|
10
14
|
|
|
11
15
|
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
16
|
type FriendliAIServerlessModelId = (typeof FriendliAIServerlessModelIds)[number];
|
|
13
17
|
type FriendliAILanguageModelId = FriendliAIServerlessModelId | (string & {});
|
|
14
18
|
|
|
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
19
|
/**
|
|
25
20
|
* Web search tool - searches the web for information.
|
|
26
21
|
* @beta
|
|
@@ -51,6 +46,11 @@ declare function mathCalculator(): Tool;
|
|
|
51
46
|
* @beta
|
|
52
47
|
*/
|
|
53
48
|
declare function codePythonInterpreter(): Tool;
|
|
49
|
+
/**
|
|
50
|
+
* Linkup search tool - searches the web for real-time information with citations.
|
|
51
|
+
* @see https://www.linkup.so
|
|
52
|
+
*/
|
|
53
|
+
declare function linkupSearch(): Tool;
|
|
54
54
|
declare const friendliTools: {
|
|
55
55
|
webSearch: typeof webSearch;
|
|
56
56
|
webUrl: typeof webUrl;
|
|
@@ -58,6 +58,7 @@ declare const friendliTools: {
|
|
|
58
58
|
mathStatistics: typeof mathStatistics;
|
|
59
59
|
mathCalculator: typeof mathCalculator;
|
|
60
60
|
codePythonInterpreter: typeof codePythonInterpreter;
|
|
61
|
+
linkupSearch: typeof linkupSearch;
|
|
61
62
|
};
|
|
62
63
|
|
|
63
64
|
type Pricing = {
|
|
@@ -103,6 +104,10 @@ interface FriendliAIProviderSettings {
|
|
|
103
104
|
* or to provide a custom fetch implementation for e.g. testing.
|
|
104
105
|
*/
|
|
105
106
|
fetch?: FetchFunction;
|
|
107
|
+
/**
|
|
108
|
+
* Whether to include usage information in the response.
|
|
109
|
+
*/
|
|
110
|
+
includeUsage?: boolean;
|
|
106
111
|
}
|
|
107
112
|
interface FriendliAIProvider extends ProviderV3 {
|
|
108
113
|
/**
|