@ai-sdk/huggingface 2.0.85 → 2.0.87

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,26 @@
1
1
  # @ai-sdk/huggingface
2
2
 
3
+ ## 2.0.87
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [6400cf8]
8
+ - Updated dependencies [f608c05]
9
+ - Updated dependencies [cab9c1f]
10
+ - Updated dependencies [c70adf6]
11
+ - @ai-sdk/provider-utils@5.0.76
12
+ - @ai-sdk/openai-compatible@3.0.87
13
+ - @ai-sdk/provider@4.0.37
14
+
15
+ ## 2.0.86
16
+
17
+ ### Patch Changes
18
+
19
+ - c296443: Refactor Hugging Face model ID logic into a model catalog that declares capabilities and provider options, and generate provider capability documentation from it. Request behavior is unchanged.
20
+ - Updated dependencies [b63c06a]
21
+ - Updated dependencies [646a7e3]
22
+ - @ai-sdk/openai-compatible@3.0.86
23
+
3
24
  ## 2.0.85
4
25
 
5
26
  ### Patch Changes
package/dist/index.js CHANGED
@@ -831,7 +831,7 @@ function createHuggingFace(options = {}) {
831
831
  const huggingFace = createHuggingFace();
832
832
  //#endregion
833
833
  //#region src/version.ts
834
- const VERSION = "2.0.85";
834
+ const VERSION = "2.0.87";
835
835
  //#endregion
836
836
  export { VERSION, createHuggingFace, huggingFace, huggingFace as huggingface };
837
837
 
@@ -253,6 +253,8 @@ You can also pass image URLs:
253
253
 
254
254
  ## Model Capabilities
255
255
 
256
+ {/* model-capabilities:huggingface-language:start */}
257
+
256
258
  | Model | Image Input | Object Generation | Tool Usage | Tool Streaming |
257
259
  | ----------------------------------------------- | ----------- | ----------------- | ---------- | -------------- |
258
260
  | `meta-llama/Llama-3.1-8B-Instruct` | <Cross /> | <Check /> | <Check /> | <Check /> |
@@ -269,6 +271,8 @@ You can also pass image URLs:
269
271
  | `google/gemma-3-27b-it` | <Cross /> | <Check /> | <Check /> | <Check /> |
270
272
  | `moonshotai/Kimi-K2-Instruct` | <Cross /> | <Check /> | <Check /> | <Check /> |
271
273
 
274
+ {/* model-capabilities:huggingface-language:end */}
275
+
272
276
  <Note>
273
277
  The table above lists popular models. You can explore all available models on
274
278
  the [Hugging Face Inference Models](https://huggingface.co/inference/models)
@@ -276,3 +280,18 @@ You can also pass image URLs:
276
280
  model documentation on Hugging Face Hub for detailed information about each
277
281
  model's features.
278
282
  </Note>
283
+
284
+ ## Provider Option Reference
285
+
286
+ The following option definitions are generated from the provider catalog.
287
+
288
+ {/* model-capabilities:huggingface-provider-options:start */}
289
+
290
+ | Operation | Option | Description |
291
+ | --------- | ------------------ | ---------------- |
292
+ | language | `metadata` | metadata |
293
+ | language | `instructions` | instructions |
294
+ | language | `strictJsonSchema` | strictJsonSchema |
295
+ | language | `reasoningEffort` | reasoningEffort |
296
+
297
+ {/* model-capabilities:huggingface-provider-options:end */}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ai-sdk/huggingface",
3
- "version": "2.0.85",
3
+ "version": "2.0.87",
4
4
  "type": "module",
5
5
  "license": "Apache-2.0",
6
6
  "sideEffects": false,
@@ -29,9 +29,9 @@
29
29
  }
30
30
  },
31
31
  "dependencies": {
32
- "@ai-sdk/openai-compatible": "3.0.85",
33
- "@ai-sdk/provider": "4.0.36",
34
- "@ai-sdk/provider-utils": "5.0.75"
32
+ "@ai-sdk/openai-compatible": "3.0.87",
33
+ "@ai-sdk/provider": "4.0.37",
34
+ "@ai-sdk/provider-utils": "5.0.76"
35
35
  },
