@shop-os/modelkit 0.1.4 → 0.1.5
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 +35 -12
- package/dist/index.cjs +411 -318
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +9 -2
- package/dist/index.d.ts +9 -2
- package/dist/index.js +411 -318
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -26,6 +26,11 @@ type MediaRef = {
|
|
|
26
26
|
type ModelType = "text" | "image" | "video" | "audio" | "upscale" | "bg-remove";
|
|
27
27
|
type Lifecycle = "active" | "hidden" | "deprecated" | "retired";
|
|
28
28
|
type AdapterId = "ai-sdk-text" | "google-image" | "openai-image" | "google-genai" | "ark" | "fal" | "replicate" | "prodia" | "higgsfield" | "xai-video";
|
|
29
|
+
/** Gemini image safety threshold, per category, sent only when the caller opts in. */
|
|
30
|
+
type ImageSafetySetting = {
|
|
31
|
+
category: string;
|
|
32
|
+
threshold: string;
|
|
33
|
+
};
|
|
29
34
|
interface ImageRequest {
|
|
30
35
|
model: string;
|
|
31
36
|
prompt: string;
|
|
@@ -39,6 +44,8 @@ interface ImageRequest {
|
|
|
39
44
|
outputFormat?: OutputFormat;
|
|
40
45
|
/** Upscale factor for upscaler rows; adapters map it to the provider's field. */
|
|
41
46
|
scaleFactor?: number;
|
|
47
|
+
/** Gemini image safety thresholds. Off (provider default) unless supplied. */
|
|
48
|
+
safetySettings?: ImageSafetySetting[];
|
|
42
49
|
}
|
|
43
50
|
/**
|
|
44
51
|
* What a caller passes to generateImage. Same field names as the AI SDK's
|
|
@@ -122,7 +129,7 @@ interface MediaPart {
|
|
|
122
129
|
cleanup?: () => Promise<void>;
|
|
123
130
|
}
|
|
124
131
|
type RequiredInput = "firstFrame" | "sourceVideo" | "references";
|
|
125
|
-
type SupportedOption = "seed" | "quality" | "negativePrompt" | "cfgScale" | "generateAudio" | "promptExpansion" | "lastFrame" | "count" | "outputFormat" | "scaleFactor" | "instrumental";
|
|
132
|
+
type SupportedOption = "seed" | "quality" | "negativePrompt" | "cfgScale" | "generateAudio" | "promptExpansion" | "lastFrame" | "count" | "outputFormat" | "scaleFactor" | "safetySettings" | "instrumental";
|
|
126
133
|
interface ReferenceLimits {
|
|
127
134
|
images?: number;
|
|
128
135
|
videos?: number;
|
|
@@ -590,4 +597,4 @@ declare function describeThrown(cause: unknown): ThrownErrorInfo;
|
|
|
590
597
|
/** Add the AI SDK `GeneratedFile` accessors to adapter image bytes. base64 is computed on first read. */
|
|
591
598
|
declare function toGeneratedImage(image: ImageBytes): GeneratedImage;
|
|
592
599
|
|
|
593
|
-
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 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 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, resolveImageOptions, resolveKeys, resolveVideoOptions, shouldRetry, sleep, streamObject, streamText, textUsageEvent, toGeneratedImage, withRetry, xaiVideoAdapter };
|
|
600
|
+
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 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, resolveImageOptions, resolveKeys, resolveVideoOptions, shouldRetry, sleep, streamObject, streamText, textUsageEvent, toGeneratedImage, withRetry, xaiVideoAdapter };
|
package/dist/index.d.ts
CHANGED
|
@@ -26,6 +26,11 @@ type MediaRef = {
|
|
|
26
26
|
type ModelType = "text" | "image" | "video" | "audio" | "upscale" | "bg-remove";
|
|
27
27
|
type Lifecycle = "active" | "hidden" | "deprecated" | "retired";
|
|
28
28
|
type AdapterId = "ai-sdk-text" | "google-image" | "openai-image" | "google-genai" | "ark" | "fal" | "replicate" | "prodia" | "higgsfield" | "xai-video";
|
|
29
|
+
/** Gemini image safety threshold, per category, sent only when the caller opts in. */
|
|
30
|
+
type ImageSafetySetting = {
|
|
31
|
+
category: string;
|
|
32
|
+
threshold: string;
|
|
33
|
+
};
|
|
29
34
|
interface ImageRequest {
|
|
30
35
|
model: string;
|
|
31
36
|
prompt: string;
|
|
@@ -39,6 +44,8 @@ interface ImageRequest {
|
|
|
39
44
|
outputFormat?: OutputFormat;
|
|
40
45
|
/** Upscale factor for upscaler rows; adapters map it to the provider's field. */
|
|
41
46
|
scaleFactor?: number;
|
|
47
|
+
/** Gemini image safety thresholds. Off (provider default) unless supplied. */
|
|
48
|
+
safetySettings?: ImageSafetySetting[];
|
|
42
49
|
}
|
|
43
50
|
/**
|
|
44
51
|
* What a caller passes to generateImage. Same field names as the AI SDK's
|
|
@@ -122,7 +129,7 @@ interface MediaPart {
|
|
|
122
129
|
cleanup?: () => Promise<void>;
|
|
123
130
|
}
|
|
124
131
|
type RequiredInput = "firstFrame" | "sourceVideo" | "references";
|
|
125
|
-
type SupportedOption = "seed" | "quality" | "negativePrompt" | "cfgScale" | "generateAudio" | "promptExpansion" | "lastFrame" | "count" | "outputFormat" | "scaleFactor" | "instrumental";
|
|
132
|
+
type SupportedOption = "seed" | "quality" | "negativePrompt" | "cfgScale" | "generateAudio" | "promptExpansion" | "lastFrame" | "count" | "outputFormat" | "scaleFactor" | "safetySettings" | "instrumental";
|
|
126
133
|
interface ReferenceLimits {
|
|
127
134
|
images?: number;
|
|
128
135
|
videos?: number;
|
|
@@ -590,4 +597,4 @@ declare function describeThrown(cause: unknown): ThrownErrorInfo;
|
|
|
590
597
|
/** Add the AI SDK `GeneratedFile` accessors to adapter image bytes. base64 is computed on first read. */
|
|
591
598
|
declare function toGeneratedImage(image: ImageBytes): GeneratedImage;
|
|
592
599
|
|
|
593
|
-
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 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 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, resolveImageOptions, resolveKeys, resolveVideoOptions, shouldRetry, sleep, streamObject, streamText, textUsageEvent, toGeneratedImage, withRetry, xaiVideoAdapter };
|
|
600
|
+
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 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, resolveImageOptions, resolveKeys, resolveVideoOptions, shouldRetry, sleep, streamObject, streamText, textUsageEvent, toGeneratedImage, withRetry, xaiVideoAdapter };
|