@friendliai/ai-provider 0.1.18 → 0.1.20

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 CHANGED
@@ -1,5 +1,24 @@
1
1
  # @friendliai/ai-provider
2
2
 
3
+ ## 0.1.20
4
+
5
+ ### Patch Changes
6
+
7
+ - 7caa63e: ## Updated code to match ai sdk 4.0.10
8
+
9
+ - createFriendliAI -> createFriendli
10
+ - Dependency Update
11
+ - Updated tool call parsing logic
12
+ - Improved object creation logic
13
+ - Added regex output support
14
+ - delete "content_filter", "function_call" finish reason
15
+
16
+ ## 0.1.19
17
+
18
+ ### Patch Changes
19
+
20
+ - 868452c: inference.friendli.ai -> api.friendli.ai
21
+
3
22
  ## 0.1.18
4
23
 
5
24
  ### Patch Changes
package/README.md CHANGED
@@ -20,7 +20,7 @@ To use the provider, you need to set the `FRIENDLI_TOKEN` environment variable w
20
20
  export FRIENDLI_TOKEN="YOUR_FRIENDLI_TOKEN"
21
21
  ```
22
22
 
23
- Check the [FriendliAI documentation](https://docs.friendli.ai/guides/personal_access_tokens) for more information.
23
+ Check the [FriendliAI documentation](https://friendli.ai/docs/guides/personal_access_tokens) for more information.
24
24
 
25
25
  ## Provider Instance
26
26
 
@@ -30,7 +30,7 @@ import { friendli } from "@friendliai/ai-provider";
30
30
 
31
31
  ## Language Models
32
32
 
33
- You can create [FriendliAI models](https://docs.friendli.ai/guides/serverless_endpoints/text_generation#model-supports) using a provider instance.
33
+ You can create [FriendliAI models](https://friendli.ai/docs/guides/serverless_endpoints/text_generation#model-supports) using a provider instance.
34
34
  The first argument is the model id, e.g. `meta-llama-3.1-8b-instruct`.
35
35
 
36
36
  ```ts