36
36
  "devDependencies": {
37
37
  "@ai-sdk/test-server": "2.0.4",
@@ -0,0 +1,180 @@
1
+ import type {
2
+ ModelCapabilities,
3
+ ModelEntry,
4
+ ProviderOptionDefinition,
5
+ ProviderOptionDefinitions,
6
+ } from '@ai-sdk/provider';
7
+ import type { HuggingFaceLanguageModelResponsesOptions } from './responses/huggingface-responses-language-model-options';
8
+ /** Known options accepted under providerOptions; open-ended extension keys remain undeclared. */
9
+ export const huggingFaceProviderOptions = {
10
+ language: {
11
+ metadata: { description: 'metadata' },
12
+ instructions: { description: 'instructions' },
13
+ strictJsonSchema: { description: 'strictJsonSchema' },
14
+ reasoningEffort: { description: 'reasoningEffort' },
15
+ } satisfies Record<
16
+ keyof HuggingFaceLanguageModelResponsesOptions,
17
+ ProviderOptionDefinition
18
+ >,
19
+ } as const satisfies ProviderOptionDefinitions;
20
+
21
+ const languageModelIds = [
22
+ 'meta-llama/Llama-3.1-8B-Instruct',
23
+ 'meta-llama/Llama-3.1-70B-Instruct',
24
+ 'meta-llama/Llama-3.1-405B-Instruct',
25
+ 'meta-llama/Llama-3.3-70B-Instruct',
26
+ 'meta-llama/Meta-Llama-3-8B-Instruct',
27
+ 'meta-llama/Meta-Llama-3-70B-Instruct',
28
+ 'meta-llama/Llama-3.2-3B-Instruct',
29
+ 'meta-llama/Llama-4-Maverick-17B-128E-Instruct',
30
+ 'meta-llama/Llama-4-Maverick-17B-128E-Instruct-FP8',
31
+ 'meta-llama/Llama-Guard-4-12B',
32
+ 'deepseek-ai/DeepSeek-V3.1',
33
+ 'deepseek-ai/DeepSeek-V3-0324',
34
+ 'deepseek-ai/DeepSeek-R1',
35
+ 'deepseek-ai/DeepSeek-R1-0528',
36
+ 'deepseek-ai/DeepSeek-R1-Distill-Qwen-1.5B',
37
+ 'deepseek-ai/DeepSeek-R1-Distill-Qwen-7B',
38
+ 'deepseek-ai/DeepSeek-R1-Distill-Qwen-14B',
39
+ 'deepseek-ai/DeepSeek-R1-Distill-Qwen-32B',
40
+ 'deepseek-ai/DeepSeek-R1-Distill-Llama-8B',
41
+ 'deepseek-ai/DeepSeek-R1-Distill-Llama-70B',
42
+ 'deepseek-ai/DeepSeek-Prover-V2-671B',
43
+ 'Qwen/Qwen3-32B',
44
+ 'Qwen/Qwen3-14B',
45
+ 'Qwen/Qwen3-8B',
46
+ 'Qwen/Qwen3-4B',
47
+ 'Qwen/Qwen3-Coder-480B-A35B-Instruct',
48
+ 'Qwen/Qwen3-Coder-480B-A35B-Instruct-FP8',
49
+ 'Qwen/Qwen3-30B-A3B',
50
+ 'Qwen/Qwen2.5-VL-7B-Instruct',
51
+ 'Qwen/Qwen2.5-7B-Instruct',
52
+ 'Qwen/Qwen2.5-Coder-7B-Instruct',
53
+ 'Qwen/Qwen2.5-Coder-32B-Instruct',
54
+ 'google/gemma-2-9b-it',
55
+ 'google/gemma-3-27b-it',
56
+ 'moonshotai/Kimi-K2-Instruct',
57
+ ] as const;
58
+ const documentedLanguageCapabilities: Record<
59
+ string,
60
+ NonNullable<ModelCapabilities['language']>
61
+ > = {
62
+ 'meta-llama/Llama-3.1-8B-Instruct': {
63
+ inputs: { image: false, audio: 'unknown' },
64
+ objectGeneration: true,
65
+ tools: { usage: true, streaming: true },
66
+ reasoning: { support: 'unknown' },
67
+ sampling: { temperature: 'unknown', topP: 'unknown', logprobs: 'unknown' },
68
+ },
69
+ 'meta-llama/Llama-3.1-70B-Instruct': {
70
+ inputs: { image: false, audio: 'unknown' },
71
+ objectGeneration: true,
72
+ tools: { usage: true, streaming: true },
73
+ reasoning: { support: 'unknown' },
74
+ sampling: { temperature: 'unknown', topP: 'unknown', logprobs: 'unknown' },
75
+ },
76
+ 'meta-llama/Llama-3.3-70B-Instruct': {
77
+ inputs: { image: false, audio: 'unknown' },
78
+ objectGeneration: true,
79
+ tools: { usage: true, streaming: true },
80
+ reasoning: { support: 'unknown' },
81
+ sampling: { temperature: 'unknown', topP: 'unknown', logprobs: 'unknown' },
82
+ },
83
+ 'meta-llama/Llama-4-Maverick-17B-128E-Instruct': {
84
+ inputs: { image: false, audio: 'unknown' },
85
+ objectGeneration: true,
86
+ tools: { usage: true, streaming: true },
87
+ reasoning: { support: 'unknown' },
88
+ sampling: { temperature: 'unknown', topP: 'unknown', logprobs: 'unknown' },
89
+ },
90
+ 'deepseek-ai/DeepSeek-V3.1': {
91
+ inputs: { image: false, audio: 'unknown' },
92
+ objectGeneration: true,
93
+ tools: { usage: true, streaming: true },
94
+ reasoning: { support: 'unknown' },
95
+ sampling: { temperature: 'unknown', topP: 'unknown', logprobs: 'unknown' },
96
+ },
97
+ 'deepseek-ai/DeepSeek-V3-0324': {
98
+ inputs: { image: false, audio: 'unknown' },
99
+ objectGeneration: true,
100
+ tools: { usage: true, streaming: true },
101
+ reasoning: { support: 'unknown' },
102
+ sampling: { temperature: 'unknown', topP: 'unknown', logprobs: 'unknown' },
103
+ },
104
+ 'deepseek-ai/DeepSeek-R1': {
105
+ inputs: { image: false, audio: 'unknown' },
106
+ objectGeneration: true,
107
+ tools: { usage: true, streaming: true },
108
+ reasoning: { support: 'unknown' },
109
+ sampling: { temperature: 'unknown', topP: 'unknown', logprobs: 'unknown' },
110
+ },
111
+ 'deepseek-ai/DeepSeek-R1-Distill-Llama-70B': {
112
+ inputs: { image: false, audio: 'unknown' },
113
+ objectGeneration: true,
114
+ tools: { usage: true, streaming: true },
115
+ reasoning: { support: 'unknown' },
116
+ sampling: { temperature: 'unknown', topP: 'unknown', logprobs: 'unknown' },
117
+ },
118
+ 'Qwen/Qwen3-32B': {
119
+ inputs: { image: false, audio: 'unknown' },
120
+ objectGeneration: true,
121
+ tools: { usage: true, streaming: true },
122
+ reasoning: { support: 'unknown' },
123
+ sampling: { temperature: 'unknown', topP: 'unknown', logprobs: 'unknown' },
124
+ },
125
+ 'Qwen/Qwen3-Coder-480B-A35B-Instruct': {
126
+ inputs: { image: false, audio: 'unknown' },
127
+ objectGeneration: true,
128
+ tools: { usage: true, streaming: true },
129
+ reasoning: { support: 'unknown' },
130
+ sampling: { temperature: 'unknown', topP: 'unknown', logprobs: 'unknown' },
131
+ },
132
+ 'Qwen/Qwen2.5-VL-7B-Instruct': {
133
+ inputs: { image: true, audio: 'unknown' },
134
+ objectGeneration: true,
135
+ tools: { usage: true, streaming: true },
136
+ reasoning: { support: 'unknown' },
137
+ sampling: { temperature: 'unknown', topP: 'unknown', logprobs: 'unknown' },
138
+ },
139
+ 'google/gemma-3-27b-it': {
140
+ inputs: { image: false, audio: 'unknown' },
141
+ objectGeneration: true,
142
+ tools: { usage: true, streaming: true },
143
+ reasoning: { support: 'unknown' },
144
+ sampling: { temperature: 'unknown', topP: 'unknown', logprobs: 'unknown' },
145
+ },
146
+ 'moonshotai/Kimi-K2-Instruct': {
147
+ inputs: { image: false, audio: 'unknown' },
148
+ objectGeneration: true,
149
+ tools: { usage: true, streaming: true },
150
+ reasoning: { support: 'unknown' },
151
+ sampling: { temperature: 'unknown', topP: 'unknown', logprobs: 'unknown' },
152
+ },
153
+ };
154
+ const unknownLanguageCapabilities: NonNullable<ModelCapabilities['language']> =
155
+ {
156
+ inputs: { image: 'unknown', audio: 'unknown' },
157
+ objectGeneration: 'unknown',
158
+ tools: { usage: 'unknown', streaming: 'unknown' },
159
+ reasoning: { support: 'unknown' },
160
+ sampling: { temperature: 'unknown', topP: 'unknown', logprobs: 'unknown' },
161
+ };
162
+ export function getHuggingFaceLanguageModelEntry(modelId: string) {
163
+ return {
164
+ capabilities: {
165
+ language:
166
+ documentedLanguageCapabilities[modelId] ?? unknownLanguageCapabilities,
167
+ },
168
+ providerOptions: {
169
+ language: Object.fromEntries(
170
+ Object.keys(huggingFaceProviderOptions.language).map(key => [
171
+ key,
172
+ 'unknown' as const,
173
+ ]),
174
+ ),
175
+ },
176
+ } satisfies ModelEntry;
177
+ }
178
+ export const huggingFaceModelCatalog = Object.fromEntries(
179
+ languageModelIds.map(id => [id, getHuggingFaceLanguageModelEntry(id)]),
180
+ );