@friendliai/ai-provider 0.3.2 → 1.0.0-beta.0
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 +6 -0
- package/dist/index.d.mts +22 -22
- package/dist/index.d.ts +22 -22
- package/dist/index.js +197 -197
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +89 -89
- package/dist/index.mjs.map +1 -1
- package/package.json +9 -13
package/CHANGELOG.md
CHANGED
package/dist/index.d.mts
CHANGED
|
@@ -1,11 +1,32 @@
|
|
|
1
|
+
import { z } from 'zod/v4';
|
|
1
2
|
import { LanguageModelV2ProviderDefinedTool, ProviderV2, LanguageModelV2, EmbeddingModelV2, ImageModelV2, TranscriptionModelV2, SpeechModelV2 } from '@ai-sdk/provider';
|
|
2
3
|
import { FetchFunction } from '@ai-sdk/provider-utils';
|
|
3
|
-
|
|
4
|
+
|
|
5
|
+
declare const friendliaiErrorSchema: z.ZodObject<{
|
|
6
|
+
message: z.ZodString;
|
|
7
|
+
error: z.ZodRecord<z.ZodString, z.ZodAny>;
|
|
8
|
+
}, z.core.$strip>;
|
|
9
|
+
type FriendliAIErrorData = z.infer<typeof friendliaiErrorSchema>;
|
|
4
10
|
|
|
5
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"];
|
|
6
12
|
type FriendliAIServerlessModelId = (typeof FriendliAIServerlessModelIds)[number];
|
|
7
13
|
type FriendliAILanguageModelId = FriendliAIServerlessModelId | (string & {});
|
|
8
14
|
|
|
15
|
+
declare function webUrlBetaTool(): LanguageModelV2ProviderDefinedTool;
|
|
16
|
+
declare function webSearchBetaTool(): LanguageModelV2ProviderDefinedTool;
|
|
17
|
+
declare function mathCalendarBetaTool(): LanguageModelV2ProviderDefinedTool;
|
|
18
|
+
declare function mathStatisticsBetaTool(): LanguageModelV2ProviderDefinedTool;
|
|
19
|
+
declare function mathCalculatorBetaTool(): LanguageModelV2ProviderDefinedTool;
|
|
20
|
+
declare function codePythonInterpreterBetaTool(): LanguageModelV2ProviderDefinedTool;
|
|
21
|
+
declare const friendliTools: {
|
|
22
|
+
webSearchBetaTool: typeof webSearchBetaTool;
|
|
23
|
+
webUrlBetaTool: typeof webUrlBetaTool;
|
|
24
|
+
mathCalendarBetaTool: typeof mathCalendarBetaTool;
|
|
25
|
+
mathStatisticsBetaTool: typeof mathStatisticsBetaTool;
|
|
26
|
+
mathCalculatorBetaTool: typeof mathCalculatorBetaTool;
|
|
27
|
+
codePythonInterpreterBetaTool: typeof codePythonInterpreterBetaTool;
|
|
28
|
+
};
|
|
29
|
+
|
|
9
30
|
type Pricing = {
|
|
10
31
|
inputToken?: number;
|
|
11
32
|
outputToken?: number;
|
|
@@ -27,21 +48,6 @@ type FriendliAvailableModelsResponse = {
|
|
|
27
48
|
models: FriendliAvailableModel[];
|
|
28
49
|
};
|
|
29
50
|
|
|
30
|
-
declare function webUrlBetaTool(): LanguageModelV2ProviderDefinedTool;
|
|
31
|
-
declare function webSearchBetaTool(): LanguageModelV2ProviderDefinedTool;
|
|
32
|
-
declare function mathCalendarBetaTool(): LanguageModelV2ProviderDefinedTool;
|
|
33
|
-
declare function mathStatisticsBetaTool(): LanguageModelV2ProviderDefinedTool;
|
|
34
|
-
declare function mathCalculatorBetaTool(): LanguageModelV2ProviderDefinedTool;
|
|
35
|
-
declare function codePythonInterpreterBetaTool(): LanguageModelV2ProviderDefinedTool;
|
|
36
|
-
declare const friendliTools: {
|
|
37
|
-
webSearchBetaTool: typeof webSearchBetaTool;
|
|
38
|
-
webUrlBetaTool: typeof webUrlBetaTool;
|
|
39
|
-
mathCalendarBetaTool: typeof mathCalendarBetaTool;
|
|
40
|
-
mathStatisticsBetaTool: typeof mathStatisticsBetaTool;
|
|
41
|
-
mathCalculatorBetaTool: typeof mathCalculatorBetaTool;
|
|
42
|
-
codePythonInterpreterBetaTool: typeof codePythonInterpreterBetaTool;
|
|
43
|
-
};
|
|
44
|
-
|
|
45
51
|
interface FriendliAIProviderSettings {
|
|
46
52
|
/**
|
|
47
53
|
* FriendliAI API key. (FRIENDLI_TOKEN)
|
|
@@ -125,10 +131,4 @@ declare function createFriendli(options?: FriendliAIProviderSettings): FriendliA
|
|
|
125
131
|
*/
|
|
126
132
|
declare const friendli: FriendliAIProvider;
|
|
127
133
|
|
|
128
|
-
declare const friendliaiErrorSchema: z.ZodObject<{
|
|
129
|
-
message: z.ZodString;
|
|
130
|
-
error: z.ZodRecord<z.ZodString, z.ZodAny>;
|
|
131
|
-
}, z.core.$strip>;
|
|
132
|
-
type FriendliAIErrorData = z.infer<typeof friendliaiErrorSchema>;
|
|
133
|
-
|
|
134
134
|
export { type FriendliAIErrorData, type FriendliAIProvider, type FriendliAIProviderSettings, type FriendliAvailableModel, type FriendliAvailableModelsResponse, createFriendli, friendli };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,11 +1,32 @@
|
|
|
1
|
+
import { z } from 'zod/v4';
|
|
1
2
|
import { LanguageModelV2ProviderDefinedTool, ProviderV2, LanguageModelV2, EmbeddingModelV2, ImageModelV2, TranscriptionModelV2, SpeechModelV2 } from '@ai-sdk/provider';
|
|
2
3
|
import { FetchFunction } from '@ai-sdk/provider-utils';
|
|
3
|
-
|
|
4
|
+
|
|
5
|
+
declare const friendliaiErrorSchema: z.ZodObject<{
|
|
6
|
+
message: z.ZodString;
|
|
7
|
+
error: z.ZodRecord<z.ZodString, z.ZodAny>;
|
|
8
|
+
}, z.core.$strip>;
|
|
9
|
+
type FriendliAIErrorData = z.infer<typeof friendliaiErrorSchema>;
|
|
4
10
|
|
|
5
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"];
|
|
6
12
|
type FriendliAIServerlessModelId = (typeof FriendliAIServerlessModelIds)[number];
|
|
7
13
|
type FriendliAILanguageModelId = FriendliAIServerlessModelId | (string & {});
|
|
8
14
|
|
|
15
|
+
declare function webUrlBetaTool(): LanguageModelV2ProviderDefinedTool;
|
|
16
|
+
declare function webSearchBetaTool(): LanguageModelV2ProviderDefinedTool;
|
|
17
|
+
declare function mathCalendarBetaTool(): LanguageModelV2ProviderDefinedTool;
|
|
18
|
+
declare function mathStatisticsBetaTool(): LanguageModelV2ProviderDefinedTool;
|
|
19
|
+
declare function mathCalculatorBetaTool(): LanguageModelV2ProviderDefinedTool;
|
|
20
|
+
declare function codePythonInterpreterBetaTool(): LanguageModelV2ProviderDefinedTool;
|
|
21
|
+
declare const friendliTools: {
|
|
22
|
+
webSearchBetaTool: typeof webSearchBetaTool;
|
|
23
|
+
webUrlBetaTool: typeof webUrlBetaTool;
|
|
24
|
+
mathCalendarBetaTool: typeof mathCalendarBetaTool;
|
|
25
|
+
mathStatisticsBetaTool: typeof mathStatisticsBetaTool;
|
|
26
|
+
mathCalculatorBetaTool: typeof mathCalculatorBetaTool;
|
|
27
|
+
codePythonInterpreterBetaTool: typeof codePythonInterpreterBetaTool;
|
|
28
|
+
};
|
|
29
|
+
|
|
9
30
|
type Pricing = {
|
|
10
31
|
inputToken?: number;
|
|
11
32
|
outputToken?: number;
|
|
@@ -27,21 +48,6 @@ type FriendliAvailableModelsResponse = {
|
|
|
27
48
|
models: FriendliAvailableModel[];
|
|
28
49
|
};
|
|
29
50
|
|
|
30
|
-
declare function webUrlBetaTool(): LanguageModelV2ProviderDefinedTool;
|
|
31
|
-
declare function webSearchBetaTool(): LanguageModelV2ProviderDefinedTool;
|
|
32
|
-
declare function mathCalendarBetaTool(): LanguageModelV2ProviderDefinedTool;
|
|
33
|
-
declare function mathStatisticsBetaTool(): LanguageModelV2ProviderDefinedTool;
|
|
34
|
-
declare function mathCalculatorBetaTool(): LanguageModelV2ProviderDefinedTool;
|
|
35
|
-
declare function codePythonInterpreterBetaTool(): LanguageModelV2ProviderDefinedTool;
|
|
36
|
-
declare const friendliTools: {
|
|
37
|
-
webSearchBetaTool: typeof webSearchBetaTool;
|
|
38
|
-
webUrlBetaTool: typeof webUrlBetaTool;
|
|
39
|
-
mathCalendarBetaTool: typeof mathCalendarBetaTool;
|
|
40
|
-
mathStatisticsBetaTool: typeof mathStatisticsBetaTool;
|
|
41
|
-
mathCalculatorBetaTool: typeof mathCalculatorBetaTool;
|
|
42
|
-
codePythonInterpreterBetaTool: typeof codePythonInterpreterBetaTool;
|
|
43
|
-
};
|
|
44
|
-
|
|
45
51
|
interface FriendliAIProviderSettings {
|
|
46
52
|
/**
|
|
47
53
|
* FriendliAI API key. (FRIENDLI_TOKEN)
|
|
@@ -125,10 +131,4 @@ declare function createFriendli(options?: FriendliAIProviderSettings): FriendliA
|
|
|
125
131
|
*/
|
|
126
132
|
declare const friendli: FriendliAIProvider;
|
|
127
133
|
|
|
128
|
-
declare const friendliaiErrorSchema: z.ZodObject<{
|
|
129
|
-
message: z.ZodString;
|
|
130
|
-
error: z.ZodRecord<z.ZodString, z.ZodAny>;
|
|
131
|
-
}, z.core.$strip>;
|
|
132
|
-
type FriendliAIErrorData = z.infer<typeof friendliaiErrorSchema>;
|
|
133
|
-
|
|
134
134
|
export { type FriendliAIErrorData, type FriendliAIProvider, type FriendliAIProviderSettings, type FriendliAvailableModel, type FriendliAvailableModelsResponse, createFriendli, friendli };
|
package/dist/index.js
CHANGED
|
@@ -26,45 +26,22 @@ __export(index_exports, {
|
|
|
26
26
|
module.exports = __toCommonJS(index_exports);
|
|
27
27
|
|
|
28
28
|
// src/friendli-provider.ts
|
|
29
|
+
var import_openai_compatible = require("@ai-sdk/openai-compatible");
|
|
29
30
|
var import_provider3 = require("@ai-sdk/provider");
|
|
30
31
|
var import_provider_utils4 = require("@ai-sdk/provider-utils");
|
|
31
|
-
var import_openai_compatible = require("@ai-sdk/openai-compatible");
|
|
32
|
-
|
|
33
|
-
// src/friendli-settings.ts
|
|
34
|
-
var FriendliAIServerlessModelIds = [
|
|
35
|
-
"LGAI-EXAONE/EXAONE-4.0.1-32B",
|
|
36
|
-
"skt/A.X-4.0",
|
|
37
|
-
"skt/A.X-3.1",
|
|
38
|
-
"naver-hyperclovax/HyperCLOVAX-SEED-Think-14B",
|
|
39
|
-
"deepseek-ai/DeepSeek-R1-0528",
|
|
40
|
-
"meta-llama/Llama-4-Maverick-17B-128E-Instruct",
|
|
41
|
-
"meta-llama/Llama-4-Scout-17B-16E-Instruct",
|
|
42
|
-
"meta-llama/Llama-3.3-70B-Instruct",
|
|
43
|
-
"meta-llama-3.3-70b-instruct",
|
|
44
|
-
"meta-llama/Llama-3.1-8B-Instruct",
|
|
45
|
-
"meta-llama-3.1-8b-instruct",
|
|
46
|
-
"Qwen/Qwen3-235B-A22B-Thinking-2507",
|
|
47
|
-
"Qwen/Qwen3-235B-A22B-Instruct-2507",
|
|
48
|
-
"Qwen/Qwen3-30B-A3B",
|
|
49
|
-
"Qwen/Qwen3-32B",
|
|
50
|
-
"google/gemma-3-27b-it",
|
|
51
|
-
"mistralai/Mistral-Small-3.1-24B-Instruct-2503",
|
|
52
|
-
"mistralai/Devstral-Small-2505",
|
|
53
|
-
"mistralai/Magistral-Small-2506"
|
|
54
|
-
];
|
|
55
32
|
|
|
56
33
|
// src/friendli-chat-language-model.ts
|
|
34
|
+
var import_internal = require("@ai-sdk/openai-compatible/internal");
|
|
57
35
|
var import_provider2 = require("@ai-sdk/provider");
|
|
58
36
|
var import_provider_utils2 = require("@ai-sdk/provider-utils");
|
|
59
|
-
var
|
|
60
|
-
var import_zod2 = require("zod");
|
|
37
|
+
var import_v42 = require("zod/v4");
|
|
61
38
|
|
|
62
39
|
// src/friendli-error.ts
|
|
63
|
-
var import_zod = require("zod");
|
|
64
40
|
var import_provider_utils = require("@ai-sdk/provider-utils");
|
|
65
|
-
var
|
|
66
|
-
|
|
67
|
-
|
|
41
|
+
var import_v4 = require("zod/v4");
|
|
42
|
+
var friendliaiErrorSchema = import_v4.z.object({
|
|
43
|
+
message: import_v4.z.string(),
|
|
44
|
+
error: import_v4.z.record(import_v4.z.string(), import_v4.z.any())
|
|
68
45
|
});
|
|
69
46
|
var friendliaiErrorStructure = {
|
|
70
47
|
errorSchema: friendliaiErrorSchema,
|
|
@@ -513,168 +490,249 @@ var FriendliAIChatLanguageModel = class {
|
|
|
513
490
|
};
|
|
514
491
|
}
|
|
515
492
|
};
|
|
516
|
-
var friendliAIChatResponseSchema =
|
|
517
|
-
id:
|
|
518
|
-
created:
|
|
519
|
-
model:
|
|
520
|
-
choices:
|
|
521
|
-
|
|
522
|
-
message:
|
|
523
|
-
role:
|
|
524
|
-
content:
|
|
525
|
-
tool_calls:
|
|
526
|
-
|
|
527
|
-
id:
|
|
528
|
-
type:
|
|
529
|
-
function:
|
|
530
|
-
name:
|
|
531
|
-
arguments:
|
|
493
|
+
var friendliAIChatResponseSchema = import_v42.z.object({
|
|
494
|
+
id: import_v42.z.string().nullish(),
|
|
495
|
+
created: import_v42.z.number().nullish(),
|
|
496
|
+
model: import_v42.z.string().nullish(),
|
|
497
|
+
choices: import_v42.z.array(
|
|
498
|
+
import_v42.z.object({
|
|
499
|
+
message: import_v42.z.object({
|
|
500
|
+
role: import_v42.z.literal("assistant").nullish(),
|
|
501
|
+
content: import_v42.z.string().nullish(),
|
|
502
|
+
tool_calls: import_v42.z.array(
|
|
503
|
+
import_v42.z.object({
|
|
504
|
+
id: import_v42.z.string().nullish(),
|
|
505
|
+
type: import_v42.z.literal("function"),
|
|
506
|
+
function: import_v42.z.object({
|
|
507
|
+
name: import_v42.z.string(),
|
|
508
|
+
arguments: import_v42.z.union([import_v42.z.string(), import_v42.z.any()]).nullish()
|
|
532
509
|
})
|
|
533
510
|
})
|
|
534
511
|
).nullish()
|
|
535
512
|
}),
|
|
536
|
-
finish_reason:
|
|
513
|
+
finish_reason: import_v42.z.string().nullish()
|
|
537
514
|
})
|
|
538
515
|
),
|
|
539
|
-
usage:
|
|
540
|
-
prompt_tokens:
|
|
541
|
-
completion_tokens:
|
|
516
|
+
usage: import_v42.z.object({
|
|
517
|
+
prompt_tokens: import_v42.z.number().nullish(),
|
|
518
|
+
completion_tokens: import_v42.z.number().nullish()
|
|
542
519
|
}).nullish()
|
|
543
520
|
});
|
|
544
|
-
var friendliaiChatChunkSchema =
|
|
545
|
-
|
|
546
|
-
id:
|
|
547
|
-
created:
|
|
548
|
-
model:
|
|
549
|
-
choices:
|
|
550
|
-
|
|
551
|
-
delta:
|
|
552
|
-
role:
|
|
553
|
-
content:
|
|
554
|
-
tool_calls:
|
|
555
|
-
|
|
556
|
-
index:
|
|
557
|
-
id:
|
|
558
|
-
type:
|
|
559
|
-
function:
|
|
560
|
-
name:
|
|
561
|
-
arguments:
|
|
521
|
+
var friendliaiChatChunkSchema = import_v42.z.union([
|
|
522
|
+
import_v42.z.object({
|
|
523
|
+
id: import_v42.z.string().nullish(),
|
|
524
|
+
created: import_v42.z.number().nullish(),
|
|
525
|
+
model: import_v42.z.string().nullish(),
|
|
526
|
+
choices: import_v42.z.array(
|
|
527
|
+
import_v42.z.object({
|
|
528
|
+
delta: import_v42.z.object({
|
|
529
|
+
role: import_v42.z.enum(["assistant"]).nullish(),
|
|
530
|
+
content: import_v42.z.string().nullish(),
|
|
531
|
+
tool_calls: import_v42.z.array(
|
|
532
|
+
import_v42.z.object({
|
|
533
|
+
index: import_v42.z.number(),
|
|
534
|
+
id: import_v42.z.string().nullish(),
|
|
535
|
+
type: import_v42.z.literal("function").optional(),
|
|
536
|
+
function: import_v42.z.object({
|
|
537
|
+
name: import_v42.z.string().nullish(),
|
|
538
|
+
arguments: import_v42.z.string().nullish()
|
|
562
539
|
})
|
|
563
540
|
})
|
|
564
541
|
).nullish()
|
|
565
542
|
}).nullish(),
|
|
566
|
-
finish_reason:
|
|
543
|
+
finish_reason: import_v42.z.string().nullish()
|
|
567
544
|
})
|
|
568
545
|
),
|
|
569
|
-
usage:
|
|
570
|
-
prompt_tokens:
|
|
571
|
-
completion_tokens:
|
|
546
|
+
usage: import_v42.z.object({
|
|
547
|
+
prompt_tokens: import_v42.z.number().nullish(),
|
|
548
|
+
completion_tokens: import_v42.z.number().nullish()
|
|
572
549
|
}).nullish()
|
|
573
550
|
}),
|
|
574
|
-
|
|
575
|
-
name:
|
|
576
|
-
status:
|
|
577
|
-
message:
|
|
578
|
-
parameters:
|
|
579
|
-
|
|
580
|
-
name:
|
|
581
|
-
value:
|
|
551
|
+
import_v42.z.object({
|
|
552
|
+
name: import_v42.z.string(),
|
|
553
|
+
status: import_v42.z.enum(["ENDED", "STARTED", "ERRORED", "UPDATING"]),
|
|
554
|
+
message: import_v42.z.null(),
|
|
555
|
+
parameters: import_v42.z.array(
|
|
556
|
+
import_v42.z.object({
|
|
557
|
+
name: import_v42.z.string(),
|
|
558
|
+
value: import_v42.z.string()
|
|
582
559
|
})
|
|
583
560
|
),
|
|
584
|
-
result:
|
|
585
|
-
error:
|
|
586
|
-
type:
|
|
587
|
-
msg:
|
|
561
|
+
result: import_v42.z.string().nullable(),
|
|
562
|
+
error: import_v42.z.object({
|
|
563
|
+
type: import_v42.z.enum(["INVALID_PARAMETER", "UNKNOWN"]),
|
|
564
|
+
msg: import_v42.z.string()
|
|
588
565
|
}).nullable(),
|
|
589
|
-
timestamp:
|
|
590
|
-
usage:
|
|
591
|
-
tool_call_id:
|
|
566
|
+
timestamp: import_v42.z.number(),
|
|
567
|
+
usage: import_v42.z.null(),
|
|
568
|
+
tool_call_id: import_v42.z.string().nullable()
|
|
592
569
|
// temporary fix for "file:text" tool calls
|
|
593
570
|
}),
|
|
594
571
|
friendliaiErrorSchema
|
|
595
572
|
]);
|
|
596
|
-
var openaiCompatibleTokenUsageSchema =
|
|
597
|
-
prompt_tokens:
|
|
598
|
-
completion_tokens:
|
|
599
|
-
total_tokens:
|
|
600
|
-
prompt_tokens_details:
|
|
601
|
-
cached_tokens:
|
|
573
|
+
var openaiCompatibleTokenUsageSchema = import_v42.z.object({
|
|
574
|
+
prompt_tokens: import_v42.z.number().nullish(),
|
|
575
|
+
completion_tokens: import_v42.z.number().nullish(),
|
|
576
|
+
total_tokens: import_v42.z.number().nullish(),
|
|
577
|
+
prompt_tokens_details: import_v42.z.object({
|
|
578
|
+
cached_tokens: import_v42.z.number().nullish()
|
|
602
579
|
}).nullish(),
|
|
603
|
-
completion_tokens_details:
|
|
604
|
-
reasoning_tokens:
|
|
605
|
-
accepted_prediction_tokens:
|
|
606
|
-
rejected_prediction_tokens:
|
|
580
|
+
completion_tokens_details: import_v42.z.object({
|
|
581
|
+
reasoning_tokens: import_v42.z.number().nullish(),
|
|
582
|
+
accepted_prediction_tokens: import_v42.z.number().nullish(),
|
|
583
|
+
rejected_prediction_tokens: import_v42.z.number().nullish()
|
|
607
584
|
}).nullish()
|
|
608
585
|
}).nullish();
|
|
609
|
-
var OpenAICompatibleChatResponseSchema =
|
|
610
|
-
id:
|
|
611
|
-
created:
|
|
612
|
-
model:
|
|
613
|
-
choices:
|
|
614
|
-
|
|
615
|
-
message:
|
|
616
|
-
role:
|
|
617
|
-
content:
|
|
618
|
-
reasoning_content:
|
|
619
|
-
tool_calls:
|
|
620
|
-
|
|
621
|
-
id:
|
|
622
|
-
type:
|
|
623
|
-
function:
|
|
624
|
-
name:
|
|
625
|
-
arguments:
|
|
586
|
+
var OpenAICompatibleChatResponseSchema = import_v42.z.object({
|
|
587
|
+
id: import_v42.z.string().nullish(),
|
|
588
|
+
created: import_v42.z.number().nullish(),
|
|
589
|
+
model: import_v42.z.string().nullish(),
|
|
590
|
+
choices: import_v42.z.array(
|
|
591
|
+
import_v42.z.object({
|
|
592
|
+
message: import_v42.z.object({
|
|
593
|
+
role: import_v42.z.literal("assistant").nullish(),
|
|
594
|
+
content: import_v42.z.string().nullish(),
|
|
595
|
+
reasoning_content: import_v42.z.string().nullish(),
|
|
596
|
+
tool_calls: import_v42.z.array(
|
|
597
|
+
import_v42.z.object({
|
|
598
|
+
id: import_v42.z.string().nullish(),
|
|
599
|
+
type: import_v42.z.literal("function"),
|
|
600
|
+
function: import_v42.z.object({
|
|
601
|
+
name: import_v42.z.string(),
|
|
602
|
+
arguments: import_v42.z.string()
|
|
626
603
|
})
|
|
627
604
|
})
|
|
628
605
|
).nullish()
|
|
629
606
|
}),
|
|
630
|
-
finish_reason:
|
|
607
|
+
finish_reason: import_v42.z.string().nullish()
|
|
631
608
|
})
|
|
632
609
|
),
|
|
633
610
|
usage: openaiCompatibleTokenUsageSchema
|
|
634
611
|
});
|
|
635
|
-
var createOpenAICompatibleChatChunkSchema = (errorSchema) =>
|
|
636
|
-
|
|
637
|
-
id:
|
|
638
|
-
created:
|
|
639
|
-
model:
|
|
640
|
-
choices:
|
|
641
|
-
|
|
642
|
-
delta:
|
|
643
|
-
role:
|
|
644
|
-
content:
|
|
645
|
-
reasoning_content:
|
|
646
|
-
tool_calls:
|
|
647
|
-
|
|
648
|
-
index:
|
|
649
|
-
id:
|
|
650
|
-
type:
|
|
651
|
-
function:
|
|
652
|
-
name:
|
|
653
|
-
arguments:
|
|
612
|
+
var createOpenAICompatibleChatChunkSchema = (errorSchema) => import_v42.z.union([
|
|
613
|
+
import_v42.z.object({
|
|
614
|
+
id: import_v42.z.string().nullish(),
|
|
615
|
+
created: import_v42.z.number().nullish(),
|
|
616
|
+
model: import_v42.z.string().nullish(),
|
|
617
|
+
choices: import_v42.z.array(
|
|
618
|
+
import_v42.z.object({
|
|
619
|
+
delta: import_v42.z.object({
|
|
620
|
+
role: import_v42.z.enum(["assistant"]).nullish(),
|
|
621
|
+
content: import_v42.z.string().nullish(),
|
|
622
|
+
reasoning_content: import_v42.z.string().nullish(),
|
|
623
|
+
tool_calls: import_v42.z.array(
|
|
624
|
+
import_v42.z.object({
|
|
625
|
+
index: import_v42.z.number(),
|
|
626
|
+
id: import_v42.z.string().nullish(),
|
|
627
|
+
type: import_v42.z.literal("function").nullish(),
|
|
628
|
+
function: import_v42.z.object({
|
|
629
|
+
name: import_v42.z.string().nullish(),
|
|
630
|
+
arguments: import_v42.z.string().nullish()
|
|
654
631
|
})
|
|
655
632
|
})
|
|
656
633
|
).nullish()
|
|
657
634
|
}).nullish(),
|
|
658
|
-
finish_reason:
|
|
635
|
+
finish_reason: import_v42.z.string().nullish()
|
|
659
636
|
})
|
|
660
637
|
),
|
|
661
638
|
usage: openaiCompatibleTokenUsageSchema
|
|
662
639
|
}),
|
|
663
640
|
errorSchema
|
|
664
641
|
]);
|
|
665
|
-
var friendliProviderOptionsSchema =
|
|
642
|
+
var friendliProviderOptionsSchema = import_v42.z.object({
|
|
666
643
|
/**
|
|
667
644
|
* Whether to enable parallel function calling during tool use. Default to true.
|
|
668
645
|
*/
|
|
669
|
-
parallelToolCalls:
|
|
646
|
+
parallelToolCalls: import_v42.z.boolean().nullish(),
|
|
670
647
|
/**
|
|
671
648
|
* BETA FEATURE: You can write a regular expression to force output that satisfies that regular expression.
|
|
672
649
|
*/
|
|
673
650
|
// regex: z.instanceof(RegExp).nullish(),
|
|
674
|
-
regex:
|
|
675
|
-
chat_template_kwargs:
|
|
651
|
+
regex: import_v42.z.string().nullish(),
|
|
652
|
+
chat_template_kwargs: import_v42.z.record(import_v42.z.string(), import_v42.z.any()).nullish()
|
|
676
653
|
});
|
|
677
654
|
|
|
655
|
+
// src/friendli-settings.ts
|
|
656
|
+
var FriendliAIServerlessModelIds = [
|
|
657
|
+
"LGAI-EXAONE/EXAONE-4.0.1-32B",
|
|
658
|
+
"skt/A.X-4.0",
|
|
659
|
+
"skt/A.X-3.1",
|
|
660
|
+
"naver-hyperclovax/HyperCLOVAX-SEED-Think-14B",
|
|
661
|
+
"deepseek-ai/DeepSeek-R1-0528",
|
|
662
|
+
"meta-llama/Llama-4-Maverick-17B-128E-Instruct",
|
|
663
|
+
"meta-llama/Llama-4-Scout-17B-16E-Instruct",
|
|
664
|
+
"meta-llama/Llama-3.3-70B-Instruct",
|
|
665
|
+
"meta-llama-3.3-70b-instruct",
|
|
666
|
+
"meta-llama/Llama-3.1-8B-Instruct",
|
|
667
|
+
"meta-llama-3.1-8b-instruct",
|
|
668
|
+
"Qwen/Qwen3-235B-A22B-Thinking-2507",
|
|
669
|
+
"Qwen/Qwen3-235B-A22B-Instruct-2507",
|
|
670
|
+
"Qwen/Qwen3-30B-A3B",
|
|
671
|
+
"Qwen/Qwen3-32B",
|
|
672
|
+
"google/gemma-3-27b-it",
|
|
673
|
+
"mistralai/Mistral-Small-3.1-24B-Instruct-2503",
|
|
674
|
+
"mistralai/Devstral-Small-2505",
|
|
675
|
+
"mistralai/Magistral-Small-2506"
|
|
676
|
+
];
|
|
677
|
+
|
|
678
|
+
// src/friendli-tools.ts
|
|
679
|
+
function webUrlBetaTool() {
|
|
680
|
+
return {
|
|
681
|
+
type: "provider-defined",
|
|
682
|
+
id: "friendli.web:url",
|
|
683
|
+
name: "web:url",
|
|
684
|
+
args: {}
|
|
685
|
+
};
|
|
686
|
+
}
|
|
687
|
+
function webSearchBetaTool() {
|
|
688
|
+
return {
|
|
689
|
+
type: "provider-defined",
|
|
690
|
+
id: "friendli.web:search",
|
|
691
|
+
name: "web:search",
|
|
692
|
+
args: {}
|
|
693
|
+
};
|
|
694
|
+
}
|
|
695
|
+
function mathCalendarBetaTool() {
|
|
696
|
+
return {
|
|
697
|
+
type: "provider-defined",
|
|
698
|
+
id: "friendli.math:calendar",
|
|
699
|
+
name: "math:calendar",
|
|
700
|
+
args: {}
|
|
701
|
+
};
|
|
702
|
+
}
|
|
703
|
+
function mathStatisticsBetaTool() {
|
|
704
|
+
return {
|
|
705
|
+
type: "provider-defined",
|
|
706
|
+
id: "friendli.math:statistics",
|
|
707
|
+
name: "math:statistics",
|
|
708
|
+
args: {}
|
|
709
|
+
};
|
|
710
|
+
}
|
|
711
|
+
function mathCalculatorBetaTool() {
|
|
712
|
+
return {
|
|
713
|
+
type: "provider-defined",
|
|
714
|
+
id: "friendli.math:calculator",
|
|
715
|
+
name: "math:calculator",
|
|
716
|
+
args: {}
|
|
717
|
+
};
|
|
718
|
+
}
|
|
719
|
+
function codePythonInterpreterBetaTool() {
|
|
720
|
+
return {
|
|
721
|
+
type: "provider-defined",
|
|
722
|
+
id: "friendli.code:python-interpreter",
|
|
723
|
+
name: "code:python-interpreter",
|
|
724
|
+
args: {}
|
|
725
|
+
};
|
|
726
|
+
}
|
|
727
|
+
var friendliTools = {
|
|
728
|
+
webSearchBetaTool,
|
|
729
|
+
webUrlBetaTool,
|
|
730
|
+
mathCalendarBetaTool,
|
|
731
|
+
mathStatisticsBetaTool,
|
|
732
|
+
mathCalculatorBetaTool,
|
|
733
|
+
codePythonInterpreterBetaTool
|
|
734
|
+
};
|
|
735
|
+
|
|
678
736
|
// src/get-available-models.ts
|
|
679
737
|
var import_provider_utils3 = require("@ai-sdk/provider-utils");
|
|
680
738
|
var DEFAULT_GRAPHQL_URL = "https://api-internal.friendli.ai/api/graphql";
|
|
@@ -782,64 +840,6 @@ async function getAvailableModelsImpl(options) {
|
|
|
782
840
|
return { models };
|
|
783
841
|
}
|
|
784
842
|
|
|
785
|
-
// src/friendli-tools.ts
|
|
786
|
-
function webUrlBetaTool() {
|
|
787
|
-
return {
|
|
788
|
-
type: "provider-defined",
|
|
789
|
-
id: "friendli.web:url",
|
|
790
|
-
name: "web:url",
|
|
791
|
-
args: {}
|
|
792
|
-
};
|
|
793
|
-
}
|
|
794
|
-
function webSearchBetaTool() {
|
|
795
|
-
return {
|
|
796
|
-
type: "provider-defined",
|
|
797
|
-
id: "friendli.web:search",
|
|
798
|
-
name: "web:search",
|
|
799
|
-
args: {}
|
|
800
|
-
};
|
|
801
|
-
}
|
|
802
|
-
function mathCalendarBetaTool() {
|
|
803
|
-
return {
|
|
804
|
-
type: "provider-defined",
|
|
805
|
-
id: "friendli.math:calendar",
|
|
806
|
-
name: "math:calendar",
|
|
807
|
-
args: {}
|
|
808
|
-
};
|
|
809
|
-
}
|
|
810
|
-
function mathStatisticsBetaTool() {
|
|
811
|
-
return {
|
|
812
|
-
type: "provider-defined",
|
|
813
|
-
id: "friendli.math:statistics",
|
|
814
|
-
name: "math:statistics",
|
|
815
|
-
args: {}
|
|
816
|
-
};
|
|
817
|
-
}
|
|
818
|
-
function mathCalculatorBetaTool() {
|
|
819
|
-
return {
|
|
820
|
-
type: "provider-defined",
|
|
821
|
-
id: "friendli.math:calculator",
|
|
822
|
-
name: "math:calculator",
|
|
823
|
-
args: {}
|
|
824
|
-
};
|
|
825
|
-
}
|
|
826
|
-
function codePythonInterpreterBetaTool() {
|
|
827
|
-
return {
|
|
828
|
-
type: "provider-defined",
|
|
829
|
-
id: "friendli.code:python-interpreter",
|
|
830
|
-
name: "code:python-interpreter",
|
|
831
|
-
args: {}
|
|
832
|
-
};
|
|
833
|
-
}
|
|
834
|
-
var friendliTools = {
|
|
835
|
-
webSearchBetaTool,
|
|
836
|
-
webUrlBetaTool,
|
|
837
|
-
mathCalendarBetaTool,
|
|
838
|
-
mathStatisticsBetaTool,
|
|
839
|
-
mathCalculatorBetaTool,
|
|
840
|
-
codePythonInterpreterBetaTool
|
|
841
|
-
};
|
|
842
|
-
|
|
843
843
|
// src/friendli-provider.ts
|
|
844
844
|
function createFriendli(options = {}) {
|
|
845
845
|
const getHeaders = () => ({
|