@@ -53,7 +53,7 @@ const { text } = await generateText({
53
53
 
54
54
  ### Example: Using built-in tools (Beta)
55
55
 
56
- If you use `@friendliai/ai-provider`, you can use the [built-in tools](https://docs.friendli.ai/guides/serverless_endpoints/tools/built_in_tools) via the `tools` option.
56
+ If you use `@friendliai/ai-provider`, you can use the [built-in tools](https://friendli.ai/docs/guides/serverless_endpoints/tools/built_in_tools) via the `tools` option.
57
57
 
58
58
  Built-in tools allow models to use tools to generate better answers. For example, a `web:search` tool can provide up-to-date answers to current questions.
59
59
 
@@ -90,7 +90,7 @@ FriendliAI language models can also be used in the `streamText`, `generateObject
90
90
  import { createOpenAI } from "@ai-sdk/openai";
91
91
 
92
92
  const friendli = createOpenAI({
93
- baseURL: "https://inference.friendli.ai/v1",
93
+ baseURL: "https://api.friendli.ai/serverless/v1",
94
94
  apiKey: process.env.FRIENDLI_TOKEN,
95
95
  });
96
96
  ```
package/dist/index.d.mts CHANGED
@@ -50,17 +50,9 @@ interface FriendliAIChatSettings {
50
50
  files: Array<string>;
51
51
  }>;
52
52
  /**
53
- Whether to use legacy function calling. Defaults to false.
54
-
55
- Required by some open source inference engines which do not support the `tools` API. May also
56
- provide a workaround for `parallelToolCalls` resulting in the provider buffering tool calls,
57
- which causes `streamObject` to be non-streaming.
58
-
59
- Prefer setting `parallelToolCalls: false` over this option.
60
-
61
- @deprecated this API is supported but deprecated by FriendliAI.
53
+ BETA FEATURE: You can write a regular expression to force output that satisfies that regular expression.
62
54
  */
63
- useLegacyFunctionCalling?: boolean;
55
+ regex?: string;
64
56
  /**
65
57
  A unique identifier representing your end-user, which can help FriendliAI to
66
58
  monitor and detect abuse. Learn more.
@@ -84,10 +76,6 @@ interface FriendliAIProviderSettings {
84
76
  */
85
77
  baseURL?: string;
86
78
  /**
87
- @deprecated Use `baseURL` instead.
88
- */
89
- baseUrl?: string;
90
- /**
91
79
  API key for authenticating requests.
92
80
  */
93
81
  apiKey?: string;
@@ -100,12 +88,6 @@ interface FriendliAIProviderSettings {
100
88
  */
101
89
  headers?: Record<string, string>;
102
90
  /**
103
- FriendliAI compatibility mode. Should be set to `strict` when using the FriendliAI API,
104
- and `compatible` when using 3rd party providers. In `compatible` mode, newer
105
- information such as streamOptions are not being sent. Defaults to 'compatible'.
106
- */
107
- compatibility?: "strict" | "compatible";
108
- /**
109
91
  Custom fetch implementation. You can use it as a middleware to intercept requests,
110
92
  or to provide a custom fetch implementation for e.g. testing.
111
93
  */
@@ -114,11 +96,15 @@ interface FriendliAIProviderSettings {
114
96
  /**
115
97
  Create an FriendliAI provider instance.
116
98
  */
117
- declare function createFriendliAI(options?: FriendliAIProviderSettings): FriendliAIProvider;
99
+ declare function createFriendli(options?: FriendliAIProviderSettings): FriendliAIProvider;
118
100
  declare const friendli: FriendliAIProvider;
119
101
  /**
120
102
  * @deprecated Use `friendli` instead.
121
103
  */
122
104
  declare const friendliai: FriendliAIProvider;
105
+ /**
106
+ * @deprecated Use `createFriendli` instead.
107
+ */
108
+ declare const createFriendliAI: typeof createFriendli;
123
109
 
124
- export { type FriendliAIProvider, type FriendliAIProviderSettings, createFriendliAI, friendli, friendliai };
110
+ export { type FriendliAIProvider, type FriendliAIProviderSettings, createFriendli, createFriendliAI, friendli, friendliai };
package/dist/index.d.ts CHANGED
@@ -50,17 +50,9 @@ interface FriendliAIChatSettings {
50
50
  files: Array<string>;
51
51
  }>;
52
52
  /**
53
- Whether to use legacy function calling. Defaults to false.
54
-
55
- Required by some open source inference engines which do not support the `tools` API. May also
56
- provide a workaround for `parallelToolCalls` resulting in the provider buffering tool calls,
57
- which causes `streamObject` to be non-streaming.
58
-
59
- Prefer setting `parallelToolCalls: false` over this option.
60
-
61
- @deprecated this API is supported but deprecated by FriendliAI.
53
+ BETA FEATURE: You can write a regular expression to force output that satisfies that regular expression.
62
54
  */
63
- useLegacyFunctionCalling?: boolean;
55
+ regex?: string;
64
56
  /**
65
57
  A unique identifier representing your end-user, which can help FriendliAI to
66
58
  monitor and detect abuse. Learn more.
@@ -84,10 +76,6 @@ interface FriendliAIProviderSettings {
84
76
  */
85
77
  baseURL?: string;
86
78
  /**
87
- @deprecated Use `baseURL` instead.
88
- */
89
- baseUrl?: string;
90
- /**
91
79
  API key for authenticating requests.
92
80
  */
93
81
  apiKey?: string;
@@ -100,12 +88,6 @@ interface FriendliAIProviderSettings {
100
88
  */
101
89
  headers?: Record<string, string>;
102
90
  /**
103
- FriendliAI compatibility mode. Should be set to `strict` when using the FriendliAI API,
104
- and `compatible` when using 3rd party providers. In `compatible` mode, newer
105
- information such as streamOptions are not being sent. Defaults to 'compatible'.
106
- */
107
- compatibility?: "strict" | "compatible";
108
- /**
109
91
  Custom fetch implementation. You can use it as a middleware to intercept requests,
110
92
  or to provide a custom fetch implementation for e.g. testing.
111
93
  */
@@ -114,11 +96,15 @@ interface FriendliAIProviderSettings {
114
96
  /**
115
97
  Create an FriendliAI provider instance.
116
98
  */
117
- declare function createFriendliAI(options?: FriendliAIProviderSettings): FriendliAIProvider;
99
+ declare function createFriendli(options?: FriendliAIProviderSettings): FriendliAIProvider;
118
100
  declare const friendli: FriendliAIProvider;
119
101
  /**
120
102
  * @deprecated Use `friendli` instead.
121
103
  */
122
104
  declare const friendliai: FriendliAIProvider;
105
+ /**
106
+ * @deprecated Use `createFriendli` instead.
107
+ */
108
+ declare const createFriendliAI: typeof createFriendli;
123
109
 
124
- export { type FriendliAIProvider, type FriendliAIProviderSettings, createFriendliAI, friendli, friendliai };
110
+ export { type FriendliAIProvider, type FriendliAIProviderSettings, createFriendli, createFriendliAI, friendli, friendliai };