@vibesdotdev/integrations-huggingface 0.0.0-stage → 1.0.0-rc.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.
Files changed (65) hide show
  1. package/LICENSE +126 -0
  2. package/README.md +33 -2
  3. package/dist/ai/index.d.ts +4 -0
  4. package/dist/ai/index.d.ts.map +1 -0
  5. package/dist/ai/index.js +4 -0
  6. package/dist/ai/index.js.map +1 -0
  7. package/dist/ai/metadata/assets/assets/logos/providers/huggingface.svg +8 -0
  8. package/dist/ai/metadata/assets/logos/providers/huggingface.svg +8 -0
  9. package/dist/ai/provider.plugin.d.ts +6 -0
  10. package/dist/ai/provider.plugin.d.ts.map +1 -0
  11. package/dist/ai/provider.plugin.js +133 -0
  12. package/dist/ai/provider.plugin.js.map +1 -0
  13. package/dist/ai/providers/cloud/api/huggingface/config/config.huggingface.descriptor.d.ts +4194 -0
  14. package/dist/ai/providers/cloud/api/huggingface/config/config.huggingface.descriptor.d.ts.map +1 -0
  15. package/dist/ai/providers/cloud/api/huggingface/config/config.huggingface.descriptor.js +14 -0
  16. package/dist/ai/providers/cloud/api/huggingface/config/config.huggingface.descriptor.js.map +1 -0
  17. package/dist/ai/providers/cloud/api/huggingface/config/schemas/index.d.ts +12 -0
  18. package/dist/ai/providers/cloud/api/huggingface/config/schemas/index.d.ts.map +1 -0
  19. package/dist/ai/providers/cloud/api/huggingface/config/schemas/index.js +8 -0
  20. package/dist/ai/providers/cloud/api/huggingface/config/schemas/index.js.map +1 -0
  21. package/dist/ai/providers/cloud/api/huggingface/index.d.ts +5 -0
  22. package/dist/ai/providers/cloud/api/huggingface/index.d.ts.map +1 -0
  23. package/dist/ai/providers/cloud/api/huggingface/index.js +4 -0
  24. package/dist/ai/providers/cloud/api/huggingface/index.js.map +1 -0
  25. package/dist/ai/providers/cloud/api/huggingface/provider.huggingface.descriptor.d.ts +183 -0
  26. package/dist/ai/providers/cloud/api/huggingface/provider.huggingface.descriptor.d.ts.map +1 -0
  27. package/dist/ai/providers/cloud/api/huggingface/provider.huggingface.descriptor.js +20 -0
  28. package/dist/ai/providers/cloud/api/huggingface/provider.huggingface.descriptor.js.map +1 -0
  29. package/dist/ai/providers/huggingface/detection/index.d.ts +2 -0
  30. package/dist/ai/providers/huggingface/detection/index.d.ts.map +1 -0
  31. package/dist/ai/providers/huggingface/detection/index.js +2 -0
  32. package/dist/ai/providers/huggingface/detection/index.js.map +1 -0
  33. package/dist/ai/providers/huggingface/detection/system.d.ts +4 -0
  34. package/dist/ai/providers/huggingface/detection/system.d.ts.map +1 -0
  35. package/dist/ai/providers/huggingface/detection/system.js +12 -0
  36. package/dist/ai/providers/huggingface/detection/system.js.map +1 -0
  37. package/dist/ai/providers/huggingface/huggingface.provider.impl.d.ts +18 -0
  38. package/dist/ai/providers/huggingface/huggingface.provider.impl.d.ts.map +1 -0
  39. package/dist/ai/providers/huggingface/huggingface.provider.impl.js +93 -0
  40. package/dist/ai/providers/huggingface/huggingface.provider.impl.js.map +1 -0
  41. package/dist/ai/providers/huggingface/index.d.ts +4 -0
  42. package/dist/ai/providers/huggingface/index.d.ts.map +1 -0
  43. package/dist/ai/providers/huggingface/index.js +4 -0
  44. package/dist/ai/providers/huggingface/index.js.map +1 -0
  45. package/dist/ai/providers/huggingface/recommendations.d.ts +22 -0
  46. package/dist/ai/providers/huggingface/recommendations.d.ts.map +1 -0
  47. package/dist/ai/providers/huggingface/recommendations.js +20 -0
  48. package/dist/ai/providers/huggingface/recommendations.js.map +1 -0
  49. package/dist/index.d.ts +2 -0
  50. package/dist/index.d.ts.map +1 -0
  51. package/dist/index.js +2 -0
  52. package/dist/index.js.map +1 -0
  53. package/dist/model-hub/client.d.ts +50 -0
  54. package/dist/model-hub/client.d.ts.map +1 -0
  55. package/dist/model-hub/client.js +261 -0
  56. package/dist/model-hub/client.js.map +1 -0
  57. package/dist/model-hub/schemas.d.ts +232 -0
  58. package/dist/model-hub/schemas.d.ts.map +1 -0
  59. package/dist/model-hub/schemas.js +189 -0
  60. package/dist/model-hub/schemas.js.map +1 -0
  61. package/dist/model-hub/types.d.ts +4 -0
  62. package/dist/model-hub/types.d.ts.map +1 -0
  63. package/dist/model-hub/types.js +2 -0
  64. package/dist/model-hub/types.js.map +1 -0
  65. package/package.json +72 -4
