@shop-os/modelkit 0.1.6 → 0.1.7
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/README.md +1 -0
- package/dist/index.cjs +618 -78
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +29 -1
- package/dist/index.d.ts +29 -1
- package/dist/index.js +618 -78
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -200,6 +200,31 @@ type ProviderOptions = {
|
|
|
200
200
|
type UsageUnit = "tokens" | "images" | "seconds" | "reported_cost_usd" | "compute_seconds";
|
|
201
201
|
type UsageModality = "TEXT" | "IMAGE" | "VIDEO" | "AUDIO";
|
|
202
202
|
type PricingKind = "token" | "image_size" | "video_per_second" | "flat";
|
|
203
|
+
/** What a model picker shows for a row. Free of any surface-specific ids. */
|
|
204
|
+
interface CatalogDisplay {
|
|
205
|
+
/** Vendor as the UI names it: "google", "openai", "meta", "bytedance", "xai", "kuaishou", ... */
|
|
206
|
+
provider: string;
|
|
207
|
+
/** One or two sentences for the picker card. */
|
|
208
|
+
description: string;
|
|
209
|
+
/** CDN URL of the vendor or model logo. */
|
|
210
|
+
logo?: string;
|
|
211
|
+
}
|
|
212
|
+
/** Capability flags a UI keys off. Absent means false / unknown. */
|
|
213
|
+
interface CatalogCapabilities {
|
|
214
|
+
/** Image rows: generates from a prompt alone. */
|
|
215
|
+
imageGenerate?: boolean;
|
|
216
|
+
/** Image rows: edits or conditions on reference images. */
|
|
217
|
+
imageEdit?: boolean;
|
|
218
|
+
/** Video rows: takes an existing video as the thing to edit or extend. */
|
|
219
|
+
acceptsSourceVideo?: boolean;
|
|
220
|
+
/** Video rows: first/last frames and reference images are mutually exclusive inputs. */
|
|
221
|
+
framesExcludeReferences?: boolean;
|
|
222
|
+
/** Text rows. */
|
|
223
|
+
vision?: boolean;
|
|
224
|
+
tools?: boolean;
|
|
225
|
+
structuredOutput?: boolean;
|
|
226
|
+
contextWindow?: number;
|
|
227
|
+
}
|
|
203
228
|
interface CatalogModel {
|
|
204
229
|
/** Canonical id. Equals the pricing key in pro-backend credit_pricing_* tables. */
|
|
205
230
|
id: string;
|
|
@@ -219,6 +244,9 @@ interface CatalogModel {
|
|
|
219
244
|
modality: UsageModality;
|
|
220
245
|
};
|
|
221
246
|
pricingKind: PricingKind;
|
|
247
|
+
/** Required on every `active` row so a picker can render it without a hand-written catalog. */
|
|
248
|
+
display?: CatalogDisplay;
|
|
249
|
+
capabilities?: CatalogCapabilities;
|
|
222
250
|
}
|
|
223
251
|
interface Warning {
|
|
224
252
|
code: "ratio_coerced" | "ratio_dropped" | "size_coerced" | "resolution_coerced" | "duration_coerced" | "references_trimmed" | "option_ignored";
|
|
@@ -629,4 +657,4 @@ declare function describeThrown(cause: unknown): ThrownErrorInfo;
|
|
|
629
657
|
/** Add the AI SDK `GeneratedFile` accessors to adapter image bytes. base64 is computed on first read. */
|
|
630
658
|
declare function toGeneratedImage(image: ImageBytes): GeneratedImage;
|
|
631
659
|
|
|
632
|
-
export { ADAPTER_KEYS, type Adapter, type AdapterContext, type AdapterEndpoints, type AdapterId, type AdapterRegistry, type AiTextProviderOptions, type AspectRatio, type AudioRequest, type AudioResult, type CallContext, Catalog, type CatalogModel, type CatalogTextModel, DEFAULT_ADAPTERS, type DefaultObjectOutput, type GeneratedImage, type ImageBytes, type ImageCallOptions, type ImageCallResult, type ImageQuality, type ImageRequest, type ImageResult, type ImageSafetySetting, type ImageSize, type JsonObject, JsonObjectSchema, type JsonPrimitive, type JsonValue, JsonValueSchema, type LanguageModelHandle, type Lifecycle, MODELS, type MediaPart, type MediaRef, type ModelConstraints, type ModelKit, type ModelKitConfig, ModelKitError, type ModelKitErrorCode, type ModelKitErrorInit, type ModelType, type ModelkitGenerateObjectOptions, type ModelkitGenerateTextOptions, type ModelkitStreamObjectOptions, type ModelkitStreamTextOptions, type ObjectOutput, type ObjectResult, type OnUnsupported, type OutputFormat, type PricingKind, type ProviderErrorBody, type ProviderKeyName, type ProviderKeys, type ProviderOptionValue, type ProviderOptions, type ReferenceLimits, type RequiredInput, type ResolveResult, type Routing, type SupportedOption, type TextMethods, type TextModelInstance, type UpscaleOptions, type UsageEvent, type UsageModality, type UsageUnit, type VideoCallJob, type VideoCallOptions, type VideoJob, type VideoModel, type VideoRequest, type VideoResolution, type VideoResult, type Warning, aiSdkTextAdapter, arkAdapter, aspectRatioToSize, classifyHttpError, createDefaultModelKit, createModelKit, describe, describeThrown, generateImage as experimental_generateImage, falAdapter, generateAudio, generateImage, generateObject, generateText, generateVideo, googleGenaiAdapter, googleImageAdapter, higgsfieldAdapter, isModelKitError, keysFromEnv, languageModel, mergeTextProviderOptions, nearestAspectRatio, openaiImageAdapter, passthroughTextModel, pollUntil, prepareMediaPart, prodiaAdapter, readErrorBody, replicateAdapter, resolveAudioOptions, resolveImageOptions, resolveKeys, resolveVideoOptions, shouldRetry, sleep, streamObject, streamText, textUsageEvent, toGeneratedImage, withRetry, xaiVideoAdapter };
|
|
660
|
+
export { ADAPTER_KEYS, type Adapter, type AdapterContext, type AdapterEndpoints, type AdapterId, type AdapterRegistry, type AiTextProviderOptions, type AspectRatio, type AudioRequest, type AudioResult, type CallContext, Catalog, type CatalogCapabilities, type CatalogDisplay, type CatalogModel, type CatalogTextModel, DEFAULT_ADAPTERS, type DefaultObjectOutput, type GeneratedImage, type ImageBytes, type ImageCallOptions, type ImageCallResult, type ImageQuality, type ImageRequest, type ImageResult, type ImageSafetySetting, type ImageSize, type JsonObject, JsonObjectSchema, type JsonPrimitive, type JsonValue, JsonValueSchema, type LanguageModelHandle, type Lifecycle, MODELS, type MediaPart, type MediaRef, type ModelConstraints, type ModelKit, type ModelKitConfig, ModelKitError, type ModelKitErrorCode, type ModelKitErrorInit, type ModelType, type ModelkitGenerateObjectOptions, type ModelkitGenerateTextOptions, type ModelkitStreamObjectOptions, type ModelkitStreamTextOptions, type ObjectOutput, type ObjectResult, type OnUnsupported, type OutputFormat, type PricingKind, type ProviderErrorBody, type ProviderKeyName, type ProviderKeys, type ProviderOptionValue, type ProviderOptions, type ReferenceLimits, type RequiredInput, type ResolveResult, type Routing, type SupportedOption, type TextMethods, type TextModelInstance, type UpscaleOptions, type UsageEvent, type UsageModality, type UsageUnit, type VideoCallJob, type VideoCallOptions, type VideoJob, type VideoModel, type VideoRequest, type VideoResolution, type VideoResult, type Warning, aiSdkTextAdapter, arkAdapter, aspectRatioToSize, classifyHttpError, createDefaultModelKit, createModelKit, describe, describeThrown, generateImage as experimental_generateImage, falAdapter, generateAudio, generateImage, generateObject, generateText, generateVideo, googleGenaiAdapter, googleImageAdapter, higgsfieldAdapter, isModelKitError, keysFromEnv, languageModel, mergeTextProviderOptions, nearestAspectRatio, openaiImageAdapter, passthroughTextModel, pollUntil, prepareMediaPart, prodiaAdapter, readErrorBody, replicateAdapter, resolveAudioOptions, resolveImageOptions, resolveKeys, resolveVideoOptions, shouldRetry, sleep, streamObject, streamText, textUsageEvent, toGeneratedImage, withRetry, xaiVideoAdapter };
|
package/dist/index.d.ts
CHANGED
|
@@ -200,6 +200,31 @@ type ProviderOptions = {
|
|
|
200
200
|
type UsageUnit = "tokens" | "images" | "seconds" | "reported_cost_usd" | "compute_seconds";
|
|
201
201
|
type UsageModality = "TEXT" | "IMAGE" | "VIDEO" | "AUDIO";
|
|
202
202
|
type PricingKind = "token" | "image_size" | "video_per_second" | "flat";
|
|
203
|
+
/** What a model picker shows for a row. Free of any surface-specific ids. */
|
|
204
|
+
interface CatalogDisplay {
|
|
205
|
+
/** Vendor as the UI names it: "google", "openai", "meta", "bytedance", "xai", "kuaishou", ... */
|
|
206
|
+
provider: string;
|
|
207
|
+
/** One or two sentences for the picker card. */
|
|
208
|
+
description: string;
|
|
209
|
+
/** CDN URL of the vendor or model logo. */
|
|
210
|
+
logo?: string;
|
|
211
|
+
}
|
|
212
|
+
/** Capability flags a UI keys off. Absent means false / unknown. */
|
|
213
|
+
interface CatalogCapabilities {
|
|
214
|
+
/** Image rows: generates from a prompt alone. */
|
|
215
|
+
imageGenerate?: boolean;
|
|
216
|
+
/** Image rows: edits or conditions on reference images. */
|
|
217
|
+
imageEdit?: boolean;
|
|
218
|
+
/** Video rows: takes an existing video as the thing to edit or extend. */
|
|
219
|
+
acceptsSourceVideo?: boolean;
|
|
220
|
+
/** Video rows: first/last frames and reference images are mutually exclusive inputs. */
|
|
221
|
+
framesExcludeReferences?: boolean;
|
|
222
|
+
/** Text rows. */
|
|
223
|
+
vision?: boolean;
|
|
224
|
+
tools?: boolean;
|
|
225
|
+
structuredOutput?: boolean;
|
|
226
|
+
contextWindow?: number;
|
|
227
|
+
}
|
|
203
228
|
interface CatalogModel {
|
|
204
229
|
/** Canonical id. Equals the pricing key in pro-backend credit_pricing_* tables. */
|
|
205
230
|
id: string;
|
|
@@ -219,6 +244,9 @@ interface CatalogModel {
|
|
|
219
244
|
modality: UsageModality;
|
|
220
245
|
};
|
|
221
246
|
pricingKind: PricingKind;
|
|
247
|
+
/** Required on every `active` row so a picker can render it without a hand-written catalog. */
|
|
248
|
+
display?: CatalogDisplay;
|
|
249
|
+
capabilities?: CatalogCapabilities;
|
|
222
250
|
}
|
|
223
251
|
interface Warning {
|
|
224
252
|
code: "ratio_coerced" | "ratio_dropped" | "size_coerced" | "resolution_coerced" | "duration_coerced" | "references_trimmed" | "option_ignored";
|
|
@@ -629,4 +657,4 @@ declare function describeThrown(cause: unknown): ThrownErrorInfo;
|
|
|
629
657
|
/** Add the AI SDK `GeneratedFile` accessors to adapter image bytes. base64 is computed on first read. */
|
|
630
658
|
declare function toGeneratedImage(image: ImageBytes): GeneratedImage;
|
|
631
659
|
|
|
632
|
-
export { ADAPTER_KEYS, type Adapter, type AdapterContext, type AdapterEndpoints, type AdapterId, type AdapterRegistry, type AiTextProviderOptions, type AspectRatio, type AudioRequest, type AudioResult, type CallContext, Catalog, type CatalogModel, type CatalogTextModel, DEFAULT_ADAPTERS, type DefaultObjectOutput, type GeneratedImage, type ImageBytes, type ImageCallOptions, type ImageCallResult, type ImageQuality, type ImageRequest, type ImageResult, type ImageSafetySetting, type ImageSize, type JsonObject, JsonObjectSchema, type JsonPrimitive, type JsonValue, JsonValueSchema, type LanguageModelHandle, type Lifecycle, MODELS, type MediaPart, type MediaRef, type ModelConstraints, type ModelKit, type ModelKitConfig, ModelKitError, type ModelKitErrorCode, type ModelKitErrorInit, type ModelType, type ModelkitGenerateObjectOptions, type ModelkitGenerateTextOptions, type ModelkitStreamObjectOptions, type ModelkitStreamTextOptions, type ObjectOutput, type ObjectResult, type OnUnsupported, type OutputFormat, type PricingKind, type ProviderErrorBody, type ProviderKeyName, type ProviderKeys, type ProviderOptionValue, type ProviderOptions, type ReferenceLimits, type RequiredInput, type ResolveResult, type Routing, type SupportedOption, type TextMethods, type TextModelInstance, type UpscaleOptions, type UsageEvent, type UsageModality, type UsageUnit, type VideoCallJob, type VideoCallOptions, type VideoJob, type VideoModel, type VideoRequest, type VideoResolution, type VideoResult, type Warning, aiSdkTextAdapter, arkAdapter, aspectRatioToSize, classifyHttpError, createDefaultModelKit, createModelKit, describe, describeThrown, generateImage as experimental_generateImage, falAdapter, generateAudio, generateImage, generateObject, generateText, generateVideo, googleGenaiAdapter, googleImageAdapter, higgsfieldAdapter, isModelKitError, keysFromEnv, languageModel, mergeTextProviderOptions, nearestAspectRatio, openaiImageAdapter, passthroughTextModel, pollUntil, prepareMediaPart, prodiaAdapter, readErrorBody, replicateAdapter, resolveAudioOptions, resolveImageOptions, resolveKeys, resolveVideoOptions, shouldRetry, sleep, streamObject, streamText, textUsageEvent, toGeneratedImage, withRetry, xaiVideoAdapter };
|
|
660
|
+
export { ADAPTER_KEYS, type Adapter, type AdapterContext, type AdapterEndpoints, type AdapterId, type AdapterRegistry, type AiTextProviderOptions, type AspectRatio, type AudioRequest, type AudioResult, type CallContext, Catalog, type CatalogCapabilities, type CatalogDisplay, type CatalogModel, type CatalogTextModel, DEFAULT_ADAPTERS, type DefaultObjectOutput, type GeneratedImage, type ImageBytes, type ImageCallOptions, type ImageCallResult, type ImageQuality, type ImageRequest, type ImageResult, type ImageSafetySetting, type ImageSize, type JsonObject, JsonObjectSchema, type JsonPrimitive, type JsonValue, JsonValueSchema, type LanguageModelHandle, type Lifecycle, MODELS, type MediaPart, type MediaRef, type ModelConstraints, type ModelKit, type ModelKitConfig, ModelKitError, type ModelKitErrorCode, type ModelKitErrorInit, type ModelType, type ModelkitGenerateObjectOptions, type ModelkitGenerateTextOptions, type ModelkitStreamObjectOptions, type ModelkitStreamTextOptions, type ObjectOutput, type ObjectResult, type OnUnsupported, type OutputFormat, type PricingKind, type ProviderErrorBody, type ProviderKeyName, type ProviderKeys, type ProviderOptionValue, type ProviderOptions, type ReferenceLimits, type RequiredInput, type ResolveResult, type Routing, type SupportedOption, type TextMethods, type TextModelInstance, type UpscaleOptions, type UsageEvent, type UsageModality, type UsageUnit, type VideoCallJob, type VideoCallOptions, type VideoJob, type VideoModel, type VideoRequest, type VideoResolution, type VideoResult, type Warning, aiSdkTextAdapter, arkAdapter, aspectRatioToSize, classifyHttpError, createDefaultModelKit, createModelKit, describe, describeThrown, generateImage as experimental_generateImage, falAdapter, generateAudio, generateImage, generateObject, generateText, generateVideo, googleGenaiAdapter, googleImageAdapter, higgsfieldAdapter, isModelKitError, keysFromEnv, languageModel, mergeTextProviderOptions, nearestAspectRatio, openaiImageAdapter, passthroughTextModel, pollUntil, prepareMediaPart, prodiaAdapter, readErrorBody, replicateAdapter, resolveAudioOptions, resolveImageOptions, resolveKeys, resolveVideoOptions, shouldRetry, sleep, streamObject, streamText, textUsageEvent, toGeneratedImage, withRetry, xaiVideoAdapter };
|