@@ -0,0 +1,50 @@
1
+ /**
2
+ * HuggingFace Hub API Client
3
+ *
4
+ * Provides access to HuggingFace models, model search, and file downloads.
5
+ * Based on the HuggingFace Hub API: https://huggingface.co/docs/hub/api
6
+ */
7
+ import { BaseModelHubClient } from '@vibesdotdev/ai/model-hubs';
8
+ import type { ModelSearchResult, ModelDetails, ModelFile, ModelSearchOptions, ModelHubConfig } from '@vibesdotdev/ai/model-hubs';
9
+ import { type VibesRuntime } from '@vibesdotdev/kernel';
10
+ import * as z from 'zod/v4';
11
+ export declare class HuggingFaceClient extends BaseModelHubClient {
12
+ private static readonly API_BASE;
13
+ constructor(runtime: VibesRuntime, config?: ModelHubConfig);
14
+ /** The Hub API base: the configured one, else the public Hub. */
15
+ private get apiBase();
16
+ /** The Hub site (file downloads, raw files) that serves the configured API. */
17
+ private get siteBase();
18
+ /** The HTTP status of a Hub answer that was not a success: the `hub-http-error` refusal's `details.status`. */
19
+ private static httpStatus;
20
+ search(options?: ModelSearchOptions): Promise<ModelSearchResult[]>;
21
+ getModel(modelId: string): Promise<ModelDetails>;
22
+ getDownloadUrl(modelId: string, filename?: string): Promise<string>;
23
+ validateCredentials(): Promise<boolean>;
24
+ /**
25
+ * Get available model files for a specific model
26
+ */
27
+ getModelFiles(modelId: string): Promise<ModelFile[]>;
28
+ /**
29
+ * Get model readme/description
30
+ */
31
+ getModelReadme(modelId: string): Promise<string>;
32
+ /**
33
+ * Check if a model exists and is accessible
34
+ */
35
+ modelExists(modelId: string): Promise<boolean>;
36
+ private mapToSearchResult;
37
+ private mapToModelDetails;
38
+ private mapToModelFile;
39
+ private extractDescription;
40
+ private formatTaskType;
41
+ private calculateTotalSize;
42
+ private mapSortOption;
43
+ private isValidTaskType;
44
+ protected getAuthHeader(): string;
45
+ protected request<Schema extends z.ZodType>(url: string, schema: Schema, options?: RequestInit): Promise<z.output<Schema>>;
46
+ protected requestText(url: string, options?: RequestInit): Promise<string>;
47
+ private handleError;
48
+ }
49
+ export default HuggingFaceClient;
50
+ //# sourceMappingURL=client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/model-hub/client.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,kBAAkB,EAA+D,MAAM,4BAA4B,CAAC;AAC7H,OAAO,KAAK,EACX,iBAAiB,EACjB,YAAY,EACZ,SAAS,EACT,kBAAkB,EAClB,cAAc,EACd,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAKN,KAAK,YAAY,EACjB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,KAAK,CAAC,MAAM,QAAQ,CAAC;AAgB5B,qBAAa,iBAAkB,SAAQ,kBAAkB;IACxD,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAgC;gBAEpD,OAAO,EAAE,YAAY,EAAE,MAAM,GAAE,cAAmB;IAO9D,iEAAiE;IACjE,OAAO,KAAK,OAAO,GAElB;IAED,+EAA+E;IAC/E,OAAO,KAAK,QAAQ,GAEnB;IAED,+GAA+G;IAC/G,OAAO,CAAC,MAAM,CAAC,UAAU;IAMnB,MAAM,CAAC,OAAO,GAAE,kBAAuB,GAAG,OAAO,CAAC,iBAAiB,EAAE,CAAC;IAqCtE,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,CAAC;IAWhD,cAAc,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAyBnE,mBAAmB,IAAI,OAAO,CAAC,OAAO,CAAC;IAW7C;;OAEG;IACG,aAAa,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,EAAE,CAAC;IAW1D;;OAEG;IACG,cAAc,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAUtD;;OAEG;IACG,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAOpD,OAAO,CAAC,iBAAiB;IA8BzB,OAAO,CAAC,iBAAiB;IAazB,OAAO,CAAC,cAAc;IAetB,OAAO,CAAC,kBAAkB;IAa1B,OAAO,CAAC,cAAc;IAOtB,OAAO,CAAC,kBAAkB;IAM1B,OAAO,CAAC,aAAa;IAiBrB,OAAO,CAAC,eAAe;IAIvB,SAAS,CAAC,aAAa,IAAI,MAAM;cAIR,OAAO,CAAC,MAAM,SAAS,CAAC,CAAC,OAAO,EACxD,GAAG,EAAE,MAAM,EACX,MAAM,EAAE,MAAM,EACd,OAAO,GAAE,WAAgB,GACvB,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;cAMH,WAAW,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,GAAE,WAAgB,GAAG,OAAO,CAAC,MAAM,CAAC;IAM7F,OAAO,CAAC,WAAW;CAmBnB;AAED,eAAe,iBAAiB,CAAC"}
@@ -0,0 +1,261 @@
1
+ /**
2
+ * HuggingFace Hub API Client
3
+ *
4
+ * Provides access to HuggingFace models, model search, and file downloads.
5
+ * Based on the HuggingFace Hub API: https://huggingface.co/docs/hub/api
6
+ */
7
+ import { BaseModelHubClient, InvalidCredentialsError, ModelNotFoundError, RateLimitError } from '@vibesdotdev/ai/model-hubs';
8
+ import { CapabilityError, settle, isCapabilityError } from '@vibesdotdev/kernel';
9
+ import * as z from 'zod/v4';
10
+ import { JsonObjectSchema } from '@vibesdotdev/kernel/schemas/json';
11
+ import { HFModelDetailsSchema, HFModelSchema, HFUserInfoSchema } from "./schemas.js";
12
+ import { HF_TASK_TYPES } from "./types.js";
13
+ const HttpStatusSchema = z.number().int().min(100).max(599);
14
+ const HFModelListSchema = z.array(HFModelSchema);
15
+ export class HuggingFaceClient extends BaseModelHubClient {
16
+ static API_BASE = 'https://huggingface.co/api';
17
+ constructor(runtime, config = {}) {
18
+ super(runtime, {
19
+ baseUrl: HuggingFaceClient.API_BASE,
20
+ ...config
21
+ });
22
+ }
23
+ /** The Hub API base: the configured one, else the public Hub. */
24
+ get apiBase() {
25
+ return (this.config.baseUrl ?? HuggingFaceClient.API_BASE).replace(/\/$/, '');
26
+ }
27
+ /** The Hub site (file downloads, raw files) that serves the configured API. */
28
+ get siteBase() {
29
+ return new URL(this.apiBase).origin;
30
+ }
31
+ /** The HTTP status of a Hub answer that was not a success: the `hub-http-error` refusal's `details.status`. */
32
+ static httpStatus(failure) {
33
+ if (!isCapabilityError(failure) || failure.reason !== 'hub-http-error')
34
+ return undefined;
35
+ const status = HttpStatusSchema.safeParse(failure.details?.status);
36
+ return status.success ? status.data : undefined;
37
+ }
38
+ async search(options = {}) {
39
+ const params = {
40
+ search: options.query,
41
+ limit: Math.min(options.limit || 20, 100), // HF API limit is 100
42
+ sort: this.mapSortOption(options.sort),
43
+ direction: 'desc',
44
+ full: true, // Get full model info
45
+ cardData: true, // Include model card data
46
+ config: false // Don't need config for search
47
+ };
48
+ // Add task filter if provided
49
+ if (options.task && this.isValidTaskType(options.task)) {
50
+ params.filter = options.task;
51
+ }
52
+ // Add author filter
53
+ if (options.author) {
54
+ params.author = options.author;
55
+ }
56
+ // Build query string
57
+ const queryParams = new URLSearchParams();
58
+ Object.entries(params).forEach(([key, value]) => {
59
+ if (value !== undefined) {
60
+ queryParams.append(key, value.toString());
61
+ }
62
+ });
63
+ const models = await this.request(`${this.apiBase}/models?${queryParams.toString()}`, HFModelListSchema);
64
+ return models.map(this.mapToSearchResult.bind(this));
65
+ }
66
+ async getModel(modelId) {
67
+ this.validateModelId(modelId);
68
+ const model = await this.request(`${this.apiBase}/models/${encodeURIComponent(modelId)}`, HFModelDetailsSchema);
69
+ return this.mapToModelDetails(model);
70
+ }
71
+ async getDownloadUrl(modelId, filename) {
72
+ this.validateModelId(modelId);
73
+ // If no filename specified, get the first available file
74
+ let resolvedFilename = filename;
75
+ if (!resolvedFilename) {
76
+ const model = await this.getModel(modelId);
77
+ if (model.files.length === 0) {
78
+ throw new CapabilityError('The model has no files.', 'NOT_FOUND', {
79
+ reason: 'hub-model-files-absent',
80
+ details: { modelId }
81
+ });
82
+ }
83
+ resolvedFilename = model.files[0].filename;
84
+ }
85
+ // HuggingFace direct download URL format
86
+ const downloadUrl = `${this.siteBase}/${modelId}/resolve/main/${resolvedFilename}`;
87
+ // For LFS files, we need to follow redirects to get the actual download URL
88
+ // We'll return the HF URL and let the download handler deal with redirects
89
+ return downloadUrl;
90
+ }
91
+ async validateCredentials() {
92
+ if (!this.config.apiKey) {
93
+ // HuggingFace works without API key for public models, so this is valid
94
+ return true;
95
+ }
96
+ const user = await this.request(`${this.apiBase}/whoami`, HFUserInfoSchema);
97
+ return user.type === 'user' || user.type === 'org';
98
+ }
99
+ /**
100
+ * Get available model files for a specific model
101
+ */
102
+ async getModelFiles(modelId) {
103
+ this.validateModelId(modelId);
104
+ const model = await this.request(`${this.apiBase}/models/${encodeURIComponent(modelId)}`, HFModelDetailsSchema);
105
+ return model.siblings.map((file) => this.mapToModelFile(file, modelId));
106
+ }
107
+ /**
108
+ * Get model readme/description
109
+ */
110
+ async getModelReadme(modelId) {
111
+ this.validateModelId(modelId);
112
+ const url = `${this.siteBase}/${modelId}/raw/main/README.md`;
113
+ const result = await settle(() => this.requestText(url));
114
+ if (result.ok)
115
+ return result.value;
116
+ if (isCapabilityError(result.cause) && result.cause.reason === 'hub-model-not-found')
117
+ return '';
118
+ throw result.cause;
119
+ }
120
+ /**
121
+ * Check if a model exists and is accessible
122
+ */
123
+ async modelExists(modelId) {
124
+ const result = await settle(() => this.getModel(modelId));
125
+ if (result.ok)
126
+ return true;
127
+ if (isCapabilityError(result.cause) && result.cause.reason === 'hub-model-not-found')
128
+ return false;
129
+ throw result.cause;
130
+ }
131
+ mapToSearchResult(model) {
132
+ return {
133
+ id: model.id,
134
+ name: model.id.split('/').pop() || model.id,
135
+ source: 'huggingface',
136
+ description: this.extractDescription(model),
137
+ tags: model.tags || [],
138
+ downloads: model.downloads,
139
+ likes: model.likes,
140
+ createdAt: new Date(model.createdAt),
141
+ updatedAt: new Date(model.lastModified),
142
+ author: model.author || model.id.split('/')[0],
143
+ metadata: JsonObjectSchema.parse(Object.fromEntries(Object.entries({
144
+ modelId: model.modelId,
145
+ pipelineTag: model.pipeline_tag,
146
+ libraryName: model.library_name,
147
+ gated: model.gated,
148
+ private: model.private,
149
+ disabled: model.disabled,
150
+ sha: model.sha,
151
+ license: model.cardData?.license,
152
+ language: model.cardData?.language,
153
+ datasets: model.cardData?.datasets,
154
+ metrics: model.cardData?.metrics,
155
+ safetensors: !!model.transformersInfo,
156
+ taskType: model.pipeline_tag
157
+ }).filter(([, value]) => value !== undefined)))
158
+ };
159
+ }
160
+ mapToModelDetails(model) {
161
+ const searchResult = this.mapToSearchResult(model);
162
+ return {
163
+ ...searchResult,
164
+ files: model.siblings.map((file) => this.mapToModelFile(file, model.id)),
165
+ license: model.cardData?.license,
166
+ repository: `${this.siteBase}/${model.id}`,
167
+ safetensors: !!model.safetensors,
168
+ size: this.calculateTotalSize(model.siblings)
169
+ };
170
+ }
171
+ mapToModelFile(file, modelId) {
172
+ return {
173
+ filename: file.rfilename,
174
+ url: `${this.siteBase}/${modelId || 'unknown'}/resolve/main/${file.rfilename}`,
175
+ size: file.size || file.lfs?.size || 0,
176
+ sha: file.lfs?.oid || file.blobId,
177
+ lfs: !!file.lfs,
178
+ metadata: JsonObjectSchema.parse(Object.fromEntries(Object.entries({
179
+ blobId: file.blobId,
180
+ lfs: file.lfs,
181
+ pointerSize: file.lfs?.pointerSize
182
+ }).filter(([, value]) => value !== undefined)))
183
+ };
184
+ }
185
+ extractDescription(model) {
186
+ // Try to get description from various sources
187
+ if (model.cardData?.model_name) {
188
+ return model.cardData.model_name;
189
+ }
190
+ if (model.pipeline_tag) {
191
+ return `${this.formatTaskType(model.pipeline_tag)} model`;
192
+ }
193
+ return `${model.library_name || 'ML'} model`;
194
+ }
195
+ formatTaskType(taskType) {
196
+ return taskType
197
+ .split('-')
198
+ .map((word) => word.charAt(0).toUpperCase() + word.slice(1))
199
+ .join(' ');
200
+ }
201
+ calculateTotalSize(files) {
202
+ return files.reduce((total, file) => {
203
+ return total + (file.size || file.lfs?.size || 0);
204
+ }, 0);
205
+ }
206
+ mapSortOption(sort) {
207
+ switch (sort) {
208
+ case 'downloads':
209
+ return 'downloads';
210
+ case 'likes':
211
+ return 'likes';
212
+ case 'created':
213
+ return 'createdAt';
214
+ case 'updated':
215
+ return 'lastModified';
216
+ case 'trending':
217
+ return 'downloads'; // Map trending to downloads
218
+ default:
219
+ return 'downloads';
220
+ }
221
+ }
222
+ isValidTaskType(task) {
223
+ return z.enum(HF_TASK_TYPES).safeParse(task).success;
224
+ }
225
+ getAuthHeader() {
226
+ return `Bearer ${this.config.apiKey}`;
227
+ }
228
+ async request(url, schema, options = {}) {
229
+ const result = await settle(() => super.request(url, schema, options));
230
+ if (!result.ok)
231
+ throw this.handleError(result.cause);
232
+ return result.value;
233
+ }
234
+ async requestText(url, options = {}) {
235
+ const result = await settle(() => super.requestText(url, options));
236
+ if (!result.ok)
237
+ throw this.handleError(result.cause);
238
+ return result.value;
239
+ }
240
+ handleError(failure) {
241
+ const status = HuggingFaceClient.httpStatus(failure);
242
+ if (status === 401) {
243
+ const refusal = new InvalidCredentialsError();
244
+ refusal.cause = failure;
245
+ return refusal;
246
+ }
247
+ if (status === 429) {
248
+ const refusal = new RateLimitError();
249
+ refusal.cause = failure;
250
+ return refusal;
251
+ }
252
+ if (status === 404) {
253
+ const refusal = new ModelNotFoundError();
254
+ refusal.cause = failure;
255
+ return refusal;
256
+ }
257
+ return CapabilityError.from(failure);
258
+ }
259
+ }
260
+ export default HuggingFaceClient;
261
+ //# sourceMappingURL=client.js.map
@@ -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;;AAGF,eAAe,iBAAiB,CAAC"}
@@ -0,0 +1,232 @@
1
+ import * as z from 'zod/v4';
2
+ /** The Hub's model-card data block. */
3
+ export declare const HFModelCardDataSchema: z.ZodObject<{
4
+ language: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
5
+ license: z.ZodOptional<z.ZodString>;
6
+ tags: z.ZodOptional<z.ZodArray<z.ZodString>>;
7
+ datasets: z.ZodOptional<z.ZodArray<z.ZodString>>;
8
+ metrics: z.ZodOptional<z.ZodArray<z.ZodString>>;
9
+ pipeline_tag: z.ZodOptional<z.ZodString>;
10
+ widget: z.ZodOptional<z.ZodArray<z.ZodUnknown>>;
11
+ model_name: z.ZodOptional<z.ZodString>;
12
+ inference: z.ZodOptional<z.ZodBoolean>;
13
+ thumbnail: z.ZodOptional<z.ZodString>;
14
+ co2_eq_emissions: z.ZodOptional<z.ZodObject<{
15
+ emissions: z.ZodNumber;
16
+ source: z.ZodOptional<z.ZodString>;
17
+ training_type: z.ZodOptional<z.ZodString>;
18
+ geographical_location: z.ZodOptional<z.ZodString>;
19
+ hardware_used: z.ZodOptional<z.ZodString>;
20
+ }, z.core.$strip>>;
21
+ }, z.core.$strip>;
22
+ export declare const HFTransformersInfoSchema: z.ZodObject<{
23
+ auto_model: z.ZodString;
24
+ custom_class: z.ZodOptional<z.ZodString>;
25
+ pipeline_tag: z.ZodOptional<z.ZodString>;
26
+ processor: z.ZodOptional<z.ZodString>;
27
+ }, z.core.$strip>;
28
+ /** One model row of a Hub search or model lookup. */
29
+ export declare const HFModelSchema: z.ZodObject<{
30
+ id: z.ZodString;
31
+ author: z.ZodOptional<z.ZodString>;
32
+ sha: z.ZodString;
33
+ lastModified: z.ZodString;
34
+ private: z.ZodBoolean;
35
+ downloads: z.ZodNumber;
36
+ likes: z.ZodNumber;
37
+ library_name: z.ZodOptional<z.ZodString>;
38
+ tags: z.ZodArray<z.ZodString>;
39
+ pipeline_tag: z.ZodOptional<z.ZodString>;
40
+ createdAt: z.ZodString;
41
+ modelId: z.ZodString;
42
+ disabled: z.ZodOptional<z.ZodBoolean>;
43
+ gated: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<false>, z.ZodEnum<{
44
+ auto: "auto";
45
+ manual: "manual";
46
+ }>]>>;
47
+ inference: z.ZodOptional<z.ZodEnum<{
48
+ cold: "cold";
49
+ warm: "warm";
50
+ frozen: "frozen";
51
+ }>>;
52
+ cardData: z.ZodOptional<z.ZodObject<{
53
+ language: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
54
+ license: z.ZodOptional<z.ZodString>;
55
+ tags: z.ZodOptional<z.ZodArray<z.ZodString>>;
56
+ datasets: z.ZodOptional<z.ZodArray<z.ZodString>>;
57
+ metrics: z.ZodOptional<z.ZodArray<z.ZodString>>;
58
+ pipeline_tag: z.ZodOptional<z.ZodString>;
59
+ widget: z.ZodOptional<z.ZodArray<z.ZodUnknown>>;
60
+ model_name: z.ZodOptional<z.ZodString>;
61
+ inference: z.ZodOptional<z.ZodBoolean>;
62
+ thumbnail: z.ZodOptional<z.ZodString>;
63
+ co2_eq_emissions: z.ZodOptional<z.ZodObject<{
64
+ emissions: z.ZodNumber;
65
+ source: z.ZodOptional<z.ZodString>;
66
+ training_type: z.ZodOptional<z.ZodString>;
67
+ geographical_location: z.ZodOptional<z.ZodString>;
68
+ hardware_used: z.ZodOptional<z.ZodString>;
69
+ }, z.core.$strip>>;
70
+ }, z.core.$strip>>;
71
+ transformersInfo: z.ZodOptional<z.ZodObject<{
72
+ auto_model: z.ZodString;
73
+ custom_class: z.ZodOptional<z.ZodString>;
74
+ pipeline_tag: z.ZodOptional<z.ZodString>;
75
+ processor: z.ZodOptional<z.ZodString>;
76
+ }, z.core.$strip>>;
77
+ config: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
78
+ }, z.core.$strip>;
79
+ export declare const HFModelFileSchema: z.ZodObject<{
80
+ rfilename: z.ZodString;
81
+ size: z.ZodOptional<z.ZodNumber>;
82
+ blobId: z.ZodOptional<z.ZodString>;
83
+ lfs: z.ZodOptional<z.ZodObject<{
84
+ oid: z.ZodString;
85
+ size: z.ZodNumber;
86
+ pointerSize: z.ZodNumber;
87
+ }, z.core.$strip>>;
88
+ }, z.core.$strip>;
89
+ /** A model lookup: the model row with its files. */
90
+ export declare const HFModelDetailsSchema: z.ZodObject<{
91
+ id: z.ZodString;
92
+ author: z.ZodOptional<z.ZodString>;
93
+ sha: z.ZodString;
94
+ lastModified: z.ZodString;
95
+ private: z.ZodBoolean;
96
+ downloads: z.ZodNumber;
97
+ likes: z.ZodNumber;
98
+ library_name: z.ZodOptional<z.ZodString>;
99
+ tags: z.ZodArray<z.ZodString>;
100
+ pipeline_tag: z.ZodOptional<z.ZodString>;
101
+ createdAt: z.ZodString;
102
+ modelId: z.ZodString;
103
+ disabled: z.ZodOptional<z.ZodBoolean>;
104
+ gated: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<false>, z.ZodEnum<{
105
+ auto: "auto";
106
+ manual: "manual";
107
+ }>]>>;
108
+ inference: z.ZodOptional<z.ZodEnum<{
109
+ cold: "cold";
110
+ warm: "warm";
111
+ frozen: "frozen";
112
+ }>>;
113
+ cardData: z.ZodOptional<z.ZodObject<{
114
+ language: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
115
+ license: z.ZodOptional<z.ZodString>;
116
+ tags: z.ZodOptional<z.ZodArray<z.ZodString>>;
117
+ datasets: z.ZodOptional<z.ZodArray<z.ZodString>>;
118
+ metrics: z.ZodOptional<z.ZodArray<z.ZodString>>;
119
+ pipeline_tag: z.ZodOptional<z.ZodString>;
120
+ widget: z.ZodOptional<z.ZodArray<z.ZodUnknown>>;
121
+ model_name: z.ZodOptional<z.ZodString>;
122
+ inference: z.ZodOptional<z.ZodBoolean>;
123
+ thumbnail: z.ZodOptional<z.ZodString>;
124
+ co2_eq_emissions: z.ZodOptional<z.ZodObject<{
125
+ emissions: z.ZodNumber;
126
+ source: z.ZodOptional<z.ZodString>;
127
+ training_type: z.ZodOptional<z.ZodString>;
128
+ geographical_location: z.ZodOptional<z.ZodString>;
129
+ hardware_used: z.ZodOptional<z.ZodString>;
130
+ }, z.core.$strip>>;
131
+ }, z.core.$strip>>;
132
+ transformersInfo: z.ZodOptional<z.ZodObject<{
133
+ auto_model: z.ZodString;
134
+ custom_class: z.ZodOptional<z.ZodString>;
135
+ pipeline_tag: z.ZodOptional<z.ZodString>;
136
+ processor: z.ZodOptional<z.ZodString>;
137
+ }, z.core.$strip>>;
138
+ config: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
139
+ siblings: z.ZodArray<z.ZodObject<{
140
+ rfilename: z.ZodString;
141
+ size: z.ZodOptional<z.ZodNumber>;
142
+ blobId: z.ZodOptional<z.ZodString>;
143
+ lfs: z.ZodOptional<z.ZodObject<{
144
+ oid: z.ZodString;
145
+ size: z.ZodNumber;
146
+ pointerSize: z.ZodNumber;
147
+ }, z.core.$strip>>;
148
+ }, z.core.$strip>>;
149
+ spaces: z.ZodOptional<z.ZodArray<z.ZodString>>;
150
+ safetensors: z.ZodOptional<z.ZodObject<{
151
+ parameters: z.ZodRecord<z.ZodString, z.ZodNumber>;
152
+ total: z.ZodNumber;
153
+ }, z.core.$strip>>;
154
+ }, z.core.$strip>;
155
+ /** An organization the signed-in user belongs to. */
156
+ export declare const HFOrganizationSchema: z.ZodObject<{
157
+ name: z.ZodString;
158
+ fullname: z.ZodString;
159
+ type: z.ZodLiteral<"org">;
160
+ avatarUrl: z.ZodOptional<z.ZodString>;
161
+ websiteUrl: z.ZodOptional<z.ZodString>;
162
+ isEnterprise: z.ZodOptional<z.ZodBoolean>;
163
+ }, z.core.$strip>;
164
+ /** The `whoami` answer for a credential. */
165
+ export declare const HFUserInfoSchema: z.ZodObject<{
166
+ type: z.ZodEnum<{
167
+ user: "user";
168
+ org: "org";
169
+ }>;
170
+ name: z.ZodString;
171
+ fullname: z.ZodString;
172
+ email: z.ZodOptional<z.ZodString>;
173
+ emailVerified: z.ZodOptional<z.ZodBoolean>;
174
+ plan: z.ZodOptional<z.ZodString>;
175
+ avatarUrl: z.ZodOptional<z.ZodString>;
176
+ websiteUrl: z.ZodOptional<z.ZodString>;
177
+ canPay: z.ZodOptional<z.ZodBoolean>;
178
+ isPro: z.ZodOptional<z.ZodBoolean>;
179
+ isEarlyAccess: z.ZodOptional<z.ZodBoolean>;
180
+ periodEnd: z.ZodOptional<z.ZodString>;
181
+ orgs: z.ZodOptional<z.ZodArray<z.ZodObject<{
182
+ name: z.ZodString;
183
+ fullname: z.ZodString;
184
+ type: z.ZodLiteral<"org">;
185
+ avatarUrl: z.ZodOptional<z.ZodString>;
186
+ websiteUrl: z.ZodOptional<z.ZodString>;
187
+ isEnterprise: z.ZodOptional<z.ZodBoolean>;
188
+ }, z.core.$strip>>>;
189
+ }, z.core.$strip>;
190
+ export type HFModelCardData = z.infer<typeof HFModelCardDataSchema>;
191
+ export type HFTransformersInfo = z.infer<typeof HFTransformersInfoSchema>;
192
+ export type HFModel = z.infer<typeof HFModelSchema>;
193
+ export type HFModelFile = z.infer<typeof HFModelFileSchema>;
194
+ export type HFModelDetails = z.infer<typeof HFModelDetailsSchema>;
195
+ export type HFOrganization = z.infer<typeof HFOrganizationSchema>;
196
+ export type HFUserInfo = z.infer<typeof HFUserInfoSchema>;
197
+ export interface HFModelSearchResponse {
198
+ models: HFModel[];
199
+ numItemsOnPage: number;
200
+ numTotalItems: number;
201
+ pageIndex: number;
202
+ }
203
+ export interface HFDownloadInfo {
204
+ url: string;
205
+ filename: string;
206
+ size: number;
207
+ etag?: string;
208
+ commit_hash?: string;
209
+ }
210
+ export interface HFSearchParams {
211
+ search?: string;
212
+ author?: string;
213
+ filter?: string;
214
+ sort?: 'downloads' | 'likes' | 'lastModified' | 'createdAt';
215
+ direction?: 'asc' | 'desc';
216
+ limit?: number;
217
+ full?: boolean;
218
+ config?: boolean;
219
+ cardData?: boolean;
220
+ }
221
+ export interface HFError {
222
+ error: string;
223
+ message?: string;
224
+ warnings?: string[];
225
+ }
226
+ export declare const HF_TASK_TYPES: readonly ["text-generation", "text2text-generation", "fill-mask", "token-classification", "sentence-similarity", "text-classification", "translation", "summarization", "conversational", "feature-extraction", "text-to-speech", "text-to-audio", "automatic-speech-recognition", "audio-to-audio", "audio-classification", "voice-activity-detection", "depth-estimation", "image-classification", "object-detection", "image-segmentation", "text-to-image", "image-to-text", "image-to-image", "unconditional-image-generation", "video-classification", "reinforcement-learning", "robotics", "tabular-classification", "tabular-regression", "tabular-to-text", "table-to-text", "multiple-choice", "text-retrieval", "time-series-forecasting", "text-to-video", "image-to-video", "visual-question-answering", "document-question-answering", "zero-shot-classification", "graph-ml", "mask-generation", "zero-shot-image-classification", "text-to-3d", "image-to-3d"];
227
+ export type HFTaskType = (typeof HF_TASK_TYPES)[number];
228
+ export declare const HF_LIBRARIES: readonly ["transformers", "pytorch", "tensorflow", "jax", "diffusers", "timm", "spacy", "sentence-transformers", "setfit", "open_clip", "keras", "paddlenlp", "tensorboard", "sklearn", "fastai", "stable-baselines3", "ml-agents", "unity-sentis", "sample-factory", "mindspore", "asteroid", "fairseq", "espnet"];
229
+ export type HFLibrary = (typeof HF_LIBRARIES)[number];
230
+ export declare const HF_LICENSES: readonly ["apache-2.0", "mit", "openrail", "bigscience-openrail-m", "creativeml-openrail-m", "bigscience-bloom-rail-1.0", "bigcode-openrail-m", "cc-by-4.0", "cc-by-sa-4.0", "cc-by-nc-4.0", "cc-by-nc-sa-4.0", "cc0-1.0", "gpl-3.0", "lgpl-3.0", "bsd-3-clause", "unlicense", "other"];
231
+ export type HFLicense = (typeof HF_LICENSES)[number];
232
+ //# sourceMappingURL=schemas.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../src/model-hub/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,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